MediaWiki:Gadget-variant-link-fix.js
注意:儲存之後,你必須清除瀏覽器快取才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift鍵並單擊工具列的「重新整理」按鈕。參閱Help:繞過瀏覽器快取以取得更多幫助。
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) && /^\/zh(-[^/]+)?\//.test(loc.path)) {
loc.path = loc.path.replace(/^\/zh(-[^/]+)?\//, "/wiki/");
location.replace(loc.toString());
}
} catch ( e ) {
}