Greasy Fork is available in English.

兔区/闲情-屏蔽词,白名单高亮,防刷屏,记忆楼层,快捷举报,修改配色,屏蔽广告等

大机摸鱼自用,有其他需求或建议可以联系我修改~

Tính đến 07-09-2018. Xem phiên bản mới nhất.

// ==UserScript==
// @name         兔区/闲情-屏蔽词,白名单高亮,防刷屏,记忆楼层,快捷举报,修改配色,屏蔽广告等
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  大机摸鱼自用,有其他需求或建议可以联系我修改~
// @author       岚浅浅
// @match        *://bbs.jjwxc.net/board.php?board=*&type=*&page=*
// @match        *://bbs.jjwxc.net/showmsg.php?board=*&boardpagemsg=*&id=*
// @match        *://bbs.jjwxc.net/board.php?board=*&page=*
// @match        *://bbs.jjwxc.net/showmsg.php?board=*&id=*
// @match        *://bbs.jjwxc.com/board.php?board=*&type=*&page=*
// @match        *://bbs.jjwxc.com/showmsg.php?board=*&boardpagemsg=*&id=*
// @match        *://bbs.jjwxc.com/board.php?board=*&page=*
// @match        *://bbs.jjwxc.com/showmsg.php?board=*&id=*
// @grant        GM_getResourceText
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    var isBoard = location.href.indexOf("board.php") > 0;
    var currentBoard = getQueryVariable("board");
    var currentId = getQueryVariable("id");
    var prefix = currentBoard + "_" + currentId + "_" + document.title.replace(" —— 晋江文学城网友交流区", "");

    function __main__() {
        Style.init();
        Toolbar.init();
        Keyword.init();

        if (isBoard) {
            Keyword.shieldBoardKeyword();
        } else {
            Spam.init();
            Picture.init();
            Quotereply.init();

            let mainElements = $("[id=topic]");
            window.topicWidth = mainElements.width(); // ?
            mainElements.each(function(index) {
                let element = $(this);
                Spam.stopSpam(index, element);
            });
            if (localStorage.getItem(prefix + "_imgHidden") == "true") {
                $("img").hide();
                $("#showAllImg").html("显示该页图片");
                $("#showAllImg").attr("ImgHidden", "true");
                $(".hidePic").text("显示此楼图片");
                $(".hidePic").attr("picHidden", "true");
            }
        }

        if (currentBoard != "2") {
            $(".showreport").hide();
        }
    }

    var Style = {
        init() {
            if (isBoard) {
                document.title = currentBoard;
            }
            GM_addStyle(`/*背景颜色*/
                         body, td, input, textarea {
                            background-color: #2F393C !important;
                        }
                        /*字体颜色*/
                         * {
                            color: #616161;
                        }
                        a, span, input, textarea, #msgsubject, #topic, [id^="replybody"] {
                            color: #A8C023 !important;
                        }
                        /*边框颜色*/
                         input, table[border="4"] {
                            border: solid #616161 1px;
                        }
                        /*修改头像*/
                         .image1, .image2, .image6, .image7, .image8, .image9, .image10, .image12, .image13, .image14, .image15, .image16 {
                            background-image: url(https://i.loli.net/2018/08/28/5b84af69b2b16.png) !important;
                        }
                        .image17, .image18, .image19, .image20, .image21, .image22, .image23, .image24 {
                            background-image: url(https://i.loli.net/2018/08/28/5b84af682e7eb.png) !important;
                        }
                        /*屏蔽广告*/
                         body > table:first-of-type > tbody > tr:nth-of-type(4), body > center:nth-of-type(2), .textbook {
                            display: none;
                        }`);
            GM_addStyle(`#toolbar{opacity:0.6;z-index:999999;position:fixed;top:10px;left:83%;border:1px solid #a38a54;width:180px;border-radius:3px;}
                        #spamKeywordList{opacity:0.6;z-index:999999;position:fixed;top:330px;left:83%;border:1px solid #a38a54;width:180px;border-radius:3px;}
                        #whiteKeywordList{opacity:0.6;z-index:999999;position:fixed;top:330px;left:83%;border:1px solid #a38a54;width:180px;border-radius:3px;}
                        .clickable a{cursor:pointer;}`);
        }
    }

    var Toolbar = {
        isBoard: 0,
        init() {
            Toolbar.showToolBar();

            if (isBoard) {
                Toolbar.isBoard = 1;
                $(".showmsg").hide();
            }

            Toolbar.eventRegister();
        },
        showToolBar() {
            $("body").append(`<div id="toolbar" class="clickable" style="display:flex;flex-direction:column">
                            <div style="margin:2px auto" class="showreport">
                                <a id="reportBtn" style="margin:auto">举报该贴</a>
                            </div>
                            <div style="margin:2px auto" class="showmsg">
                                 <a id="showAllImg" ImgHidden="false">隐藏该页图片</a>
                            </div>
                            <div style="margin:2px auto">
                                <a id="top" style="margin:auto">到顶部</a>
                                <a id="bottom" style="margin:auto">到底部</a>
                            </div>
                            <div style="margin:2px auto">
                                <a id="prePage" style="margin:auto">上一页</a>
                                <a id="nextPage" style="margin:auto">下一页</a>
                            </div>
                            <div style="margin:2px auto" class="showmsg">
                                <a id="saveFloorBtn" style="margin:auto">保存楼层</a>
                                <a id="saveFloorAndCloseBtn" style="margin:auto">关闭页面</a>
                            </div>
                            <div style="margin:2px auto" class="showmsg">
                                <input id="floorJumpInput" style="font-size:15px;width:120px;height:20px" placeholder="楼层转跳">
                                <a id="floorJumpBtn">确定</a>
                            </div>
                            <div style="margin:2px auto">
                                 <input id="pageJumpInput" style="font-size:15px;width:120px;height:20px" placeholder="页码转跳">
                                 <a id="pageJumpBtn">确定</a>
                            </div>
                            <div style="margin:2px auto">
                                 <input id="spamKeywordInput" style="font-size:10px;width:120px;height:20px" placeholder="屏蔽词添加,空格隔开">
                                 <a id="spamKeywordBtn">确定</a>
                            </div>
                            <div style="margin:2px auto">
                                 <input id="whiteKeywordInput" style="font-size:10px;width:120px;height:20px" placeholder="白名单添加,空格隔开">
                                 <a id="whiteKeywordBtn">确定</a>
                            </div>
                            <div style="margin:2px auto">
                                <a id="spamKeywordListBtn">屏蔽词列表</a>
                                <a id="whiteKeywordListBtn">白名单列表</a>
                            </div>
                            <div style="margin:2px auto" class="showmsg">
                                 <textarea id="spamContentTextarea" style="font-size:10px;width:120px;height:35px;padding:1px" placeholder="刷屏内容设置"></textarea>
                                 <a id="spamContentBtn" style="position:relative;top:-15px">刷屏</a>
                            </div>
                        </div>`);

            $("body").append(`<div style="display:none">
                                <div id="spamKeywordList" class="clickable" style="display:flex;flex-direction:column">
                                </div>
                            </div>
                            <div style="display:none">
                                <div id="whiteKeywordList" class="clickable" style="display:flex;flex-direction:column">
                                </div>
                            </div>`);

            $("#spamContentTextarea").attr("placeholder", `刷屏内容设置,当前${localStorage["spamContent"] == undefined ? "为空" : "已设置"}`);
        },
        getPage() {
            const totalPage = parseInt($("#pager_top").text().replace(/共(\d*)页.*/, "$1"));
            const pageIndex = location.href.indexOf("page=");
            if (pageIndex < 0) {
                return [-1, -1, totalPage];
            }
            const page = parseInt(location.href.substring(pageIndex + 5));
            return [pageIndex, page, totalPage]
        },
        saveFloor() {
            let scrollTop = $(document).scrollTop();
            let nodes = $(".authorname").toArray();
            let floor;
            for (let node of nodes) {
                let nodeTop = $(node).parent().prev().prev().offset().top;
                if (nodeTop > scrollTop) {
                    floor = $(node).find("font")[0].innerHTML;
                    floor = parseInt(floor.substring(1, floor.length));
                    if (floor > 0) {
                        return floor;
                    }
                }
            }
            floor = $(nodes.pop()).find("font")[0].innerHTML;
            return floor.substring(1, floor.length);
        },
        scrollToFloor(floor) {
            let node = $(".authorname").toArray().filter(e => $(e).find("font")[0].innerHTML.indexOf(floor) >= 0);
            if (node.length > 0) {
                $('html, body').animate({ scrollTop: $(node).parent().prev().prev().offset().top }, 1000);
            }
        },
        eventRegister() {
            $(document).on("click", "#reportBtn", function() {
                window.open("http://ceorabbit.zz11.43ns.com/ReportCenter/2.php?id=" + currentId);
            })

            $(document).on("click", "#showAllImg", function() {
                if ($("#showAllImg").attr("ImgHidden") == "true") {
                    $("img").show();
                    $("#showAllImg").html("隐藏该页图片");
                    $("#showAllImg").attr("ImgHidden", "false");
                    $(".hidePic").text("隐藏此楼图片");
                    $(".hidePic").attr("picHidden", "false");
                    localStorage.removeItem(prefix + "_imgHidden");
                } else {
                    $("img").hide();
                    $("#showAllImg").html("显示该页图片");
                    $("#showAllImg").attr("ImgHidden", "true");
                    $(".hidePic").text("显示此楼图片");
                    $(".hidePic").attr("picHidden", "true");
                    localStorage.setItem(prefix + "_imgHidden", true);
                }
            });

            $(document).on("click", "#top", function() {
                $('html, body').animate({ scrollTop: 0 }, 1000);
            })
            $(document).on("click", "#bottom", function() {
                $('html, body').animate({ scrollTop: $(document).height() }, 1000);
            })

            $(document).on("click", "#prePage", function() {
                let [pageIndex, page, totalPage] = Toolbar.getPage();
                if (pageIndex == -1 || page == 0) {
                    alert("当前为第一页");
                    return;
                }
                location.href = location.href.substring(0, pageIndex + 5) + (page - 1);

            })
            $(document).on("click", "#nextPage", function() {
                let [pageIndex, page, totalPage] = Toolbar.getPage();
                if (page + 1 == totalPage) {
                    alert("已是最后一页");
                    return;
                }
                if (pageIndex == -1) {
                    location.href = location.href + "&page=1";
                } else {
                    location.href = location.href.substring(0, pageIndex + 5) + (page + 1);
                }
            })

            $(document).on("click", "#saveFloorBtn", function() {
                localStorage.setItem(prefix + "_floor", Toolbar.saveFloor());
                alert("保存成功");
            })
            $(document).on("click", "#saveFloorAndCloseBtn", function() {
                localStorage.setItem(prefix + "_floor", Toolbar.saveFloor());
                window.close();
            })

            $(document).on("click", "#floorJumpBtn", function() {
                const pagesize = 300;
                let [pageIndex, page, totalPage] = Toolbar.getPage();
                let floor = $("#floorJumpInput").val();
                if (floor == "" || isNaN(floor)) {
                    alert("输入不合法");
                    return;
                }
                let jumpPage = floor % pagesize == 0 ? floor / pagesize : parseInt(floor / pagesize) + 1;
                if (jumpPage == page + 1) {
                    Toolbar.scrollToFloor(floor);
                    return;
                }
                localStorage[prefix + "_jumpFloor"] = floor;
                if (pageIndex == -1) {
                    location.href = `${location.href}&page=${jumpPage-1}`;
                } else {
                    location.href = location.href.substring(0, pageIndex + 5) + `${jumpPage - 1}`;
                }
            })

            $(document).on("click", "#pageJumpBtn", function() {
                let [pageIndex, page, totalPage] = Toolbar.getPage();
                let jumpPage = $("#pageJumpInput").val();
                if (jumpPage == "" || isNaN(jumpPage)) {
                    alert("输入不合法");
                    return;
                }
                if (jumpPage > totalPage) {
                    alert(`共${totalPage}页,请输入正确页码`);
                    return;
                }
                if (pageIndex == -1) {
                    location.href = `${location.href}&page=${jumpPage-1+Toolbar.isBoard}`;
                } else {
                    location.href = location.href.substring(0, pageIndex + 5) + (jumpPage - 1 + Toolbar.isBoard);
                }
            })

            $(document).on("click", "#spamKeywordBtn", function() {
                let spamKeyword = $("#spamKeywordInput").val().trim();
                if (spamKeyword == "") {
                    alert("请输入屏蔽词");
                    return;
                }
                Keyword.addSpamKeyword(spamKeyword);
            })

            $(document).on("click", "#whiteKeywordBtn", function() {
                let whiteKeyword = $("#whiteKeywordInput").val().trim();
                if (whiteKeyword == "") {
                    alert("请输入白名单");
                    return;
                }
                Keyword.addWhiteKeyword(whiteKeyword);
            })

            $(document).on("click", "#spamKeywordListBtn", function(event) {
                if ($("#spamKeywordList").parent().is(":hidden")) {
                    $("#whiteKeywordList").parent().hide();
                    $("#spamKeywordList").parent().show();
                } else {
                    $("#spamKeywordList").parent().hide();
                }
            })
            $(document).on("click", "#whiteKeywordListBtn", function(event) {
                if ($("#whiteKeywordList").parent().is(":hidden")) {
                    $("#spamKeywordList").parent().hide();
                    $("#whiteKeywordList").parent().show();
                } else {
                    $("#whiteKeywordList").parent().hide();
                }
            })

            $(document).on("click", "#spamContentBtn", function() {
                let spamContent = $("#spamContentTextarea").val();
                if (spamContent != "") {
                    localStorage["spamContent"] = spamContent;
                    $("textarea[name='body']").val(spamContent + "\n\n" + new Date());
                } else if (localStorage["spamContent"] != undefined) {
                    $("textarea[name='body']").val(localStorage["spamContent"] + "\n\n" + new Date());
                } else {
                    alert("请输入刷屏内容");
                    return;
                }
                $('input[name="button1"]').click();
            })

            $(document).on("keypress", "#floorJumpInput", function(event) {
                if (event.keyCode == 13) {
                    $("#floorJumpBtn").click();
                }
            })
            $(document).on("keypress", "#pageJumpInput", function(event) {
                if (event.keyCode == 13) {
                    $("#pageJumpBtn").click();
                }
            })
            $(document).on("keypress", "#spamKeywordInput", function(event) {
                if (event.keyCode == 13) {
                    $("#spamKeywordBtn").click();
                }
            })
            $(document).on("keypress", "#whiteKeywordInput", function(event) {
                if (event.keyCode == 13) {
                    $("#whiteKeywordBtn").click();
                }
            })
            $(document).on("keypress", "#spamContentTextarea", function(event) {
                if (event.keyCode == 13) {
                    $("#spamContentBtn").click();
                }
            })
        }
    }

    var Keyword = {
        init() {
            Keyword.initSpamKeywordList();
            Keyword.initWhiteKeywordList();
            Keyword.eventRegister();
        },
        initSpamKeywordList() {
            let spamKeywords = (localStorage["spamKeywords"] || "").trim();
            if (spamKeywords.length == 0) {
                $("#spamKeywordList").html('<div style="margin:2px auto">无屏蔽关键词</div>')
                return;
            }

            let html = spamKeywords.split(" ").map(spamKeyword => {
                return `<div style="margin:2px auto">
                        <label>${spamKeyword.trim()}</label>
                        <a class="deleteSpamKeyword">删除</a>
                        </div>`
            }).join(" ");
            $("#spamKeywordList").html(html);
            return;
        },
        initWhiteKeywordList() {
            let whiteKeywords = (localStorage["whiteKeywords"] || "").trim();
            if (whiteKeywords.length == 0) {
                $("#whiteKeywordList").html('<div style="margin:2px auto">无白名单关键词</div>')
                return;
            }

            let html = whiteKeywords.split(" ").map(whiteKeyword => {
                return `<div style="margin:2px auto">
                        <label>${whiteKeyword.trim()}</label>
                        <a class="deleteWhiteKeyword">删除</a>
                        </div>`
            }).join(" ");
            $("#whiteKeywordList").html(html);
            return;
        },
        shieldKeyword(index, element, spamKeywords) {
            let text = element.text();
            for (var spamKeyword of spamKeywords.split(" ")) {
                if (spamKeyword.trim().length != 0 && text.indexOf(spamKeyword) >= 0) {
                    element.text("已屏蔽");
                    break;
                }
            }
        },
        shieldBoardKeyword() {
            let msglist = $("#msglist").children().children().toArray();
            let spamKeywords = localStorage["spamKeywords"] || "";
            let whiteKeywords = localStorage["whiteKeywords"] || "";
            if (spamKeywords.length == 0 && whiteKeywords.length == 0) {
                return;
            }
            for (let msg of msglist) {
                let reportNode = $(msg).find("td")[1];
                let titleNode = $(msg).find("td")[3];
                let url = $(titleNode).children().attr("href");
                if (url != undefined) {
                    let id = getQueryVariable("id", url);
                    $(reportNode).append('<a class="reportBtn showreport" style="font-size:small" href="http://ceorabbit.zz11.43ns.com/ReportCenter/2.php?id=' + id + '" target="_blank">举报</a>');
                }
                let title = titleNode.innerText;
                let isWhite = false;
                for (let whiteKeyword of whiteKeywords.split(" ")) {
                    if (whiteKeyword.trim().length != 0 && title.indexOf(whiteKeyword) >= 0) {
                        $(msg).css("opacity", "0.75");
                        isWhite = true;
                        break;
                    }
                }
                if (!isWhite) {
                    for (let spamKeyword of spamKeywords.split(" ")) {
                        if (spamKeyword.trim().length != 0 && title.indexOf(spamKeyword) >= 0) {
                            console.log("已屏蔽:" + title);
                            $(msg).remove();
                            break;
                        }
                    }
                }
            }
        },
        addSpamKeyword(spamKeyword) {
            let storageSpamKeyword = localStorage["spamKeywords"] || "";
            localStorage["spamKeywords"] = storageSpamKeyword + spamKeyword + " ";
            localStorage["spamKeywords"] = localStorage["spamKeywords"].replace(/\s+/g, " ");
            alert("添加成功");
            if (isBoard) {
                location.reload();
            }
            return;
        },
        addWhiteKeyword(whiteKeyword) {
            let storageWhiteKeyword = localStorage["whiteKeywords"] || "";
            localStorage["whiteKeywords"] = storageWhiteKeyword + whiteKeyword + " ";
            localStorage["whiteKeywords"] = localStorage["whiteKeywords"].replace(/\s+/g, " ");
            alert("添加成功");
            if (isBoard) {
                location.reload();
            }
            return;
        },
        eventRegister() {
            $(document).on("click", ".deleteSpamKeyword", function() {
                let spamKeyword = $(this).prev().html();
                var re = new RegExp(`(.*)(${spamKeyword}\\s)(.*)`)
                localStorage["spamKeywords"] = localStorage["spamKeywords"].replace(re, "$1$3");
                $(this).parent().remove();
            })
            $(document).on("click", ".deleteWhiteKeyword", function() {
                let whiteKeyword = $(this).prev().html();
                var re = new RegExp(`(.*)(${whiteKeyword}\\s)(.*)`)
                localStorage["whiteKeywords"] = localStorage["whiteKeywords"].replace(re, "$1$3");
                $(this).parent().remove();
            })
        }
    }

    var Spam = {
        init() {
            Spam.eventRegister();
        },
        stopSpam(index, element) {
            let height = element.height();
            let lineHeight = parseInt(element.css("line-height"));
            let picHeight = Spam.calPicHeight(element);
            let rowsCount = (height - picHeight) / lineHeight;
            let maxRowsCount = 40;
            let flag = rowsCount > maxRowsCount ? true : false;
            if (flag) {
                var rowNum = 0;
                var picHtml = "";
                element.find("img").each(function() {
                    picHtml += $(this).prop("outerHTML");
                });
                var allText = element.text().split("\n");
                var shownText = "";
                var hidenText = "";
                $.each(allText, function(index, value) {
                    let partTextWidth = Spam.getTextWidth(value);
                    let rowNumInOnePart = 0;

                    if (partTextWidth > topicWidth) {
                        rowNumInOnePart += partTextWidth / topicWidth + 1;
                    } else {
                        rowNumInOnePart = 1;
                    }

                    if (rowNum + rowNumInOnePart > maxRowsCount) {
                        rowNum += rowNumInOnePart;
                        return true;
                    }
                    rowNum += rowNumInOnePart;
                });
                let elementText = element[0].innerHTML;
                element.html("");
                element.append("<p>本楼共" + parseInt(rowsCount) + "行</p><a href='javascript:;' class='shownText' data-index='" + index + "' textHidden='true'>点击显示全部</a> <span class='hideText' data-index='" + index + "' style='display:none'><br>" + elementText + "<a href='javascript:;' class='hideTextHref' data-index='" + index + "'>隐藏</a></span>");
            } else {
                Picture.showPictures(index, element);
            }
        },
        calPicHeight(element) {
            let height = 0;
            element.find("img").each(function() {
                height += $(this).height();
            });
            return height;
        },
        getTextWidth(str) {
            let width = $('body').append($('<span stlye="display:none;" id="textWidth"/>')).find('#textWidth').html(str).width();
            $('#textWidth').remove();
            return width;
        },
        eventRegister() {
            $(document).on("click", ".shownText", function(event) {
                console.log(event)
                let index = $(event.target).attr('data-index');
                let flag = $(event.target).attr('textHidden');
                if (flag == 'true') {
                    $(".shownText[data-index=" + index + "]").text("隐藏");
                    $(".hideText[data-index=" + index + "]").show();
                    $(event.target).attr('textHidden', "false")
                } else {
                    $(".shownText[data-index=" + index + "]").text("点击显示全部");
                    $(".hideText[data-index=" + index + "]").hide();
                    $(event.target).attr('textHidden', "true")
                }
            });

            $(document).on("click", ".hideTextHref", function(event) {
                let index = $(event.target).attr('data-index');
                $(".shownText[data-index=" + index + "]").text("点击显示全部");
                $(".hideText[data-index=" + index + "]").hide();
            });
        },
    }

    var Picture = {
        init() {
            Picture.eventRegister();
        },
        showPictures(index, element) {
            let picNode = element.find("img");
            if (picNode.length !== 0) {
                let hideHtml;
                if (localStorage.getItem(prefix + "_" + index + "_picHidden") == "true") {
                    picNode.hide();
                    hideHtml = '<p><a href="javascript:;" class="hidePic" data-index="' + index + '" picHidden="true">显示此楼图片</a></p>';
                } else {
                    hideHtml = '<p><a href="javascript:;" class="hidePic" data-index="' + index + '" picHidden="false">隐藏此楼图片</a></p>';
                }
                element.html(hideHtml + element.html());
            }
        },
        eventRegister() {
            $(document).on("click", ".hidePic", function(event) {
                const node = $(event.target);
                let flag = node.attr('picHidden');
                let index = node.attr('data-index');
                if (flag == "true") {
                    node.parent().parent().find("img").show();
                    $(".hidePic[data-index=" + index + "]").text("隐藏此楼图片");
                    node.attr('picHidden', "false");
                    localStorage.removeItem(prefix + "_" + index + "_picHidden");
                } else {
                    node.parent().parent().find("img").hide();
                    $(".hidePic[data-index=" + index + "]").text("显示此楼图片");
                    node.attr('picHidden', "true");
                    localStorage.setItem(prefix + "_" + index + "_picHidden", true);
                }
            });
        }
    }

    var Quotereply = {
        init() {
            Quotereply.autoFill();
            Quotereply.overrideQuotereplyBtn();
            Quotereply.overrideSubmitBtn();
            Quotereply.eventRegister();
        },
        autoFill() {
            $("input[name='username']").val("= =");
        },
        overrideQuotereplyBtn() {
            let quotereplyBtnList = $("a[class^='quotereply']").toArray();
            for (let quotereplyBtn of quotereplyBtnList) {
                let goBottomStr = $(quotereplyBtn).attr("onclick");
                $(quotereplyBtn).removeAttr("onclick");
                $(quotereplyBtn).attr("id", goBottomStr.substring(9, goBottomStr.length-1));
            }
        },
        overrideSubmitBtn() {
            $('input[name="button1"]').removeAttr("onclick");
        },
        goBottom(replyid, ismanager, floor) {
            var quoteinfo = $("#quotebody_"+replyid).html();
            if (quoteinfo==undefined) {
                quoteinfo = "";
            }
            var replybodyinfo = $("#replybody_"+replyid).html();
            var replyinfo = quoteinfo+replybodyinfo;
            var replyclass = 'reply_'+replyid;
            var floorinfo;
            if (ismanager==0) {
                floorinfo = $("."+replyclass+" td[class='authorname']").text();
            } else {
                floorinfo = "№"+floor+"☆☆☆";
            }
            replyinfo = replyinfo.replace(/<font color="#999999">/g, "");
            replyinfo = replyinfo.replace(/<\/font>/, "");
            replyinfo = replyinfo.replace(/<br>/g, "\n");
            replyinfo = replyinfo.replace(/ (?!src)[a-z]+=("[^"]*")+( \/)*/g, "");
            replyinfo = replyinfo.replace(/<p><a data-index="[0-9]+">(隐藏|显示)此楼图片<\/a><\/p>/g, "");
            floorinfo = $.trim(floorinfo);
            window.scrollTo(0, document.documentElement.scrollHeight-document.documentElement.clientHeight);
            $('#quotetr').show();
            $('#quotearea').attr('value', replyinfo);
            $('#floorinfo').attr('value', floorinfo);
        },
        submit(makedonot) {
            if (localStorage.getItem(prefix + "_floor") == undefined) {
                let nodes = $(".authorname").toArray();
                let floor = $(nodes.pop()).find("font")[0].innerHTML;
                localStorage.setItem(prefix + "_floor", floor.substring(1, floor.length));
            }
            makedonot();
        },
        makedonot() {
            form1.button1.disabled = true;
            form1.submit();
        },
        eventRegister() {
            $(document).on("click", "a[class^='quotereply']", function() {
                let goBottomParas = $(this).attr("id").split(",");
                Quotereply.goBottom(goBottomParas[0], goBottomParas[1], goBottomParas[2]);
            })
            $(document).on("click", "input[name^='button1']", function() {
                Quotereply.submit(Quotereply.makedonot);
            })
        }
    }

    function getQueryVariable(variable, url) {
        var query;
        if (url == undefined) {
            query = location.search.substring(1);
        } else if (url.indexOf("?")) {
            query = url.split("?")[1];
        }
        var vars = query.split("&");
        for (let v of vars) {
           var pair = v.split("=");
           if(pair[0] == variable){
               return pair[1];
           }
        }
        return(false);
    }

    window.onload = function(){
        if (localStorage.getItem(prefix + "_jumpFloor") != undefined) {
            Toolbar.scrollToFloor(localStorage.getItem(prefix + "_jumpFloor"));
            localStorage.removeItem(prefix + "_jumpFloor");
        } else if (localStorage.getItem(prefix + "_floor") != undefined) {
            $("#floorJumpInput").val(localStorage.getItem(prefix + "_floor"));
            $("#floorJumpBtn").click();
            $("#floorJumpInput").val("");
            localStorage.removeItem(prefix + "_floor");
        }
    }

    window.onbeforeunload = function(){
        if (!isBoard && localStorage.getItem(prefix + "_floor") == undefined) {
            let floor = parseInt(Toolbar.saveFloor());
            let maxFloor = $(".authorname").toArray().length;
            if (floor > 10 && floor % 300 < maxFloor - 10) {
                localStorage.setItem(prefix + "_floor", floor);
            }
        }
    }

    __main__();
})();