MediaWiki:Mobile.js:修订间差异
imported>=海豚= 无编辑摘要 |
imported>=海豚= 无编辑摘要 |
||
| 第265行: | 第265行: | ||
} while (document.querySelector('a[data-linkid="' + result + '"]')); | } while (document.querySelector('a[data-linkid="' + result + '"]')); | ||
return result; | return result; | ||
} | |||
//来自搜索引擎的访问默认跳转zh版 | |||
function searchReferrerJump() { | |||
if (/\/\/www.(?:google|baidu|bing).com\//.test(document.referrer)) { | |||
var mobileTags = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPod"]; | |||
if (!/\sVR\s/g.test(navigator.userAgent)) { | |||
for (var i = 0, l = mobileTags.length; i < l; i++) { | |||
if (navigator.userAgent.includes(mobileTags[i])) { | |||
return; | |||
} | |||
} | |||
var toggleLink = document.querySelector("#mw-mf-display-toggle"); | |||
window.location.replace(toggleLink.href); | |||
} | |||
} | |||
} | } | ||
// Mobile Navmenu by GFwiki | // Mobile Navmenu by GFwiki | ||
| 第286行: | 第301行: | ||
/* 函数执行体 */ | /* 函数执行体 */ | ||
$(function() { | $(function() { | ||
//来自搜索引擎的访问默认跳转桌面版 | |||
searchReferrerJump(); | |||
//页顶提示模板相关 | //页顶提示模板相关 | ||
commonBoxs(); | commonBoxs(); | ||