MediaWiki:Common.js: Difference between revisions
From Lenn's Fun Stuff
No edit summary Tags: Mobile edit Mobile web edit |
No edit summary Tags: Mobile edit Mobile web edit |
||
| Line 21: | Line 21: | ||
$('meta[name="viewport"]').remove(); | $('meta[name="viewport"]').remove(); | ||
$('head').append('<meta name="viewport" content="width=1200, initial-scale=0.3, user-scalable=yes">'); | $('head').append('<meta name="viewport" content="width=1200, initial-scale=0.3, user-scalable=yes">'); | ||
} | |||
/* Zoom out on Mobile to fit the Desktop width */ | |||
if (window.innerWidth < 1200) { | |||
var viewportMeta = document.querySelector('meta[name="viewport"]'); | |||
if (viewportMeta) { | |||
viewportMeta.setAttribute('content', 'width=1200, initial-scale=0.3'); | |||
} | |||
} | } | ||
Revision as of 02:12, 15 March 2026
/* FORCE DESKTOP MODE ON MOBILE */
if ( window.location.href.indexOf('mobileaction=toggle_view_mobile') === -1 &&
window.location.href.indexOf('mobileaction=toggle_view_desktop') === -1 &&
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
var url = new URL(window.location.href);
url.searchParams.set('mobileaction', 'toggle_view_desktop');
window.location.href = url.href;
}
/* FORCE DESKTOP SCALE */
(function() {
var meta = document.createElement('meta');
meta.name = "viewport";
meta.content = "width=1200, initial-scale=0.3, maximum-scale=1.0";
document.getElementsByTagName('head')[0].appendChild(meta);
})();
/* Adjust Viewport for Mobile but stay in Mobile Mode */
if (window.innerWidth < 1200) {
$('meta[name="viewport"]').remove();
$('head').append('<meta name="viewport" content="width=1200, initial-scale=0.3, user-scalable=yes">');
}
/* Zoom out on Mobile to fit the Desktop width */
if (window.innerWidth < 1200) {
var viewportMeta = document.querySelector('meta[name="viewport"]');
if (viewportMeta) {
viewportMeta.setAttribute('content', 'width=1200, initial-scale=0.3');
}
}