User:Kxx/monobook.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
var wikEdFrameCSS = [];
var wikEdDiffCSS = [];
 
var needSetFont = screen.width > 1024;
 
if (needSetFont) {
    var styleNode = document.createElement("style");
    styleNode.rel = "stylesheet";
    styleNode.type = "text/css";
    document.getElementsByTagName("head")[0].appendChild(styleNode);
    var styleSheet = document.styleSheets[document.styleSheets.length - 1];
    if (navigator.platform.indexOf("Win32") >= 0) {
        if (navigator.userAgent.indexOf("MSIE") < 0) {
            styleSheet.insertRule("body { font-size: 9.5pt; }", styleSheet.cssRules.length);
            if (navigator.userAgent.indexOf("Safari") >= 0) {
                var zhFont;
                if (window.location.href.indexOf("zh-hk") >= 0
                        || window.location.href.indexOf("zh-tw") >= 0)
                    zhFont = "\"Microsoft JhengHei\"";
                else
                    zhFont = "\"Microsoft YaHei\"";
                styleSheet.insertRule("body { font-family: Corbel, " + zhFont + "; }",
                        styleSheet.cssRules.length);
                styleSheet.insertRule("input, select { font-family: Calibri, " + zhFont
                        + "; font-size: 1em; }", styleSheet.cssRules.length);
                styleSheet.insertRule("td.diff-marker, td.diff-context, td.diff-deletedline,"
                        + " td.diff-addedline { font-family: Calibri, " + zhFont + "; }",
                        styleSheet.cssRules.length);
            } else {
                styleSheet.insertRule("input, select { font-family: Calibri; font-size: 1em; }",
                        styleSheet.cssRules.length);
                styleSheet.insertRule("td.diff-marker, td.diff-context, td.diff-deletedline,"
                        + " td.diff-addedline { font-family: Calibri; }", styleSheet.cssRules.length);
            }
            styleSheet.insertRule(".navpopup { font-size: 100% !important; }",
                    styleSheet.cssRules.length);
            styleSheet.insertRule(".popupPreview { font-size: 110% !important; }",
                    styleSheet.cssRules.length);
        } else {
            styleSheet.addRule("body", "font-size: 9.5pt; font-family: Corbel;");
            styleSheet.addRule("tt", "font-family: Consolas");
            styleSheet.addRule("code", "font-family: Consolas");
            styleSheet.addRule("input", "font-family: Calibri; font-size: 1em;");
            styleSheet.addRule("select", "font-family: Calibri; font-size: 1em;");
            styleSheet.addRule("td.diff-marker", "font-family: Calibri;");
            styleSheet.addRule("td.diff-context", "font-family: Calibri;");
            styleSheet.addRule("td.diff-deletedline", "font-family: Calibri;");
            styleSheet.addRule("td.diff-addedline", "font-family: Calibri;");
            styleSheet.addRule(".navpopup", "font-size: 100% !important;");
            styleSheet.addRule(".popupPreview", "font-size: 110% !important;");
            styleSheet.addRule("textarea#wpTextbox1", "font-size: 95% !important;");
            styleSheet.addRule(".texhtml", "font-family: Cambria !important;");
        }
        wikEdFrameCSS[".wikEdFrameBodyPlain"] = "height: auto; min-height: 100%; width: auto;"
            + " background-color: transparent; margin: 0; padding: 0; padding-left: 0.25em;"
            + " overflow: auto; font-family: Consolas; font-size: 0.95em";
        wikEdFrameCSS[".wikEdFrameBodySyntax"] = "height: auto; min-height: 100%; width: auto;"
            + " background-color: transparent; margin: 0; padding: 0; padding-left: 0.25em;"
            + " overflow: auto; font-family: Consolas; font-size: 0.95em;";
        wikEdFrameCSS[".wikEdFrameBodyNewbee"] = "height: auto; min-height: 100%; width: auto;"
            + " background-color: transparent; margin: 0; padding: 0; padding-left: 0.25em;"
            + " overflow: auto; font-family: Consolas; font-size: 0.95em;";
        wikEdDiffCSS[".wikEdDiffDiv"] += "background: #faf8f6; padding: 0.5em; border: 1px solid;"
            + " border-color: #808080; font-family: Calibri;";
    } else {
        styleSheet.insertRule("body { font-size: 9.5pt; }", styleSheet.cssRules.length);
        styleSheet.insertRule(".navpopup { font-size: 100% !important; }",
                styleSheet.cssRules.length);
        styleSheet.insertRule(".popupPreview { font-size: 110% !important; }",
                styleSheet.cssRules.length);
    }
    popupMaxWidth = 416;
}