MCBBS Extender

MCBBS行为拓展/样式修复

当前为 2020-07-25 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MCBBS Extender
// @namespace    https://i.zapic.cc
// @version      release-1.6.3
// @description  MCBBS行为拓展/样式修复
// @author       Zapic
// @match        https://*.mcbbs.net/*
// @run-at       document-body
// ==/UserScript==

(() => {
    // jQuery检查
    if (typeof jQuery == "undefined") {
        console.error("This page does NOT contain JQuery,MCBBS Extender will not work.");
        return false;
    }
    //在手机页面主动禁用
    if (document.getElementsByTagName('meta').viewport) {
        console.log("MCBBS Extender not fully compatible with Moblie page,exit manually");
        return false;
    }

    // 基本信息初始化
    let version = "v1.6.3"
    let vercode = 111643
    let updatelist = [
        '1.移除 部分过时功能',
        '2.修复 非100%的缩放比例导致搜索栏错位的问题',
        '3.展开代码内所有CSS代码,方便阅读与除虫'
    ];
    let configableList = [
        {
            "id": "fixCodeBlock",
            "default": true,
            "type": "check",
            "name": "美化代码块样式",
            "desc": "修正代码块的一些样式,如滚动条."
        }, {
            "id": "queryMessage",
            "default": true,
            "type": "check",
            "name": "后台轮询消息",
            "desc": "在后台自动查询是否有新的消息并推送,需保证至少打开一个页面."
        }, {
            "id": "queryMessageInterval",
            "default": 60,
            "type": "num",
            "name": "后台轮询消息间隔",
            "desc": "两次轮询消息之间的间隔,单位秒.注意,过低的值可能会导致你被论坛屏蔽,超过200的值可能会导致消息反复推送."
        }, {
            "id": "rememberPage",
            "default": true,
            "type": "check",
            "name": "板块内翻页记忆",
            "desc": "点击板块内下一页按钮时记忆当前页."
        }, {
            "id": "animateGoToTopButton",
            "default": true,
            "name": "回到顶部按钮美化",
            "type": "check",
            "desc": "为右侧回到顶部按钮增加动画以及位置修正."
        }, {
            "id": "pinnedTopBar",
            "default": true,
            "name": "更好的固定顶栏",
            "type": "check",
            "desc": "优化固定顶栏的行为,如与编辑栏的兼容性,以及在极窄窗口下的显示."
        }, {
            "id": "fixTopBarPopMenu",
            "default": true,
            "type": "check",
            "name": "弹出菜单美化",
            "desc": "美化弹出菜单的样式,如个人信息菜单."
        }, {
            "id": "hoverableMedal",
            "default": true,
            "name": "玻璃质感勋章",
            "type": "check",
            "desc": "亮闪闪的勋章~"
        }, {
            "id": "viewWarns",
            "default": true,
            "name": "查看警告记录",
            "type": "check",
            "desc": "为每一层楼和每一个个人主页(除自己)添加查看警告记录按钮"
        }, {
            "id": "removeLinkWarn",
            "default": true,
            "name": "移除外链警告",
            "type": "check",
            "desc": "去除论坛跳转外链时的警告页面."
        }, {
            "id": "useIgInQuickReply",
            "default": true,
            "name": "快速回复使用个人签名",
            "type": "check",
            "desc": "在页脚快速回复帖子时使用个人签名."
        }, {
            "id": "fixImgZoom",
            "default": true,
            "name": "优化图片缩放",
            "type": "check",
            "desc": "使用更现代的方法实现图片缩放."
        }, {
            "id": "disableAutoplay",
            "default": false,
            "name": "禁止BGM自动播放",
            "type": "check",
            "desc": "阻止页内BGM自动播放."
        }, {
            "id": "remenberEditMode",
            "default": true,
            "name": "记忆编辑器模式",
            "type": "check",
            "desc": "记忆高级编辑器是纯文本模式还是即时模式."
        }, {
            "id": "highlightThreads",
            "default": true,
            "name": "帖子列表高亮",
            "type": "check",
            "desc": "列表高亮显示帖子类型."
        }, {
            "id": "fixAnchor",
            "default": false,
            "name": "帖内锚点修复",
            "type": "check",
            "desc": "防止帖内锚点被意外的赋予样式."
        }, {
            "id": "maxMedalLine",
            "default": -1,
            "type": "num",
            "name": "最大勋章行数",
            "desc": "限制楼层勋章的最大行数,提升鼠标滚轮寿命,设置为-1以禁用此功能."
        }, {
            "id": "quickAtList",
            "default": "",
            "name": "快速 @ 列表",
            "type": "text",
            "desc": "按下Ctrl+Shift+A/或者按钮以快速在当前输入框内插入预定义的@用户名代码.用户名之间用\",\"(半角逗号)分隔."
        }, {
            "id": "miscFix",
            "default": "",
            "name": "杂项修复",
            "type": "text",
            "desc": "此值用于规定杂项修复的行为,默认值为空,修改为00000000000以关闭全部.错误的值会使该项失效.详情请查阅源码."
        }, {
            "id": "myReportReason",
            "default": "",
            "name": "自定义举报理由",
            "type": "textarea",
            "desc": "在举报时提供自定义的举报理由,一行一个理由."
        }, {
            "id": "myCSS",
            "default": "",
            "name": "自定义CSS",
            "type": "textarea",
            "desc": "在框内的CSS会被加载到页面内,可自由发挥."
        }, {
            "id": "myLinks",
            "default": "",
            "name": "自定义工具菜单链接",
            "type": "textarea",
            "desc": "在右上角\"工具\"菜单里添加自定义的链接,以\"[名称] [链接]\"的格式添加(如\"个人主页 home.php\"),一行一个."
        }];
    //夹带私货
    console.log(" %c Zapic's Homepage %c https://i.zapic.cc ", "color: #ffffff; background: #E91E63; padding:5px;", "background: #000; padding:5px; color:#ffffff");
    //初始化jQuery和基本封装方法
    let $ = jQuery;
    let dlg = (m) => {
        console.debug("[MCBBS Extender]" + m);
    };
    let getRequest = (variable, url = "") => {
        let query = url ? /\?(.*)/.exec(url)[1] : window.location.search.substring(1);
        let vars = query.split("&");
        for (let i = 0; i < vars.length; i++) {
            let pair = vars[i].split("=");
            if (pair[0] == variable) {
                return pair[1];
            }
        }
        return (false);
    }
    //内建静态资源
    let staticRes = {
        "at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8xUvXUeO9nvlTFvY233QyUFokYgq5/5Cy6H8upbib8vzZpJJJFFnGZrOBLLO7dYfln11UiRCibnPDpiVP7d3ARNc07rlkHapwY6SNoXcsMzNTikaj5r2XPMRz/97KMwfreOL9B/rFVEyazn2XbuhbtdIwjLWD9pmVJUWjUdMlTgcg0H0AdB0GgA10H0BVVet/98q+eoLdfgDK82ejaRpOp3NJ3zYZymmI5Nfqf0gRrKqqpEUi5qKyhSyqqKE1dJT2jnYynCrTiiaS0nVskhixPpyaP7VHTXT7CcU0XIZhKnY75fmzafzqHYLdfv7a9BpXTJtvNrb72NC4vB9owyZIpvV+fWY7sgnHwiMTwQPvR2lsGKk4LpdLEkIsB24B6k5QMDIcJb/45SsIdvu50buaRRU1pJJJmjpa+O0bV5+0zdLydf0A1s64h1BnO71U3HTFMwghLK04ouVWVVVSVVUapTokl8slnbj8rTMMw2MYxtrhgAKIJhLMG9+TeJ45WEeoqxOACSKbpeXrsNsLrFi7vYC187Yy58wfsOPnzda3YNK1A4SS3JuRTcCUTsUNWtM007AJrt26kGQySMFp43jssq0kk0mCwQBji4rYd7wFNSVTkj+W7u5udoU+tLLucExwiqy7M8z9Mzb1nBt/OzV/Wchn3UEKCgr5Yl8z0f1BtEAbO3bsQJZHftGXTtWbR2dnp9nR0cHurs94uP5upJwo5nGV6qo5XJJTw0xvJal43MqYsixjGyCyNzdsss7YY1c///0ABuDz+UyALklnxfu3kDga7ucfP6UId6Tn19CR1U7r3kOWb/ncuwjFjvUF9qVhGJ7vlDz+11ZcXCzF4zGUWIoXr3yFm2bciWOMy/K37j3Ebn8ju/2NFijHGBfVVXOYPn4mA16wzvzOjzn/D/N6J0s+n8/8x463qCg+m6uufJlwIsoXR320hH39YktdpZxbXMrhYBAjoQ98cvvSOCGAexSNEKcaGx6PR/J4PH1VD2NPzwemDxYP8CiHWDLwPbHX/jMAGqSFNYPSpmAAAAAASUVORK5CYII=",
        "medalReflectImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAA3CAYAAACGnvPUAAAAAXNSR0IArs4c6QAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA1UlEQVRYw+3Qy6rBARRGcQcjl1zCG5AkkY48gUiEMHU/7/8GS/vUHoqif1/ZgzX/tVLAn0qpwAQmMIH5NsxECWM1gYMKxsoBUxWM1wKOKhgrD8xUMF47yUvPMFYBmKtgvA5wUsFYRWChgrF+gC5wVsB4JWCpgvFLvU9dehfjlYGVCsYv9YGLAsarAGsVjJUGBsBVAeNVgY0Kxi8NX7mUBMarAVsVjF/6fXQpaYxXB3YqGCsDjICbAsZrAHsVjJUFxiqY/wITmMAEJjCBCUxgAhOYb8PcAbo5rkGPsZmjAAAAAElFTkSuQmCC"
    };
    //配置数据迁移函数
    let transferConfig = () => {
        let tempconf = null;
        try {
            tempconf = JSON.parse(getcookie("MExt_config"));
            if (typeof tempconf.version == "undefined") { return false; } else {
                localStorage.setItem("MExt_config", JSON.stringify(tempconf));
                setcookie("MExt_config", "", 0);
            }
        } catch (e) {
            return false;
        }
    }
    //配置初始化函数
    let initConfig = () => {
        $(configableList).each((i, v) => {
            conf[v.id] = typeof conf[v.id] == "undefined" ? v.default : conf[v.id];
        });
        localStorage.setItem("MExt_config", JSON.stringify(conf));
    }
    let conf = '';
    try {
        transferConfig();
        conf = JSON.parse(localStorage.getItem("MExt_config"));
    } catch (e) {
        dlg("Failed to load config\n" + e);
    }
    if (!conf) {
        conf = {};
        conf.version = vercode;
        initConfig();
        showDialog("<b>欢迎使用MCBBS Extender</b>.<br>本脚本的设置按钮已经放进入了您的个人信息菜单里,如需调整设置请在个人信息菜单里查看.", "right", "欢迎", () => {
            showMenu('user_info');
            $("#MExt_config").css("background-color", "#E91E63").css("color", "#fff");
            setTimeout(() => {
                hideMenu('user_info_menu');
                $("#MExt_config").css("background-color", "").css("color", "");
            }, 3000);
        });
        dlg("Config init.");
    }
    if (typeof conf.version == "undefined" || conf.version < vercode) {
        let updateContent = '';
        $(updatelist).each((i, v) => {
            updateContent += "<br>" + v;
        });
        showDialog("<b>MCBBS Extender 已经更新至 " + version + "</b>" + updateContent, "right");
        conf.version = vercode;
        initConfig();
    }

    let appendStyle = (str) => {
        $("#MExt_StyleCore")[0].innerHTML += ("\n" + str);
    }

    $("head").append('<style id="MExt_StyleCore"></style>');
    $(() => {
        // 发送警告
        if (location.pathname == "/forum.php" && getRequest('mod') == "post" && getRequest('action') == "newthread" && getRequest('fid') == "246") {
            $("body").append($(`<div id="close_script_alert" style="max-width:430px;position: fixed; left: 20px; top: 80px; z-index: 9999; transform: matrix3d(1, 0, 0, 0.0001, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1.025) translateX(-120%); background: rgba(228, 0, 0, 0.81); color: white; padding: 15px; transition-duration: 0.3s; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.66) 2px 2px 5px 0px;"><h1 style="font-size: 3em;float: left;margin-right: 12px;font-weight: 500;margin-top: 6px;">警告</h1><span style="font-size: 1.7em;">您正在向反馈与投诉版发表新的帖子</span><br>如果您正在向论坛报告论坛内的Bug,请先关闭此脚本再进行一次复现,以确保Bug不是由MCBBS Extender造成的.</div>`));
            setTimeout(() => { $("#close_script_alert")[0].style.transform = "matrix3d(1, 0, 0, 0.0001, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1.025)"; }, 10);
            setTimeout(() => { $("#close_script_alert")[0].style.transform = "none"; }, 300);
            setTimeout(() => { $("#close_script_alert")[0].style.transform = "translateX(-120%)"; }, 10000);
        }
        // 设置界面初始化
        $("#user_info_menu .user_info_menu_btn").append("<li><a href='javascript: void(0);' id=\"MExt_config\">MCBBS Extender 设置</a></li>");
        dlg("Appended Config button");
        appendStyle(
`.conf_contain {
    max-height: 45vh;
    overflow-y: auto;
    padding-right: 5px;
    overflow-x: hidden;
    scrollbar-color: rgba(0, 0, 0, 0.17) #f7f7f7;
    scrollbar-width: thin;
}

.alert_info ::-webkit-scrollbar {
    background: #f7f7f7;
    height: 7px;
    width: 7px
}

.alert_info ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}

.alert_info ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.17);
}

.conf_item {
    line-height: 1.2;
    margin-bottom: 5px;
}

.conf_title {
    font-weight: 1000;
}

.conf_subtitle {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.5);
    padding-right: 40px;
    display: block;
}

.conf_check {
    float: right;
    margin-top: -25px;
}

.conf_input {
    float: right;
    width: 30px;
    margin-top: -27px;
}

.conf_longinput {
    width: 100%;
    margin-top: 5px;
}

.conf_textarea {
    width: calc(100% - 4px);
    margin-top: 5px;
    resize: vertical;
    min-height: 50px;
}`);
        dlg("Appended Config window style");
        $("#MExt_config").on("click", () => {
            let confwinContent = '<style>body{overflow:hidden}.altw{width:700px;max-width:95vh;}.alert_info {background-image: unset;padding-left: 20px;padding-right: 17px;}</style><div class="conf_contain">';
            $(configableList).each((i, v) => {
                let inputType = '';
                switch (v.type) {
                    case "check":
                        inputType = '<input class="conf_check" type="checkbox" id="in_' + v.id + '"></input>';
                        break;
                    case "num":
                        inputType = '<input type="number" class="conf_input" id="in_' + v.id + '"></input>';
                        break;
                    case "text":
                        inputType = '<input type="text" class="conf_longinput" id="in_' + v.id + '"></input>';
                        break;
                    case "textarea":
                        inputType = '<textarea class="conf_textarea" id="in_' + v.id + '"></textarea>';
                        break;
                    default:
                        inputType = '<input class="conf_check" type="checkbox" id="in_' + v.id + '"></input>';
                        break;
                }
                confwinContent += '<p class="conf_item"><span class="conf_title">' + v.name + '</span><br><span class="conf_subtitle">' + v.desc + '</span>' + inputType + '</p>';
            });
            confwinContent += '</div>';
            showDialog(
                confwinContent,
                "confirm",
                "MCBBS Extender 设置",
                () => {
                    $(configableList).each((i, v) => {
                        let val = '';
                        if (v.type == "num" || v.type == "text" || v.type == "textarea") {
                            val = $("#in_" + v.id).val();
                        } else {
                            val = $("#in_" + v.id).prop("checked");
                        }
                        conf[v.id] = val;
                    });
                    initConfig();
                    setTimeout(() => {
                        showDialog("设置已保存,刷新生效", "right");
                    });
                },
                true,
                () => { },
                "MCBBS Extender " + version + " - 世予可爱w"
            );
            $(configableList).each((i, v) => {
                if (v.type == "num" || v.type == "text" || v.type == "textarea") {
                    $("#in_" + v.id).val(conf[v.id]);
                } else {
                    $("#in_" + v.id).prop("checked", conf[v.id]);
                }
            });
            dlg("Config cookie loaded.");
        });
        dlg("Config button event attached.");
        // 钩住DiscuzAjax函数,使其触发全局事件
        let __ajaxpost = ajaxpost;
        ajaxpost = (formid, showid, waitid, showidclass, submitbtn, recall) => {
            let relfunc = () => {
                if (typeof recall == 'function') {
                    recall();
                } else {
                    eval(recall);
                }
                $(this).trigger('DiscuzAjaxPostFinished');
            }
            __ajaxpost(formid, showid, waitid, showidclass, submitbtn, relfunc);
        }
        let __ajaxget = ajaxget;
        ajaxget = (url, showid, waitid, loading, display, recall) => {
            let relfunc = () => {
                if (typeof recall == 'function') {
                    recall();
                } else {
                    eval(recall);
                }
                $(this).trigger('DiscuzAjaxGetFinished');
            }
            __ajaxget(url, showid, waitid, loading, display, relfunc);
        }
        dlg("Hooked into Discuz Ajax event");
    });
    if (conf.fixCodeBlock) {
        // 代码块美化样式
        appendStyle(
`pre:not([id]) code {
    background: #f7f7f7;
    display: block;
    font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif;
    font-size: 12px;
    line-height: 0.9em;
    padding: 10px;
    border: #ccc solid 1px;
    position: relative;
}

.pl .blockcode ol li:hover {
    background: none;
    color: #666
}

.pl .blockcode ol li {
    white-space: nowrap;
    list-style: none;
}

.pl pre em, .pl .blockcode em {
    font-size: 0;
}

.pl pre em::after, .pl .blockcode em::after {
    content: 'Copy';
    position: absolute;
    top: 3px;
    right: 7px;
    display: block;
    font-size: 14px;
    border: #369 dashed 1px;
    padding: 0 7px;
    border-radius: 3px;
    transition-duration: .1s;
    opacity: 0.3;
    color: #369;
    cursor: pointer;
    font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif;
}

.pl .blockcode,.pl pre:not([id]) {
    position: relative;
    padding: 0;
}

.pl pre em:active::after, .pl .blockcode em:active::after {
    background: #369;
    border: #369 solid 2px;
    color: white;
}

.pl .blockcode em:hover::after, .pl pre em:hover::after {
    opacity: 1;
}

.pl .blockcode div[id], pre:not([id]) code {
    max-height: 500px;
    overflow: auto;
    padding: 10px 30px 5px 0;
    background: #F7F7F7 url(https://www.mcbbs.net/template/mcbbs/image/codebg.gif) repeat-y 0 0;
}

.pl .blockcode div[id]::-webkit-scrollbar, pre:not([id]) code::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.pl .blockcode div[id]::-webkit-scrollbar-thumb, pre:not([id]) code::-webkit-scrollbar-thumb {
    background: #00000040
}

.line-counter {
    position: sticky;
    float: left;
    left: 0;
    line-height: 1.7em;
    padding-top: 3px;
    user-select: none;
    margin-top: -10px;
    margin-right: 10px;
    top: 0px;
    border-right: #d6d6d6 solid 1px;
    width: 26px;
    background: #ededed;
    font-size: 12px;
    font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif;
    padding-left: 16px;
}

.pl .blockcode ol {
    margin: 0!important;
}

.blockcode .line-counter {
    margin-top: -7px;
    line-height: 1.8em;
}`);
        let LnBuilder = (ln) => {
            let str = "";
            for (let i = 1; i <= ln; i++) {
                str += (i < 10 ? "0" + i.toString() : i.toString()) + ".\n";
            }
            return str;
        };
        // 为Markdown代码块添加行数显示与复制按钮
        $(() => {
            setTimeout(() => {
                $(".pl pre:not([id]) code").each((i, v) => {
                    let ln = v.innerHTML.split("\n").length;
                    let lnC = LnBuilder(ln);
                    let counter = document.createElement("div");
                    counter.className = "line-counter";
                    counter.innerText = lnC;
                    let copy = document.createElement("em");
                    copy.className = "code-copy";
                    copy.addEventListener("click", (e) => {
                        let n = e.currentTarget.previousSibling.cloneNode(true);
                        copycode(n);
                    });
                    v.prepend(counter);
                    v.parentElement.append(copy);
                });
                $(".pl div.blockcode").each((i, v) => {
                    let ln = v.firstElementChild.firstElementChild.childElementCount;
                    let lnC = LnBuilder(ln);
                    let counter = document.createElement("div");
                    counter.className = "line-counter";
                    counter.innerText = lnC;
                    v.firstElementChild.prepend(counter);
                });
                copycode = (t)=>{
                    t = t.cloneNode(true);
                    t.firstElementChild.remove();
                    setCopy(t.innerText.replace(/\n\n/g, "\n"),"代码已复制到剪贴板");
                };
            }, 10);

        });
        dlg("Code block fix style appended.");
    }
    // 消息轮询
    if (conf.queryMessage) {
        // 检查消息函数
        let checkNotifica = (noNotifica = false) => {
            if (localStorage.getItem("MExt_ActiveQueryId") != queryId) {
                return false;
            }
            dlg("Checking message...");
            $.get("/forum.php?mod=misc", (d) => {
                // 设置最后通知时间为当前时间,以防止反复推送
                localStorage.setItem('notifica-time', new Date().getTime());
                let dom = $(d);
                // 获得顶栏图标类
                let noticlass = dom.find("#myprompt").attr("class");
                // 获得通知菜单元素
                let notimenu = dom.filter("#myprompt_menu");
                // 将顶栏图标类写入当前页
                $("#myprompt").attr("class", noticlass);
                // 将通知菜单写入当前页
                $("#myprompt_menu").html(notimenu.html());
                // 获得消息内容,用作缓存
                let noticontent = notimenu.html();
                // 判断是否应该发送消息
                if (!noNotifica && localStorage.getItem("MExt_LastNoticeContent") != noticontent) {
                    // 获得通知脚本(暴力)
                    let scp = dom.filter("script[src*=html5notification]").nextUntil("div").last().text();
                    // 将最后通知时间设置为1,强行启用通知
                    localStorage.setItem('notifica-time', 1);
                    // 执行通知脚本
                    eval(scp);
                    dlg("Notifica sent");
                    // 写入消息缓存
                    localStorage.setItem("MExt_LastNoticeContent", noticontent);
                    localStorage.setItem("MExt_LastNoticeCount", noticlass);
                }
            });
        }
        // 刷新消息缓存
        let flushContent = () => {
            $.get("/forum.php?mod=misc", (d) => {
                let dom = $(d);
                let noticontent = dom.filter("#myprompt_menu").html();
                let noticlass = dom.find("#myprompt").attr("class");
                // 写入消息缓存
                localStorage.setItem("MExt_LastNoticeContent", noticontent);
                localStorage.setItem("MExt_LastNoticeCount", noticlass);
            });
        }
        // 生成queryID,用于页面间的互斥
        let queryId = hash(new Date().getTime().toLocaleString(), 16);
        // 判断是否在消息页面||最后通知时间是否超过200秒
        if ((location.pathname == "/home.php" && (getRequest('do') == "pm" || getRequest('do') == "notice")) || new Date().getTime() - localStorage.getItem("notifica-time") > 200000) {
            flushContent();
        } else {
            checkNotifica();
        }
        dlg("Query id is " + queryId + ".");
        // 运行定时器,用于检查其他页面是否在运行
        setInterval(() => {
            if (localStorage.getItem("MExt_LastQuery") == "") {
                localStorage.setItem("MExt_LastQuery", 0);
            }
            let nowtime = Math.floor(new Date().getTime() / 1000);
            if ((localStorage.getItem("MExt_ActiveQueryId") == "" || nowtime - localStorage.getItem("MExt_LastQuery") > 5) && localStorage.getItem("MExt_ActiveQueryId") != queryId) {
                localStorage.setItem("MExt_ActiveQueryId", queryId);
                checkNotifica();
                dlg("Kick off inactive querier,start query.");
            }
            if (localStorage.getItem("MExt_ActiveQueryId") == queryId) {
                localStorage.setItem("MExt_LastQuery", nowtime);
            }
        }, 1000);
        dlg("Running checker actived.");
        // 判断是否有HTML5Notification
        if (!window.Html5notification) {
            $.getScript("data/cache/html5notification.js?xm6");
            dlg("Html5notification added.");
        }
        //
        $(window).on("focus", () => {
            dlg("Get content from cache");
            $("#myprompt_menu").html(localStorage.getItem("MExt_LastNoticeContent"));
            $("#myprompt").attr("class", localStorage.getItem("MExt_LastNoticeCount"));
        });
        // 定时运行检查函数
        let msgChecker = setInterval(checkNotifica, conf.queryMessageInterval * 1000);
        dlg("Message querier actived.");
    }
    if (conf.rememberPage) {
        // 记住当前页
        $(() => {
            let npbtn = $("#autopbn");
            if (npbtn.length) {
                // 绑定事件
                let orgfunc = npbtn[0].onclick;
                npbtn[0].onclick = null;
                npbtn.on("click", () => {
                    if (npbtn.html() == "正在加载, 请稍后...") { return false; }
                    let nextpageurl = npbtn.attr('rel');
                    let curpage = parseInt(npbtn.attr('curpage'));
                    npbtn.attr('curpage', curpage + 1);
                    nextpageurl = nextpageurl.replace(/&page=\d+/, '&page=' + (curpage + 1));
                    $("#threadlisttableid").append("<a class=\"mext_rempage\" rel=\"" + nextpageurl + "\"></a>")
                    //history.replaceState(null, null, nextpageurl);
                    orgfunc();
                });
                $("#separatorline").after("<a class=\"mext_rempage\" rel=\"" + window.location + "\"></a>");
                let timer = -1;
                $(window).on("scroll", () => {
                    clearTimeout(timer);
                    timer = setTimeout(() => {
                        let scroll = document.scrollingElement.scrollTop - window.innerHeight / 2;
                        let url = null;
                        document.querySelectorAll(".mext_rempage").forEach((v, i) => {
                            let vtop = v.offsetTop;
                            if (vtop < scroll || i == 0) {
                                url = v.rel;
                            }
                        });
                        if (url) {
                            history.replaceState(null, null, url);
                        }
                    }, 250);
                });
            }
            dlg("Page remember actived.");
        });
    }
    if (conf.animateGoToTopButton) {
        // 添加侧边按钮样式
        appendStyle(
`#scrolltop {
    bottom: 270px!important;
    visibility: visible;
    overflow-x: hidden;
    width: 75px;
}

.scrolltopa {
    transition-duration: .15s;
    margin-left: -40px;
    opacity: 0;
}

.scrolltopashow {
    margin-left: 0px;
    opacity: 1;
}`);
        dlg("Animate go to top buttom style appended.");
        // 重写showTopLink函数,使其使用侧边栏样式
        showTopLink = () => {
            let ft = $('#ft')[0];
            if (ft) {
                let scrolltop = $('#scrolltop')[0];
                if (!scrolltop) {
                    return false;
                }
                let scrolltopbtn = $(".scrolltopa");
                let scrollHeight = parseInt(document.body.getBoundingClientRect().top);
                let basew = parseInt(ft.clientWidth);
                let sw = scrolltop.clientWidth;
                if (basew < 1000) {
                    let left = parseInt(fetchOffset(ft)['left']);
                    left = left < sw ? left * 2 - sw : left;
                    scrolltop.style.left = (basew + left + 44) + 'px';
                } else {
                    scrolltop.style.left = 'auto';
                    scrolltop.style.right = 0;
                }
                if (scrollHeight < -100) {
                    scrolltopbtn.addClass("scrolltopashow");
                } else {
                    scrolltopbtn.removeClass("scrolltopashow");
                }
            }
        }
        showTopLink();
        dlg("Animate go to top buttom actived.");
    }
    if (conf.pinnedTopBar) {
        // 添加固定顶栏样式
        appendStyle(
 `#toptb {
    position: fixed;
    width: 100%;
    z-index: 790;
    top: 0;
    box-shadow: rgba(0, 0, 0, 0.3) 3px 3px 5px 1px;
    min-width: 510px;
}

.new_wp {
    max-width: 1130px;
    width: 100%;
}

.mc_map_wp {
    padding-top: 45px;
}

.mw {
    padding-top: 60px
}

#user_info_menu, #myprompt_menu, #usertools_menu, #sslct_menu, #scbar_type_menu {
    position: fixed!important;
    top: 47px!important
}

#scbar_type_menu {
    top: 38px!important;
}

#e_controls {
    z-index: 790!important
}

@media screen and (max-width: 860px) {
    #toptb .z.light {
        display: none;
    }
    #toptb>.new_wp>.y {
        float: none;
        margin-left: 12px;
    }
}`);
        $(() => {
            // 重写editorcontrolpos函数,与固定顶栏兼容
            editorcontrolpos = () => {
                if (editorisfull) {
                    return;
                }
                let scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
                if (scrollTop + 47 > editorcontroltop && editorcurrentheight > editorminheight) {
                    $("#" + editorid + '_controls').prop("style", "z-index:0!important").css("position", 'fixed').css("top", '47px').css("width", editorcontrolwidth + 'px');
                    $("#" + editorid + '_controls_mask').css("display", '');
                } else {
                    $("#" + editorid + '_controls').css("position", '').css('top', '').css('width', '');
                    $("#" + editorid + '_controls_mask').css('display', 'none');
                }
            };
            //增加一个5px的遮罩,防止鼠标经过空隙时碰到底层内容
            $("#toptb").after('<div style="position: fixed;top: 47px;height: 5px;width: 100%;z-index:700;"></div>');
        });
        dlg("Pinned top bar style appended.");
    } else {
        $("head").append(`<style id="noFixedTopBar">.mc_map_wp {padding-top: 0px!important;}#toptb {position: relative;box-shadow: none;z-index:unset!important;}</style>`);
        dlg("Restored topbar.");
    }
    if (conf.fixTopBarPopMenu) {
        // 添加弹出菜单美化样式
        appendStyle(
`.p_pop:not(.blk) a {
    border-radius: 5px;
    border-bottom: none;
}

div#user_info_menu {
    margin-top: 5px;
}

.user_info_menu_info>li {
    margin-top: 2px;
}

a.rank {
    padding: 2px 7px!important;
    border-radius: 14px;
}

a.rank:hover {
    text-decoration: none;
}

ul.user_info_menu_btn {
    padding-top: 6px;
}

ul.user_info_menu_btn>li>a:hover {
    background:

}

ul.user_info_menu_btn>li>a {
    padding: 5px 8px;
    border-radius: 5px;
}

ul.user_info_menu_btn>li>a[onclick]:hover {
    background: red!important;
}

#myprompt_menu {
    margin-left: -10px;
}

#myprompt_menu, #usertools_menu, #sslct_menu {
    z-index: 791!important;
    margin-top: 5px!important;
    transform: translateX(-50%);
    margin-left: 20px;
}

.p_pop:not(.h_pop) {
    border: 1px solid #d1d1d1;
    min-width: unset;
    border-radius: 5px;
}

#myprompt_menu>li>a, #usertools_menu>li>a, #scbar_type_menu>li>a {
    border: none;
    border-radius: 5px;
    text-align: center;
    padding: 3px 15px;
}

#myprompt_menu>li>a:hover, #scbar_type_menu>li>a:hover, #usertools_menu>li>a:hover {
    background: #36b030;
    color: white;
}

div#sslct_menu {
    margin-left: 54px;
    padding-left: 14px;
}

.sslct_btn {
    border: none!important;
    width: 15px;
    height: 15px;
    padding: 2px;
}

.sslct_btn i {
    border-radius: 50%;
    width: 13px;
    height: 13px;
}

#scbar_type_menu {
    background: url(https://www.mcbbs.net/template/mcbbs/image/bg-wool-white.png);
}

a#scbar_type:after {
    content: "▼";
    margin-left: 10px;
}

#scbar_type_menu>li>a {
    padding: 3px 5px;
    line-height: 20px;
    height: 20px;
}

.scbar_type_td {
    background: url(https://www.mcbbs.net/template/mcbbs/image/scbar_txt.png) -95px center no-repeat
}

.y_search {
    width: 249px;
    border-radius: 3px;
    overflow: hidden;
}
.y_search_inp {
    float: unset;
}

#scbar_txt {
    width: 130px;
    background-color: transparent;
}
body.winter{
    --MExtBtnClr: #5c8dff!important;
}
body.nether{
    --MExtBtnClr: #a42e0b!important;
}
body{
    --MExtBtnClr: #36b030!important;
}
.user_info_menu_info li a.rank, ul.user_info_menu_btn>li>a:hover, .p_pop:not(.blk) a:hover,#myprompt_menu>li>a:hover, #scbar_type_menu>li>a:hover, #usertools_menu>li>a:hover, .p_pop:not(.blk) a:hover {
    background: var(--MExtBtnClr);
    color: white;
}`);
        dlg("Pop menu fix style appended.");
        // 重写extstyle函数,使更换主题时同步更新样式
        let __extstyle = extstyle;
        let checkStyle = (style = null) => {
            let theme = style == null ? getcookie('extstyle') : style;
            if (theme == "./template/mcbbs/style/winter") {
                $("body").removeClass("nether").addClass("winter");
            } else if (theme == "./template/mcbbs/style/default") {
                $("body").removeClass("winter nether");
            } else {
                $("body").addClass("nether").removeClass("winter");
            }
        }
        extstyle = (style) => {
            __extstyle(style);
            checkStyle(style);
        }
        checkStyle();
        dlg("Overwrite extstyle function");
    }
    if (conf.hoverableMedal) {
        // 重写勋章结构函数
        let rewriteMedal = () => {
            // 遍历所有未重写楼层
            $('.md_ctrl:not([glassmedal])').attr("glassmedal", "true").each((t, v) => {
                // 遍历楼层所有勋章
                $(v).children(0).children('img').each((b, n) => {
                    // 获得勋章ID
                    let id = 'md' + /\_\d*$/.exec(n.id)[0];
                    // 重写勋章结构
                    $(v).append(
                        $('<span class="hoverable-medal" id="' + n.id + '" style="background-image:url(' + n.src + ')"></span>').on('mouseover', () => {
                            showMenu({
                                'ctrlid': n.id,
                                'menuid': id + '_menu',
                                'pos': '12!'
                            });
                        })
                    );
                    // 重写提示样式
                    $("#" + id + "_menu .tip_horn").css("background-image", "url(" + n.src + ")");
                    // 移除旧的勋章
                    n.remove();
                });
            });
            dlg("Hoverable medal rewrote.");
        };
        //调用重写勋章函数
        $(rewriteMedal);
        // 在Ajax时重新调用Ajax函数,保存勋章样式
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", rewriteMedal);
        // 添加勋章样式
        appendStyle(
`
.hoverable-medal:hover:after {
    margin-top: 0px!important;
    opacity: 1!important;
}

.hoverable-medal:after {
    display: block;
    content: '';
    margin-top: -15px;
    opacity: 0.6;
    transition-duration: .4s;
    background-image: url(` + staticRes.medalReflectImage + `);
    width: 100%;
    height: 100%;
    filter: blur(2px);
}

div.tip.tip_4[id*=md_] {
    width: 105px;
    height: 165px;
    border: none;
    box-shadow: black 0px 2px 10px -3px;
    margin-left: 38px;
    margin-top: 115px;
    background: black;
    overflow: hidden;
    pointer-events: none!important;
    border-radius: 5px;
    padding: 0px;
}

div.tip.tip_4[id*=md_] .tip_horn {
    background-size: cover;
    background-position: center;
    height: 200%;
    width: 200%;
    z-index: -1;
    filter: blur(7px) brightness(0.8);
    top: -50%;
    left: -50%;
}

div.tip.tip_4[id*=md_] .tip_c {
    color: rgba(255, 255, 255, 0.98);
}

div.tip.tip_4[id*=md_] h4 {
    text-align: center;
    padding: 10px 5px;
    background-color: rgba(255, 255, 255, 0.3);
}

div.tip.tip_4[id*=md_] p {
    padding: 0px 10px;
    position: absolute;
    top: calc(50% + 38px);
    transform: translateY(calc(-50% - 26px));
}

.md_ctrl {
    margin-left: 17px!important;
    padding-bottom: 15px;
}

.hoverable-medal {
    width: 31px;
    height: 53px;
    transition-duration: 0.4s;
    border-radius: 3px;
    display: inline-block;
    margin: 5px;
    background-position: center;
    box-shadow: 0px 2px 5px 0px black;
    overflow: hidden;
}

.hoverable-medal:hover {
    transform: matrix3d(1, 0, 0, 0, 0, 1, 0, -0.003, 0, 0, 1, 0, 0, -1.5, 0, 0.9);
    box-shadow: 0px 2px 10px -3px black;
}

.pg_medal .mgcl img {
    margin-top: 12px!important
}

.mg_img {
    box-shadow: inset 0 0 10px 4px rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}`);
        dlg("Hoverable medal style appended.");
    }
    if (conf.quickAtList) {
        appendStyle(
`#fastpostatList.in_editorbtn, #postatList {
    background-size: 54px;
    background-position: -23px 3px;
}

#fastpostatList, #postatList {
    background-image: url(` + staticRes.atBtnImage + `);
    background-size: 50px;
    background-position: -6px 2px;
}`);
        // 获得At代码函数
        let getAtCode = () => {
            // 分隔list
            let quickAtList = conf.quickAtList.split(",");
            let atstr = "";
            //拼接@代码
            $(quickAtList).each((i, v) => {
                atstr += "@" + v + " ";
            });
            return atstr;
        }
        // 将函数暴露到全局
        MExt_Func_getAtCode = getAtCode;
        // 监听按键事件
        $(document).on("keydown", (e) => {
            if (e.shiftKey && e.ctrlKey && e.keyCode == 65) {
                // 判断是否在输入框内
                if (($(document.activeElement).prop("nodeName") == "INPUT" && $(document.activeElement).prop("type") == "text")) {
                    // 拼接方法插入
                    $(document.activeElement).val($(document.activeElement).val() + getAtCode());
                    dlg("@ string added");
                } else if ($(document.activeElement).prop("nodeName") == "TEXTAREA") {
                    // discuz内建函数插入
                    seditor_insertunit('fastpost', getAtCode(), '');
                    dlg("@ string added");
                }
            }
        });
        // 高级编辑模式插入@代码
        $(() => {
            if ($("#e_iframe").length) {
                // 由于高级模式的输入框是iFrame,无法直接监听,故再次监听高级输入框的按键事件
                $($("#e_iframe")[0].contentWindow).on("keydown", (e) => {
                    if (e.shiftKey && e.ctrlKey && e.keyCode == 65) {
                        // 判断是否在输入框内
                        if ($(document.activeElement).prop("nodeName") == "IFRAME") {
                            //discuz内建函数插入
                            insertText(getAtCode());
                            dlg("@ string added");
                        }
                    }
                });
            }
        });
        let hookReplyBtn = () => {
            if ($("#postatList").length > 0) { return false; }
            $("#postat.fat").after('<a id="postatList" href="javascript:;" title="快速@" onclick="seditor_insertunit(\'post\',MExt_Func_getAtCode(), \'\');">快速@</a> ');
            dlg("Reply bottons appends.");
        }
        $("#append_parent").on('DOMNodeInserted', hookReplyBtn);
        $(() => {
            $("#fastpostat").after('<a id="fastpostatList" href="javascript:;" title="快速@" class="" onclick="seditor_insertunit(\'fastpost\',MExt_Func_getAtCode(), \'\');">快速@</a> ');
            $("#e_adv_s1").append('<a id="fastpostatList" href="javascript:;" title="快速@" class="in_editorbtn" onclick="insertText(MExt_Func_getAtCode());">快速@</a>');
        });

    }
    if (conf.viewWarns) {
        // 添加查看警告样式
        appendStyle(
`.view_warns_inposts {
    background: url(template/mcbbs/image/warning.gif) no-repeat 0px 2px;
    background-size: 16px;
    width: 90px!important;
}

.view_warns_home a {
    background: url(template/mcbbs/image/warning.gif) no-repeat 1px 2px!important;
    background-size: 16px!important;
}`);
        // 添加查看警告按钮函数
        let addVWLink = () => {
            $(".plhin").each((i, v) => {
                let href = $(v).find(".authi .xw1").attr("href");
                if (!href) {
                    return false;
                }
                let uid = /uid=(\d*)/.exec(href)[1];
                $(v).find("ul.xl.xl2.o.cl:not([vw_added*=true])").attr("vw_added", "true").append($('<li class="view_warns_inposts"><a href="forum.php?mod=misc&action=viewwarning&tid=952104&uid=' + uid + '" title="查看警告记录" class="xi2" onclick="showWindow(\'viewwarning\', this.href)">查看警告记录</a></li>'));
            });
            dlg("In-posts view warns link added");
        }
        // 在DiscuzAjax时重新调用添加函数,防止失效
        $(this).on("DiscuzAjaxGetFinished", addVWLink).on("DiscuzAjaxPostFinished", addVWLink);
        dlg("adddVWLink Ajax Event attached.");
        $(() => {
            // 添加查看警告按钮
            addVWLink();
            // 用户信息界面添加查看警告按钮
            let href = $("#uhd .cl a").attr("href");
            if (!href) {
                return false;
            }
            let uid = /uid=(\d*)/.exec(href)[1];
            if (!uid) {
                return false;
            }
            $("#uhd .mn ul").append('<li class="view_warns_home"><a href="forum.php?mod=misc&action=viewwarning&tid=952104&uid=' + uid + '" title="查看警告记录" class="xi2" onclick="showWindow(\'viewwarning\', this.href)">查看警告记录</a></li>');
            dlg("Home page view warns link added.")
        });
    }
    // 自定义举报内容
    if (conf.myReportReason) {
        // 获得举报内容列表函数
        let getReasons = () => {
            // 分隔list
            let reportReason = conf.myReportReason.split("\n");
            let rrstr = "<p class=\"mtn mbn\">";
            //拼接HTML
            $(reportReason).each((i, v) => {
                rrstr += '<label><input type="radio" name="report_select" class="pr" onclick="$(\'report_other\').style.display=\'none\';$(\'report_msg\').style.display=\'none\';$(\'report_message\').value=\'' + v + '\'" value="' + v + '"> ' + v + '</label><br>';
            });
            rrstr += "</p>";
            return rrstr;
        }
        // 举报按钮钩子函数
        let hookReportBtn = () => {
            if ($("#report_reasons[appended]").length > 0) { return false; };
            let reportContent = getReasons();
            $("#report_reasons").attr("appended", "true").before(reportContent);
        }
        $("#append_parent").on('DOMNodeInserted', hookReportBtn);
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", hookReportBtn);
    }
    // 移除外链警告延时,直接跳转目标页
    if (conf.removeLinkWarn) {
        if (location.pathname == "/plugin.php" && getRequest('id') == "link_redirect") {
            let url = getRequest('target');
            if (url) {
                // 跳就完事了
                location.href = decodeURIComponent(url);
            }
        }
    }
    if (conf.useIgInQuickReply) {
        // 快速回复框使用个人签名
        let hookReplyBtn = () => {
            if ($("#fwin_reply #usesig").length > 0) { return false; }
            $("#fwin_reply #postsubmit").after('<label for="usesig" style="margin-left: 10px;float: left;margin-top: 3px;"><input type="checkbox" name="usesig" id="usesig" class="pc" value="1" checked="checked">使用个人签名</label>');
        }
        $("#append_parent").on('DOMNodeInserted', hookReplyBtn);
        $(() => {
            // 底部快速回复增加选项
            $("#fastpostsubmit").after('<label for="usesig" style="margin-left: 10px;"><input type="checkbox" name="usesig" id="usesig" class="pc" value="1" checked="checked">使用个人签名</label>');
        });
    }
    // 故意把这个功能搞玄乎,纯粹是好玩,其实还是非常简单的.
    // 这里包含一些对体验影响不大又非常杂的修复选项,不适合单独开一个选项,显得很臃肿.
    // 配置里的这一串数字代表每一个功能的开关情况,比如第一位数字为1时代表第一个功能开启,第二位为0时,代表第二个功能关闭.
    if (/^[01]*$/.exec(conf.miscFix)) {
        let fixconf = conf.miscFix.split("");
        let fixlist = [
            // 暗牧悬浮预览
            { "style": ".t_f font[style*=\"background-color:black\"], .t_f font[style*=\"background-color:#000\"] {transition-duration: .3s;transition-delay: .5s;cursor: default;}.t_f font[style*=\"background-color:black\"]:hover, .t_f font[style*=\"background-color:#000\"]:hover {transition-delay: 0s;background-color: transparent!important;}" },
            //增加空方法,用于修复论坛的一个报错.
            { "script": "announcement = () => {};relatekw = ()=>{};" },
            //修复页脚问题
            { "style": ".mc_map_wp{min-height:calc(100vh - 202px)!important;}" },
            //修复用户组页面不对齐的问题
            { "style": ".tdats .tb{margin-top:0px}" },
            // 修复编辑器@超级加倍的问题
            { "script": "$(()=>{if(typeof setEditorEvents != \"undefined\"){let __setEditorEvents = setEditorEvents;setEditorEvents= ()=>{ __setEditorEvents();setEditorEvents=()=>{};}}})" },
            // 允许改变个人签名编辑框大小
            { "style": "#sightmlmessage{resize:vertical;}" },
            // 按住shift点击带有超链接的图片则不打开链接
            { "script": `$(()=>{$("img.zoom").parent().each((i,v)=>{if(v.nodeName=="A"){$(v).on("click",(e)=>{console.log(e);if(e.shiftKey){e.preventDefault();}})}})})` },
            // 修复某些页面书框被撕裂的问题
            { "script": "$(()=>{if(!$('.mc_map_wp .mc_map_border_foot').length){$('.mc_map_border_foot').remove();$('.mc_map_wp').append('<div class=\"mc_map_border_foot\"></div>')}})" },
            // 默认使用高清头像
            { "script": "$(()=>{$('.avt img, .avtm img, .special_photo img').each((i,v)=>{v.src=v.src.replace('middle','big').replace('small','big')});})" },
            // 主动聚焦编辑器iframe,修复报错问题.
            { "script": "$(()=>{if(typeof wysiwyg !='undefined' && wysiwyg){editwin.document.body.focus()};})" },
            // 小提示样式修复
            { "style": ".pc_inner{padding-left:12px}" }
        ];
        let styleContent = "";

        $(fixlist).each((i, v) => {
            if (typeof fixconf[i] == "undefined") { fixconf[i] = "1" }
            if (fixconf[i] === "1") {
                // 拼接样式字符串
                styleContent += fixlist[i].style ? fixlist[i].style : "";
                // 执行脚本
                eval(fixlist[i].script ? fixlist[i].script : "");
            }
        });
        // 添加修复样式
       appendStyle(styleContent)
    }
    if (conf.fixImgZoom) {
        dlg("Zoom style append");
        appendStyle(
`#img_scale {
    opacity: 0;
    position: absolute;
    right: 20px;
    bottom: 20px;
    background: #0006;
    transition-duration: .2s;
    color: white;
    padding: 10px;
    pointer-events: none;
    border-radius: 10px;
}

#imgzoom_zoom {
    height: auto;
    transition-duration: .2s
}

#imgzoom_zoomlayer {
    height: auto!important
}

#imgzoom {
    width: auto!important;
    height: auto!important
}`);
        dlg("FixImgZoom style appended.");
        let __zoom = zoom;
        let t = 0;
        // 初始化基本缩放信息对象
        let img = { width: 0, height: 0, top: 0, left: 0, radio: 1, scale: 1, orgwidth: 0 };
        // 缩放函数
        let resize = (width) => {
            dlg("Image resizing...")
            clearTimeout(t);
            // 显示缩放比例
            $("#img_scale").html(parseInt(img.scale * 100) + "%").css("opacity", 1);
            t = setTimeout(() => { $("#img_scale").css("opacity", 0) }, 2000);
            // 计算目标大小和位置
            let ow = img.width;
            img.width = width;
            ow = (ow - img.width) / -2;
            img.left -= ow;
            img.top -= ow * img.radio;
            // 修改
            $("#imgzoom_zoom").css("width", img.width + "px");
            $("#imgzoom").css("left", img.left + "px");
            $("#imgzoom").css("top", img.top + "px");
        }
        // 保存基本信息
        let initP = () => {
            dlg("Init Picture info");
            img.width = parseInt($("#imgzoom_zoom").attr("width"));
            img.height = parseInt($("#imgzoom_zoom").attr("height"));
            img.radio = img.height / img.width;
            img.top = parseInt($("#imgzoom").css("top"));
            img.left = parseInt($("#imgzoom").css("left"));
            img.scale = 1;
            img.orgwidth = img.width;
        }
        zoom = (obj, zimg, nocover, pn, showexif) => {
            // 伪装成IE,使原函数的DOMMouseScroll事件监听器以可以被卸除的形式添加
            BROWSER.ie = 6;
            __zoom(obj, zimg, nocover, pn, showexif);
            // 防止翻车,改回去
            setTimeout(() => { BROWSER.ie = 0; dlg("IE canceled.") }, 1000);
            // 等待窗口出现
            let wait = setInterval(() => {
                if ($("#imgzoom_zoom").length) {
                    dlg("Image found");
                    clearInterval(wait);
                    // 信息归零,准备下一次保存
                    img = { width: 0, height: 0, top: 0, left: 0, radio: 1, scale: 1, orgwidth: 0 };
                    // 显示遮罩
                    $("#imgzoom_cover").css("display", "unset");
                    // 判断是否已经监听事件,防止超级加倍
                    if ($("#imgzoom").attr("fixed") == "true") { return true; }
                    // 原始尺寸按钮事件
                    $("#imgzoom_adjust").on("click", () => {
                        dlg("return source size");
                        $("#imgzoom").css("transition-property", "opacity,top,left,transform");
                        img.width == 0 ? initP() : 0;
                        img.scale = 1;
                        resize($("#imgzoom_zoom").attr("width"));
                    });
                    // 屏蔽页面滚动
                    $("#imgzoom_cover").on("mousewheel DOMMouseScroll", (e) => {
                        if (e.ctrlKey || e.altKey || e.shiftKey) { return true; }
                        e.preventDefault();
                    });
                    // 卸除原函数监听器
                    $("#imgzoom")[0].onmousewheel = null;
                    // 增加显示缩放大小元素并监听事件
                    $("#imgzoom").append(`<span id="img_scale"></span>`).on("mousewheel DOMMouseScroll", (e) => {
                        // 判断是否按下功能键
                        if (e.ctrlKey || e.altKey || e.shiftKey) { dlg("Func key pressed."); return true; }
                        // 阻止滚动
                        e.preventDefault();
                        // 兼容火狐,正确判断滚轮方向
                        let scroll = e.originalEvent.wheelDelta ? e.originalEvent.wheelDelta : -e.originalEvent.detail;
                        // 忽略无效滚动
                        if (scroll == 0) { return true; }
                        // 判断是否需要初始化
                        img.width == 0 ? initP() : 0;
                        // 规定需要显示过渡动画的属性
                        $("#imgzoom").css("transition-property", "opacity,top,left,transform");
                        // 判断是否过小
                        if (scroll < 0 && ((img.width < 350 && img.radio < 1) || (img.width * img.radio < 350 && img.radio >= 1))) {
                            // 回弹动画
                            dlg("Reach min size");
                            $("#imgzoom").css("transform", "scale(0.8)");
                            setTimeout(() => { $("#imgzoom").css("transform", "scale(1)"); }, 200);
                            return true;
                        }
                        // 修改缩放比例
                        img.scale += scroll > 0 ? 0.1 : -0.1;
                        // 判断比例是否过小
                        if (img.scale < 0.1) {
                            img.scale = 0.1;
                            // 回弹动画
                            dlg("Reach min size");
                            $("#imgzoom").css("transform", "scale(0.8)");
                            setTimeout(() => { $("#imgzoom").css("transform", "scale(1)"); }, 200);
                            return true;
                        }
                        // 缩放
                        resize(img.orgwidth * Math.pow(img.scale, 2));
                    }).attr("fixed", "true");
                    // 按下鼠标事件
                    $("#imgzoom").on("mousedown", (e) => {
                        // 按下鼠标时移除修改位置的过渡动画,使窗口跟手
                        dlg("Animate removed");
                        $("#imgzoom").css("transition-property", "opacity");
                    });
                    // 释放鼠标事件
                    $("#imgzoom").on("mouseup", (e) => {
                        // 改回去
                        $("#imgzoom").css("transition-property", "opacity,top,left,transform");
                        // 保存移动后的窗口位置
                        img.top = parseInt($("#imgzoom").css("top"));
                        img.left = parseInt($("#imgzoom").css("left"));
                        dlg("Animate added,Pos saved");
                    });
                }
            }, 50);
        }
        dlg("Zoom function rewrote.");
    }
    if (conf.myCSS) {
        // 增加自定义的CSS
        dlg("DIY CSS Appended");
        $("head").append(`<style id="myCSS">` + conf.myCSS + `</style>`);
    }
    if (conf.disableAutoplay) {
        let clearAutoPlay = () => {
            dlg("Canceling autoplay");
            setTimeout(() => {
                $("iframe[id*=iframe_mp3]").each((i, v) => {
                    // 去掉自动播放属性
                    v.src = v.src.replace("&auto=1", "");
                });
            }, 1);
        };
        $(document).one("click touchend", clearAutoPlay);
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", () => { setTimeout(clearAutoPlay, 100); $(document).one("click touchend", clearAutoPlay); });
        $(clearAutoPlay);
    }
    if (conf.myLinks) {
        // 分割
        $(conf.myLinks.split("\n")).each((i, v) => {
            try {
                //判断是否合法
                if (!v.split(" ")[1] || !v.split(" ")[0]) { return true; }
                // 添加
                $(() => { $("#usertools_menu").append('<li><a href="' + v.split(" ")[1] + '">' + v.split(" ")[0] + '</a></li>') });
            } catch (ignore) { }
        });
        dlg("My Links added");
    }
    if (conf.maxMedalLine >= 0) {
        let restrict = () => {
            // 判断是否在个人主页
            if ($("#uhd").length > 0) { $("#restrictMedalLine").remove(); return; }
            // 限制勋章行数
            dlg("Restricting line...");
            $('.md_ctrl:not([restrictline])').attr("restrictline", "true").append($("<span class=\"toggle-all\">展开/收起勋章</span>").on("click", (e) => { $(e.target).parent().toggleClass("show-all") })).each((i, v) => {
                if ((v.childElementCount - 2 <= conf.maxMedalLine * 3 && conf.hoverableMedal) || (v.firstChild.childElementCount - 2 <= conf.maxMedalLine * 3 && !conf.hoverableMedal)) {
                    v.removeChild(v.lastChild);
                }
            });
        }
        let maxheight = conf.maxMedalLine * (conf.hoverableMedal ? 60 : 55) + 45;
        $(restrict);
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", restrict);
        appendStyle(
`.md_ctrl span.toggle-all {
    width: 125px;
    display: block;
    position: absolute;
    bottom: 0;
    text-align: center;
    left: 0;
    padding: 30px 0px 5px 0px;
    background-image: linear-gradient(0deg, #e3c99e, #e3c99e, transparent);
    color: #3e6c99;
    cursor: pointer;
    user-select: none;
}

.md_ctrl {
    position: relative;
    overflow-y: hidden;
    max-height: ` + maxheight.toString() + `px;
}

.md_ctrl.show-all {
    max-height: 3000px;
    padding-bottom: 40px;
}`)
        dlg("Appended Restrict Medal Line style");
    }
    if (conf.remenberEditMode) {
        if (localStorage.getItem("MExt_EditMode") === null) {
            localStorage.setItem("MExt_EditMode", "false");
        }
        $(() => {
            dlg("Remenber Editor Mode actived.");
            $("#e_switchercheck").on("click", (e) => {
                dlg("Editor mode switch.");
                localStorage.setItem("MExt_EditMode", e.currentTarget.checked.toString());
            });
            if (localStorage.getItem("MExt_EditMode") == "true") {
                dlg("Switch editor mode");
                $("#e_switchercheck").click();
            }
        });
    }
    if (conf.highlightThreads) {
        appendStyle(
`.tl .icn {
    background-image: linear-gradient(90deg, rgba(200, 200, 200, 0.3), transparent);
    border-left: 3px solid rgb(200, 200, 200);
}

.tl .icn.newReply {
    background-image: linear-gradient(90deg, rgba(255, 136, 0, 0.3), transparent);
    border-left: 3px solid rgb(255, 136, 0);
}

.tl .icn.newMember {
    background-image: linear-gradient(90deg, rgba(110, 232, 115, 0.3), transparent);
    border-left: 3px solid rgb(110, 232, 115);
}

.tl .icn.hotThread {
    background-image: linear-gradient(90deg, rgba(235, 132, 132, 0.3), transparent);
    border-left: 3px solid rgb(235, 132, 132);
}

.tl .icn.digest {
    background-image: linear-gradient(90deg, rgba(0, 203, 214, 0.3), transparent);
    border-left: 3px solid rgb(0, 203, 214);
}

.tl .icn.digest2 {
    background-image: linear-gradient(90deg, rgba( 0, 161, 204, 0.3), transparent);
    border-left: 3px solid rgb( 0, 161, 204);
}

.tl .icn.digest3 {
    background-image: linear-gradient(90deg, rgba(0, 123, 194, 0.3), transparent);
    border-left: 3px solid rgb(0, 123, 194);
}

.tl .icn.close {
    background-image: linear-gradient(90deg, rgba(187, 187, 187, 0.3), transparent);
    border-left: 3px solid rgb(187, 187, 187);
}

.tl .icn.forumSticker {
    background-image: linear-gradient(90deg, rgba(161, 215, 252, 0.3), transparent);
    border-left: 3px solid rgb(161, 215, 252);
}

.tl .icn.partSticker {
    background-image: linear-gradient(90deg, rgba(110, 171, 235, 0.3), transparent);
    border-left: 3px solid rgb(110, 171, 235);
}

.tl .icn.globalSticker {
    background-image: linear-gradient(90deg, rgba(33, 106, 207, 0.3), transparent);
    border-left: 3px solid rgb(33, 106, 207);
}

.tl .icn.poll {
    background-image: linear-gradient(90deg, rgba(250, 123, 147, 0.3), transparent);
    border-left: 3px solid rgb(250, 123, 147);
}

.tl .icn.debate {
    background-image: linear-gradient(90deg, rgba(0, 153, 204, 0.3), transparent);
    border-left: 3px solid rgb(0, 153, 204);
}`);
        let highlighting = () => {
            $('a[title*="有新回复"]').parent().addClass("newReply");
            $('img[alt="新人帖"]').parent().parent().children(".icn").addClass("newMember");
            $('img[alt="热帖"]').parent().parent().children(".icn").addClass("hotThread");
            //精华
            $('img[alt="digest"]').parent().parent().children(".icn").addClass("digest");
            $('img[title="精华 2"]').parent().parent().children(".icn").addClass("digest2");
            $('img[title="精华 3"]').parent().parent().children(".icn").addClass("digest3");
            $('a[title*="关闭的主题"]').parent().addClass("close");
            $('a[title*="本版置顶主题"]').parent().addClass("forumSticker");
            $('a[title*="分类置顶主题"]').parent().addClass("partSticker");
            $('a[title*="全局置顶主题"]').parent().addClass("globalSticker");
            $('a[title*="辩论"]').parent().addClass("debate");
            $('a[title*="投票"]').parent().addClass("poll");
            $('a[title*="悬赏"]').parent().addClass("newReply");
        };
        $(highlighting);
        let waiter = 0;
        $(() => {
            let nxBtn = $("#autopbn");
            nxBtn.on("click", () => {
                if (waiter == 0) {
                    waiter = setInterval(() => {
                        if (nxBtn.text() != "正在加载, 请稍后...") {
                            clearInterval(waiter);
                            waiter = 0;
                            highlighting();
                        }
                    }, 100);
                }
            });
        });
    }
    if (conf.fixAnchor) {
        appendStyle(
`table.plhin td.t_f span[id]:not([id^=anchor_]), .fastpreview span[id]:not([id^=anchor_]) {
    display: none;
}`);
        let fix = () => {
            $("table.plhin td.t_f span[id]:not([id^=anchor_]),.fastpreview span[id]:not([id^=anchor_])").each((i, v) => {
                $("a[href$=#" + v.id + "]").each((i, v) => {
                    v.href.replace("#" + v.id, "#anchor_" + v.id);
                });
                v.id = "anchor_" + v.id;
            });
        }
        $(fix);
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", fix);
    }
})();