MediaWiki:Common.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
piccolo aggiustamento
redirect su it.m.wikipedia.org per chi si collega da mobile
Riga 437:
}
})
 
 
/** Mobile Redirect Helper ************************************************
*
* Redirects to the mobile-optimized gateway at it.m.wikipedia.org
* for viewers on iPhone, iPod Touch, Palm Pre, and Android devices.
*
* You can turn off the redirect by setting the cookie "stopMobileRedirect=true"
*
* This code cannot be imported, because the JS only loads after all other files
* and this was causing major issues for users with mobile devices. Must be loaded
* *before* the images and etc of the page on all mobile devices.
*
* Maintainer: [[User:Brion VIBBER]], [[User:hcatlin]]
*/
if (/(Android|iPhone|iPod|webOS|NetFront|Opera Mini|SEMC-Browser|PlayStation Portable|Nintendo Wii)/.test(navigator.userAgent)) {
var wgMainPageName = 'Main_Page';
var stopMobileRedirectCookieExists = function() {
return (document.cookie.indexOf("stopMobileRedirect=true") >= 0);
}
var mobileSiteLink = function() {
if (wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'Search') {
var pageLink = '?search=' + encodeURIComponent(document.getElementById('searchText').value);
} else if (wgPageName == wgMainPageName) {
var pageLink = '::Home'; // Special case
} else {
var pageLink = encodeURIComponent(wgPageName).replace('%2F','/').replace('%3A',':');
}
return 'http://' + wgContentLanguage + '.m.wikipedia.org/wiki/' + pageLink + "?wasRedirected=true"
}
}