User:Kxx/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
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) {
                styleSheet.insertRule("body { font-family: Corbel; }", styleSheet.cssRules.length);
                styleSheet.insertRule("tt, code, pre, textarea { font-family: Consolas !important; }",
                        styleSheet.cssRules.length);
            }
            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;
}

LocalComments = {
    dateDifference: true,
    dateFormat: "mdy",
    timeFirst: true,
    twentyFourHours: false
};


$(function() {
    var noticeNodes = document.querySelectorAll("div#siteNotice");
    for (var i = 0; i < noticeNodes.length; ++i)
        noticeNodes[i].style.display = "none";
});