MediaWiki:Mobile.js:修订间差异
imported>=海豚= 无编辑摘要 |
imported>=海豚= 无编辑摘要 |
||
| 第111行: | 第111行: | ||
} : true); | } : true); | ||
}); | }); | ||
// 修复验证码 | |||
if (["edit", "submit"].includes(mw.config.get("wgAction"))) { | |||
tcc(); | |||
} | |||
var $window = $(window); | |||
$window.triggerHandler("resize"); | |||
$window.on("load", function () { | |||
$window.triggerHandler("resize"); | |||
}); | |||
var needHashChange = /[)]$/.test(location.pathname + location.search); | |||
if (needHashChange) { | |||
var originHash = location.hash; | |||
location.hash = "%"; | |||
location.hash = originHash; | |||
} | |||
$window.on("hashchange.hashchange", function () { | |||
var hash = decodeURIComponent(location.hash.replace(/^#/, "")); | |||
if (hash.length > 0) { | |||
var target = document.getElementById(hash); | |||
if (target) { | |||
var $target = $(target); | |||
var mwCollapsible = $target.closest(".mw-collapsible"); | |||
if (mwCollapsible.length > 0) { | |||
mwCollapsible.filter(".mw-collapsed").find(".mw-collapsible-toggle").triggerHandler("click"); | |||
setTimeout(function () { | |||
$("html, body").scrollTop($target.offset().top - window.innerHeight / 5); | |||
}, 50); | |||
} | |||
} | |||
} | |||
}); | |||
$window.one("load.hashchange", function () { | |||
$window.triggerHandler("hashchange.hashchange"); | |||
}); | |||
$(function () { | |||
$window.triggerHandler("load.hashchange"); | |||
}); | |||
})(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量 | })(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量 | ||
// </pre> | // </pre> | ||