มีเดียวิกิ:Common.js/mobile.js
หน้าตา
หมายเหตุ: หลังเผยแพร่ คุณอาจต้องล้างแคชเว็บเบราว์เซอร์ของคุณเพื่อดูการเปลี่ยนแปลง
- ไฟร์ฟอกซ์ / ซาฟารี: กด Shift ค้างขณะคลิก Reload หรือกด Ctrl-F5 หรือ Ctrl-R (⌘-R บนแมค)
- กูเกิล โครม: กด Ctrl-Shift-R (⌘-Shift-R บนแมค)
- ไมโครซอฟท์ เอดจ์: กด Ctrl ค้างขณะคลิก Refresh หรือกด Ctrl-F5
/** Mobile browser helper link ************************************************
*
* Adds a link to the mobile-optimized gateway at en.m.wikimedia.org
* for viewers on iPhone, iPod Touch, Palm Pre, and Android devices.
* This is to drive more test traffic there for now;
* it's still in development but very usable for reading!
*
* You can turn off the redirect by setting the cookie "stopMobileRedirect=true"
*
* Maintainer: [[User:Brion VIBBER]], [[User:hcatlin]]
*/
var wgMainPageName = 'หน้าหลัก';
var stopMobileRedirectCookieExists = function() {
return (document.cookie.indexOf("stopMobileRedirect=true") >= 0);
}
var mobileSiteLink = function() {
if (mw.config.get('wgCanonicalNamespace') == 'Special' && mw.config.get('wgCanonicalSpecialPageName') == 'Search') {
var pageLink = '?search=' + encodeURIComponent(document.getElementById('searchText').value);
} else if (mw.config.get('wgPageName') == wgMainPageName) {
var pageLink = '::Home'; // Special case
} else {
var pageLink = encodeURIComponent(mw.config.get('wgPageName')).replace('%2F','/').replace('%3A',':');
}
return 'http://' + mw.config.get('wgContentLanguage') + '.m.wikipedia.org/wiki/' + pageLink + "?wasRedirected=true"
}
if (!stopMobileRedirectCookieExists()) {
document.location = mobileSiteLink();
}