User:Irukaza/common.js:修订间差异
跳到导航
跳到搜索
imported>=海豚= 无编辑摘要 |
imported>=海豚= 无编辑摘要 |
||
第1行: | 第1行: | ||
$(window).scroll(function(){ | $(window).scroll(function(){ | ||
if ($(this).scrollTop() > 500) { | if ($(this).scrollTop() > 500) { | ||
第28行: | 第24行: | ||
} | } | ||
}); | }); | ||
2021年8月6日 (五) 20:58的版本
$(window).scroll(function(){
if ($(this).scrollTop() > 500) {
if (mw.config.get("wgAction") === "view"&& !document.querySelector("#Newusertips")) {
var url = new mw.Uri();
var wgUserVariant = mw.config.get("wgUserVariant");
$("body").append('<div id="Newusertips" style="background: #a7a93cf0; color: white; text-align: center; padding: .17rem; position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 2.5px #000; z-index: 9999;"><p>我们鼓励您编辑条目,创建账号成为本站的一员,登录后您可以建立自己的用户页并署名贡献(<a class="p4js-conversion-link mw-ui-destructive" href="www.baidu.com"> 注册 </a>|<a class="p4js-conversion-link mw-ui-destructive" href="www.baidu.com"> 登录 </a>)(<span id="Newusertips-disable" class="p4js-conversion-link mw-ui-destructive"> 不再提示 </span>)</div>');
}
$(".Newusertips-changer").on("click", function(e) {
var uri = new mw.Uri();
var path = uri.path;
Object.keys(map).forEach(function(s) {
path = path.replace(new RegExp("^/" + s + "/"), "/");
});
uri.path = "/" + e.target.dataset.lang + "/" + path.replace(/^\//, "");
location.replace(uri);
$("#Newusertips").remove();
window.localStorage.setItem('Newusertips', true);
}).filter('[data-lang="' + wgUserVariant + '"]').addClass("mw-ui-progressive");
$("#Newusertips-disable").on("click", function() {
$("#Newusertips").remove();
window.localStorage.setItem('Newusertips', true);
});
}
});