MediaWiki:Common.js: Difference between revisions

Content deleted Content added
Get an error parsing URLs with raw % signs. Try and catch this just in case
rm javascript hack for phab:T316578 now we have a server-side fix
Line 6:
mw.loader.using( ['mediawiki.util', 'mediawiki.Uri'] ).done( function() {
 
// If there was a problem detecting country, try sending them round again
// for another bite at the cookie - https://phabricator.wikimedia.org/T316578
try {
var uri = new mw.Uri( window.location.href );
if ( uri.query.title === 'Special:LandingPage' && uri.query.country === 'XX' && uri.query.retried === undefined ) {
uri.path = '';
uri.query.retried = 1; // only do this once
delete uri.query.country;
delete uri.query.title;
window.location.href = uri.toString();
}
} catch (error) {
console.warn('Error parsing URL. Possibly due to unreplaced % signs?');
}
// Disable logo link
$('#p-logo a').attr( { href: '#', title: '' } );