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

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
imported>=海豚=
无编辑摘要
imported>=海豚=
无编辑摘要
第1行: 第1行:
 
 
       var url = new mw.Uri();
       var wgUserVariant = mw.config.get("wgUserVariant");
       if (!("variant" in url.query || "uselang" in url.query) && !url.path.startsWith("/index.php") && wgUserVariant in map) {
          $("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>语言变体 ' + wgUserVariant + name[wgUserVariant] + '会导致繁简转换无法正常工作,我们建议您切换到以下两种<b>内容</b>语言变体之一:</p><p><span class="noteTA-lang-changer mw-ui-button" data-lang="zh-cn">zh-cn(中国大陆)</span> <span class="noteTA-lang-changer mw-ui-button" data-lang="zh-tw">zh-tw(台湾地区)</span> | <span id="noteTA-lang-explainer" class="mw-ui-button">了解更多</span> <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>语言变体 ' + wgUserVariant + name[wgUserVariant] + '会导致繁简转换无法正常工作,我们建议您切换到以下两种<b>内容</b>语言变体之一:</p><p><span class="noteTA-lang-changer mw-ui-button" data-lang="zh-cn">zh-cn(中国大陆)</span> <span class="noteTA-lang-changer mw-ui-button" data-lang="zh-tw">zh-tw(台湾地区)</span> | <span id="noteTA-lang-explainer" class="mw-ui-button">了解更多</span> <span id="noteTA-lang-disable" class="mw-ui-button mw-ui-destructive">不再提示</span></div>');
          $(".noteTA-lang-changer").on("click", function(e) {
          $(".noteTA-lang-changer").on("click", function(e) {
第21行: 第18行:
            localStorage.setItem("AnnTools-noteTA-alert", "true");
            localStorage.setItem("AnnTools-noteTA-alert", "true");
          });
          });
       }
  
  
    }, 0);
    }, 0);
});
});
// </pre>
// </pre>

2021年8月6日 (五) 12:38的版本

                $("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>语言变体 ' + wgUserVariant + name[wgUserVariant] + '会导致繁简转换无法正常工作,我们建议您切换到以下两种<b>内容</b>语言变体之一:</p><p><span class="noteTA-lang-changer mw-ui-button" data-lang="zh-cn">zh-cn(中国大陆)</span> <span class="noteTA-lang-changer mw-ui-button" data-lang="zh-tw">zh-tw(台湾地区)</span> | <span id="noteTA-lang-explainer" class="mw-ui-button">了解更多</span> <span id="noteTA-lang-disable" class="mw-ui-button 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");
                });
 
    }, 0);
});
// </pre>