User:Irukaza/common.js:修订间差异

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
imported>=海豚=
无编辑摘要
imported>=海豚=
无编辑摘要
第2行: 第2行:
        var url = new mw.Uri();
        var url = new mw.Uri();
        var wgUserVariant = mw.config.get("wgUserVariant");
        var wgUserVariant = mw.config.get("wgUserVariant");
        $("body").append('<div id="noteTA-lang" style="background: #3366CC; color: white; text-align: center; padding: .5rem; position: fixed; top: 0; left: 0; right: 0; z-index: 9999;"><p>我们推荐您登陆<b>内容</b>语言变体会导致繁简转换无法正常工作,我们建议您切换到以下两种<b>内容</b>语言变体之一:<a class="p4js-conversion-link" href="www.baidu.com">点击</a> <span id="noteTA-lang-disable" class="mw-ui-button mw-ui-destructive">不再提示</span></div>');
        $("body").append('<div id="noteTA-lang" style="background: #3366CC; color: white; text-align: center; padding: .5rem; position: fixed; top: 0; left: 0; right: 0; z-index: 9999;"><p>我们推荐您登陆<b>内容</b>语言变体会导致繁简转换无法正常工作,我们建议您切换到以下两种<b>内容</b>语言变体之一:<a class="p4js-conversion-link" href="www.baidu.com">点击</a> <span id="noteTA-lang-disable" class=""p4js-conversion-link mw-ui-destructive">不再提示</span></div>');
}
}
  $(".noteTA-lang-changer").on("click", function(e) {
  $(".noteTA-lang-changer").on("click", function(e) {

2021年8月6日 (五) 13:04的版本

if (mw.config.get("wgAction") === "view"&& !document.querySelector("#noteTA-lang")) {
            var url = new mw.Uri();
            var wgUserVariant = mw.config.get("wgUserVariant");
            $("body").append('<div id="noteTA-lang" style="background: #3366CC; color: white; text-align: center; padding: .5rem; position: fixed; top: 0; left: 0; right: 0; z-index: 9999;"><p>我们推荐您登陆<b>内容</b>语言变体会导致繁简转换无法正常工作,我们建议您切换到以下两种<b>内容</b>语言变体之一:<a class="p4js-conversion-link" href="www.baidu.com">点击</a> <span id="noteTA-lang-disable" class=""p4js-conversion-link mw-ui-destructive">不再提示</span></div>');
}
 $(".noteTA-lang-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);
                    $("#noteTA-lang").remove();
                }).filter('[data-lang="' + wgUserVariant + '"]').addClass("mw-ui-progressive");
                $("#noteTA-lang-explainer").on("click", function() {
                    //open(mw.config.get("wgServer") + mw.config.get("wgScriptPath") +,"_blank");
                }).hide();
                $("#noteTA-lang-disable").on("click", function() {
                    $("#noteTA-lang").remove();
                    localStorage.setItem("AnnTools-noteTA-alert", "true");
                });