MCBBS Extender

MCBBS行为拓展/样式修复

当前为 2020-03-11 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴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.2.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.2.3";
    let vercode = 111243;
    let updatelist = [
        '1.针对火狐浏览器提供优化',
        '2.优化 快速At功能,现在悬浮窗里也能用了'
    ];
    let configableList = [
        {
        "id": "fixCodeBlock",
        "default": true,
        "type": "check",
        "name": "美化代码块样式",
        "desc": "修正代码块的一些样式,如滚动条."
    }, {
        "id": "fixCodeCopy",
        "default": true,
        "type": "check",
        "name": "\"复制代码\"修复",
        "desc": "修复复制代码时换行全部消失的问题."
    }, {
        "id": "fixTableLayout",
        "default": true,
        "type": "check",
        "name": "修复表格样式",
        "desc": "使用快捷键Shift+F快速修复当前页面表格样式."
    }, {
        "id": "queryMessage",
        "default": true,
        "type": "check",
        "name": "后台轮询消息",
        "desc": "在后台自动查询是否有新的消息并推送,需保证至少打开一个页面.注意,过低的值可能会导致你被论坛屏蔽,超过200的值可能会导致消息反复推送."
    }, {
        "id": "queryMessageInterval",
        "default": 60,
        "type": "num",
        "name": "后台轮询消息间隔",
        "desc": "两次轮询消息之间的间隔,单位秒."
    }, {
        "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": "hoverPreviewTheme",
        "default": true,
        "name": "主题悬浮预览",
        "type": "check",
        "desc": "将鼠标指针放在切换主题按钮上即可预览主题."
    }, {
        "id": "hoverableMedal",
        "default": true,
        "name": "玻璃质感勋章",
        "type": "check",
        "desc": "亮闪闪的勋章~"
    }, {
        "id": "ljyysSearch",
        "default": true,
        "name": "ljyys搜索",
        "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": "quickAtList",
        "default": "",
        "name": "快速 @ 列表",
        "type": "text",
        "desc": "按下Ctrl+Shift+A/或者按钮以快速在当前输入框内插入预定义的@用户名代码.用户名之间用\",\"(半角逗号)分隔."
    }, {
        "id": "miscFix",
        "default": "",
        "name": "杂项修复",
        "type": "text",
        "desc": "此值用于规定杂项修复的行为,默认值为空,修改为00000以关闭全部.错误的值会使该项失效.详情请查阅源码."
    }, {
        "id": "myReportReason",
        "default": "",
        "name": "自定义举报理由",
        "type": "textarea",
        "desc": "在举报时提供自定义的举报理由,一行一个理由."
    }];

    //初始化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 = {
        "atBtnImage" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAZCAYAAAB6v90+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJ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2MYxtrhgAKIJhLMG9+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();
    }
    $(() => {
        // 设置界面初始化
        $("#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");
        $("head").append('<style id="ConfWindowStyle">.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;}</style>');
        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) {
        // 代码块美化样式
        $("head").append("<style id=\"fixCodeBlock\">.hljs > ::-webkit-scrollbar {background: #f7f7f7;height: 7px;width:7px}.hljs > ::-webkit-scrollbar-thumb:hover{background:rgba(0, 0, 0, 0.35);}.hljs > ::-webkit-scrollbar-thumb{background:rgba(0, 0, 0, 0.17);}.pl .blockcode{max-height:483px;overflow:auto;padding: 10px 0 5px 10px;background-attachment: local}.blockcode ol{overflow-x: unset!important;}.hljs{display:unset;scrollbar-color: rgba(0,0,0,0.17) #f7f7f7;scrollbar-width: thin;}.pl .blockcode ol{margin: 0 0 0px -10px!important;padding: 0 0 0px 20px !important;}.pl .blockcode ol li:hover {background-color:rgba(0, 0, 0, 0.05) ;color: #666;}.pl .blockcode ol li {margin-left: 23px;min-width: fit-content;padding-right: 10px;transition-duration:.2s;}.pl .blockcode em {display: block;margin-top: 5px;}</style>");
        dlg("Code block fix style appended.");
    }
    if (conf.fixTableLayout) {
        MExt_Func_fixTable = () => {
            // 添加修复样式
            $("head").append("<style id=\"fixTableLayout\">.t_table .hljs ol {width:0}.t_table .hljs li {background:rgba(0, 0, 0, 0)!important}.t_table img{max-width:100%;object-fit:contain}</style>");
            dlg("Table style fixed.");
        }
        // 监听快捷键事件
        $(document).on("keydown", (e) => {
            if (e.shiftKey && e.ctrlKey &&e.keyCode == 70 && $("#fixTableLayout").length == 0) {
                dlg("Table layout fix actived");
                showDialog("是否尝试修复此页表格?", "confirm", "MCBBS Extender", () => {
                    MExt_Func_fixTable();
                })
            }
        });
        dlg("Table layout fix event attached.");
    }
    if (conf.fixCodeCopy) {
        // 重写copycode函数,手动添加换行
        copycode = (obj) => {
            if (!obj) {
                dlg("Code copy with invalid object.");
                return false;
            }
            let code = '';
            $(obj).find("li").each((i, v) => {
                code += v.innerText + "\r\n";
            });
            // 复制代码
            setCopy(code, '代码已复制到剪贴板');
            dlg("Code copied.");
        };
        dlg("Code copy fix actived.");
    }
    // 消息轮询
    if (conf.queryMessage) {
        // 检查消息函数
        let checkNotifica = (noNotifica = false) => {
            $.get("/forum.php?mod=misc",(d)=>{
                dlg("Checking message...");
                // 设置最后通知时间为当前时间,以防止反复推送
                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.text();
                // 判断是否应该发送消息
                if(!noNotifica && localStorage.getItem("MExt_ActiveQueryId") == queryId && 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);
                }
            });
        }
        // 刷新消息缓存
        let flushContent = ()=>{
            $.get("/forum.php?mod=misc",(d)=>{
                let dom = $(d);
                let noticontent = dom.filter("#myprompt_menu").text();
                // 写入消息缓存
                localStorage.setItem("MExt_LastNoticeContent",noticontent);
            });
        }
        // 生成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.");
        }
        // 定时运行检查函数
        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.on("click",()=>{
                    let nextpageurl = npbtn.attr('rel');
                    let curpage = parseInt(npbtn.attr('curpage'));
                    npbtn.attr('curpage', curpage + 1);
                    nextpageurl = nextpageurl.replace(/&page=\d+/, '&page=' + (curpage + 1));
                    history.replaceState(null, null, nextpageurl);
                    orgfunc();
                });
            }
            dlg("Page remember actived.");
        });
    }
    if (conf.animateGoToTopButton) {
        // 添加侧边按钮样式
        $("head").append("<style id=\"GoToTopButton\">#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;}</style>");
        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) {
        // 添加固定顶栏样式
        $("head").append("<style id=\"pinnedTopBar\">#toptb{position: fixed;width: 100%;z-index:790;top:0;box-shadow: rgba(0, 0, 0, 0.3) 3px 3px 5px 1px;min-width:860px;}.new_wp{max-width:1130px;width:100%;}.mc_map_wp{padding-top: 45px;}#scbar_type_menu{top:38px!important}#user_info_menu,#myprompt_menu,#usertools_menu,#sslct_menu {position:fixed!important;top:47px!important}#e_controls{z-index: 790!important}</style>");
        $(() => {
            // 重写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.");

    }
    if (conf.fixTopBarPopMenu) {
        // 添加弹出菜单美化样式
        $("head").append("<style id=\"fixTopBarPopMenu\">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: #36b030;color: white;}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){important;border: 1px solid #d1d1d1;min-width: unset;border-radius: 5px;}#myprompt_menu>li>a, #usertools_menu>li>a {border: none; border-radius: 5px;text-align: center;padding: 3px 15px;}#myprompt_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;}</style>");
        dlg("Pop menu fix style appended.");
        // 重写extstyle函数,使更换主题时同步更新样式
        let __extstyle = extstyle;
        let checkStyle = () => {
            let theme = getcookie('extstyle');
            if (theme == "./template/mcbbs/style/winter") {
                if (!$("#fixTopBarPopMenuWinter").length) {
                    $("head").append("<style id=\"fixTopBarPopMenuWinter\">.user_info_menu_info li a.rank {background-color: #5c8dff!important;}ul.user_info_menu_btn>li>a:hover,#myprompt_menu>li>a:hover, #usertools_menu>li>a:hover {background: #5c8dff!important;}</style>");
                }
            } else {
                $("#fixTopBarPopMenuWinter").remove();
            }
        }
        extstyle = (style) => {
            __extstyle(style);
            checkStyle();
        }
        checkStyle();
        dlg("Overwrite extstyle function");
    }
    if (conf.hoverPreviewTheme) {
        //悬浮预览主题
        $(() => {
            $(".sslct_btn").on("mouseenter", ()=>{
                let that = this;
                let timer = setTimeout(()=>{
                    clearTimeout(timer);
                    let previewstyle = getcookie('extstyle');
                    $(that).trigger('click');
                    setcookie('extstyle', previewstyle);
                }, 300);
            });
            $(".sslct_btn").on("mouseleave", () => {
                extstyle(getcookie('extstyle'));
            });
            dlg("Hover preview theme event attached.");
        });
    }
    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).attr('id'))[0];
                    // 重写勋章结构
                    $(v).append(
                        $('<span class="hoverable-medal" id="' + $(n).attr('id') + '" style="background-image:url(' + $(n).attr('src') + ')"><div></div></span>').on('mouseover', () => {
                            showMenu({
                                'ctrlid': $(n).attr('id'),
                                'menuid': id + '_menu',
                                'pos': '12!'
                            });
                        })
                    );
                    // 重写提示样式
                    $("#" + id + "_menu .tip_horn").css("background-image", "url(" + $(n).attr('src') + ")");
                    // 移除旧的勋章
                    $(n).remove();
                });
            });
            dlg("Hoverable medal rewrote.");
        };
        //调用重写勋章函数
        $(rewriteMedal);
        // 在Ajax时重新调用Ajax函数,保存勋章样式
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", rewriteMedal);
        // 添加勋章样式
        $("head").append("<style id=\"hoverableMedal\">.hoverable-medal:hover div {margin-top: 0px!important;opacity: 1!important;}.hoverable-medal div {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;}</style>");
        dlg("Hoverable medal style appended.");
    }
    if (conf.ljyysSearch) {
        // ljyys serach
        $("#scbar_txt").attr("name", "search").css("background-color", "rgba(0, 0, 0, 0)");
        $(".scbar_type_td").html("<a style=\"text-decoration:none;color:unset;\"onclick=\"$('scbar_form').submit();\">ljyys搜索</a>").css("background", "url(https://www.mcbbs.net/template/mcbbs/image/scbar_txt.png) -94px center no-repeat").css("width", "62px").css("cursor", "pointer");
        $("#scbar_form").attr("method", "get").attr("action", "//search.ljyys.xyz/search.php");
        $("#scbar_form [type*=hidden]").remove();
        $("#scbar_form").append('<input type="hidden" name="p" value="1">');
        dlg("ljyys search actived");
    }
    if (conf.quickAtList) {
        $("head").append("<style id=\"quickAtBtn\">#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;}</style>");
        // 获得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 = ()=> {
            // 添加按钮
            $("div.pob.cl a.fastre:not([qa-hooked])").on("click",()=>{
                // 等待窗口出现(暴力)
                let waitWindow = setInterval(()=>{
                    if(!$("#fwin_reply .tedt .bar:not([qa-added])").attr("qa-added",true).length){
                        return false;
                    }
                    clearInterval(waitWindow);
                    // 添加按钮
                    $("#postat.fat").after('<a id="postatList" href="javascript:;" title="快速@" onclick="seditor_insertunit(\'post\',MExt_Func_getAtCode(), \'\');">快速@</a> ');
                },500);
                }).attr("qa-hooked",true); // 为已经钩住的按钮添加标记
            dlg("Reply bottons hooked(QuickAt).");
        }
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", 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>');
            hookReplyBtn();
        });

    }
    if (conf.viewWarns) {
        // 添加查看警告样式
        $("head").append("<style id=\"quickViewWarns\">.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;}</style>");
        // 添加查看警告按钮函数
        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 = "";
            //拼接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>';
            });
            return rrstr;
        }
        // 举报按钮钩子函数
        let hookReportBtn = ()=> {
            let reportContent = getReasons();
            $("div.pob.cl a[onclick*=\"miscreport\"]:not([report-added])").on("click",()=>{
                // 等待窗口出现(暴力)
                let waitWindow = setInterval(()=>{
                    if(!$("[action*=report]").length){
                        return false;
                    }
                    clearInterval(waitWindow);
                    // 添加自定义内容
                    $("#report_reasons").prepend(reportContent)},500)
                }).attr("report-added",true); // 为已经钩住的按钮添加标记
            dlg("Report bottons hooked.");
        }
        $(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 = ()=> {
            // 添加选项
            $("div.pob.cl a.fastre:not([ig-hooked])").on("click",()=>{
                // 等待窗口出现(暴力)
                let waitWindow = setInterval(()=>{
                    if(!$("#fwin_reply #moreconf:not([ig-added])").attr("ig-added",true).length){
                        return false;
                    }
                    clearInterval(waitWindow);
                    // 添加选项
                    $("#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>');
                },500);
                }).attr("ig-hooked",true); // 为已经钩住的按钮添加标记
            dlg("Report bottons hooked.");
        }
        $(()=>{
            // 底部快速回复增加选项
            $("#fastpostsubmit").after('<label for="usesig" style="margin-left: 10px;"><input type="checkbox" name="usesig" id="usesig" class="pc" value="1" checked="checked">使用个人签名</label>');
            hookReplyBtn();
        });
        $(this).on("DiscuzAjaxGetFinished DiscuzAjaxPostFinished", hookReplyBtn);
    }
    // 故意把这个功能搞玄乎,纯粹是好玩,其实还是非常简单的.
    // 这里包含一些对体验影响不大又非常杂的修复选项,不适合单独开一个选项,显得很臃肿.
    // 配置里的这一串数字代表每一个功能的开关情况,比如第一位数字为1时代表第一个功能开启,第二位为0时,代表第二个功能关闭.
    if(/^[01]*$/.exec(conf.miscFix)){
        let fixconf = conf.miscFix.split("");
        let fixlist = [
            // 暗牧悬浮预览
            {"style":".plhin font[style*=\"background-color:black\"] {transition-duration: .3s;transition-delay: .5s;cursor: default;}.plhin font[style*=\"background-color:black\"]:hover {transition-delay: 0s;background-color: transparent!important;}"},
            //增加空方法,用于修复论坛的一个报错.
            {"script":"announcement = () => {};"},
            //修复页脚问题
            {"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;}"}
        ];
        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 : "");
            }
        });
        // 添加修复样式
        $("head").append("<style id=\"miscFix\">"+styleContent+"</style>")
    }
})();