User:Willy1018/common.js: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
importScript('User:Alex 21/script-functions.js'); |
importScript('User:Alex 21/script-functions.js'); |
||
importScript('User:Alex 21/script-redlinks.js'); |
importScript('User:Alex 21/script-redlinks.js'); |
||
// Copied from [[:w:zh:MediaWiki:Gadget-variant-link-fix.js]] |
|||
try { |
|||
var ref, loc; |
|||
try { |
|||
ref = new mw.Uri( document.referrer ); |
|||
} catch ( e ) { |
|||
ref = new mw.Uri( document.referrer + '/' ); |
|||
} |
|||
loc = new mw.Uri( location.href ); |
|||
if (/\.google\./.test(ref.host) && loc.host == 'zh.m.wikipedia.org') { |
|||
loc.host = 'zh.wikipedia.org'; |
|||
loc.path = loc.path.replace(/^\/zh(-[^/]+)?\//, "/wiki/"); |
|||
location.replace(loc.toString()); |
|||
} |
|||
} catch ( e ) { |
|||
} |
Revision as of 02:46, 3 June 2022
importScript('User:Alex 21/script-functions.js');
importScript('User:Alex 21/script-redlinks.js');
// Copied from [[:w:zh:MediaWiki:Gadget-variant-link-fix.js]]
try {
var ref, loc;
try {
ref = new mw.Uri( document.referrer );
} catch ( e ) {
ref = new mw.Uri( document.referrer + '/' );
}
loc = new mw.Uri( location.href );
if (/\.google\./.test(ref.host) && loc.host == 'zh.m.wikipedia.org') {
loc.host = 'zh.wikipedia.org';
loc.path = loc.path.replace(/^\/zh(-[^/]+)?\//, "/wiki/");
location.replace(loc.toString());
}
} catch ( e ) {
}