Greasy Fork

手机助手

自动滚动,嗅探图片、视频,页面旋转,字体放大,去除广告浮动

目前为 2024-04-05 提交的版本。查看 最新版本

// ==UserScript==
// @name         手机助手
// @namespace    http://tampermonkey.net/
// @version      9.500.13.95
// @description  自动滚动,嗅探图片、视频,页面旋转,字体放大,去除广告浮动
// @author       You
// @match        *://*/*
// @run-at       document-start
// @require      https://cdn.bootcss.com/jquery/3.7.1/jquery.min.js
// @grant    GM_registerMenuCommand
// @grant    GM_setValue
// @grant    GM_getValue
// @license      MIT
// ==/UserScript==

var runFunc = setInterval(function() {
        if (!this.jQuery) return;

        clearInterval(runFunc);

        this.$ = this.jQuery = jQuery.noConflict(true);

        (function($) {

            'use strict';

            if (document.querySelector('.JqMA-btn-all') || window.frames.length != parent.frames.length) {
                return;
            }

            function dqSlt(selectPath) {
                return $(document.querySelectorAll('iframe')).contents().find(selectPath).add(document.querySelectorAll(selectPath));
            }

            function removeShadowRoot() {
                var hasShadowRoot;
                $(document.querySelectorAll("div")).each(function() {
                    if (this.shadowRoot) {
                        this.replaceWith(...this.shadowRoot.childNodes);
                        hasShadowRoot = true;
                    }
                });
                hasShadowRoot && alert("#shadow-root 已移除");
            }

            function checkImgExists(imgurl) {
                return new Promise(function(resolve, reject) {
                    var ImgObj = new Image();
                    ImgObj.src = imgurl;
                    ImgObj.onload = function(res) {
                        resolve(this);
                    }
                    ImgObj.onerror = function(err) {
                        reject(err)
                    }
                });
            }

            function getElementSelector(element) {
                var path = "";
                while (element && element.nodeType == Node.ELEMENT_NODE) {
                    var selector = element.nodeName.toLowerCase();
                    if (selector == "body") {
                        break;
                    }
                    if (element.id) {
                        selector += "#" + element.id;
                    } else {
                        if (element.classList.length > 0) {
                            selector += "." + Array.from(element.classList)[0];
                        }
                        if (element.parentNode.querySelectorAll(selector).length > 1) {
                            var index = Array.from(element.parentNode.children).indexOf(element) + 1;
                            selector += ":nth-child(" + index + ")";
                        }
                    }
                    path = selector + " > " + path;
                    element = element.parentNode;
                }
                return "body > " + path.replace(/[> ]+$/, "");
            }

            function copyToClipboard(text) {
                var textArea = document.createElement('input');
                textArea.style = 'display:block!important;height:0!important;min-height:none!important;';
                textArea.value = text;
                document.body.appendChild(textArea);
                textArea.select();
                document.execCommand('copy');
            }

            function uniqueArr(arr) {
                for (var i = 0; i < arr.length; i++) {
                    for (var j = i + 1; j < arr.length; j++) {
                        if (JSON.stringify(arr[i]) == JSON.stringify(arr[j])) {
                            arr.splice(j, 1);
                            j--;
                        }
                    }
                }
                return arr;
            }

            function getDataValue(gmValName, _default) {
                if (typeof GM_getValue(gmValName) != "object") {
                    GM_setValue(gmValName, {});
                }
                var _data = GM_getValue(gmValName),
                    keys = Object.keys(_data);
                if (gmValName != "picRepData" && keys.length > 100) {
                    delete _data[keys[0]];
                }
                return [_data, _data.hasOwnProperty(locHost()) ? _data[locHost()] : _default];
            }

            var [DSImgData, DSImg] = getDataValue("DSImgData", 1);

            if (GM_getValue("hidePagetual") === null) GM_setValue("hidePagetual", 0);

            var hidePagetual = GM_getValue("hidePagetual");

            GM_registerMenuCommand("显示/隐藏东方永页机控件", function() {
                hidePagetual = hidePagetual ? 0 : 1;
                location.reload(false);
                GM_setValue("hidePagetual", hidePagetual);
            });
            GM_registerMenuCommand("显示/隐藏按钮", function() {
                if (dqSlt(".JqMA-btn-del").first().css("display") == "none") {
                    dqSlt(Dhide ? ".JqMA-btn-del" : ".JqMA-btn-all").each(function() {
                        Dhide && this.style.setProperty("opacity", "0.5", "important");
                        this.style.setProperty("display", "block", 'important');
                    });
                } else {
                    dqSlt(".JqMA-btn-all").each(function() {
                        this.style.setProperty("display", "none", 'important');
                    });
                }
            });

            function changeDataFunc(_data, _default) {
                var changeData = prompt("请修改:", JSON.stringify(_data));
                if (typeof JSON.parse(changeData) == "object") {
                    changeData && alert(changeData);
                    changeData = JSON.parse(changeData)
                    return [changeData, changeData.hasOwnProperty(locHost()) ? changeData[locHost()] : _default]
                } else {
                    return false;
                }
            }
            GM_registerMenuCommand("保存本域页宽", function() {
                var inputNum = prompt("请输入本域页宽:", window.innerWidth);
                if (inputNum == "所有域名") {
                    var resultData = changeDataFunc(winWData, window.innerWidth);
                    if (resultData)[winWData, winWidth] = resultData;
                } else if (Number(inputNum)) {
                    winWidth = Number(inputNum);
                    winWData[locHost()] = winWidth;
                    alert('保存成功:' + winWidth);
                }
                GM_setValue("winWData", winWData);
            });
            var [winWData, winWidth] = getDataValue("winWData", window.innerWidth);

            var winProp = window.innerHeight / window.innerWidth;

            var winHeight = winWidth * winProp;

            var winW = winHeight * 0.5;

            var wHeight = winHeight * 0.05,
                SPicH = winWidth * 0.2,
                top = (winHeight - wHeight) * 0.5;

            var html_style =
                `html,body {
            overflow-wrap: break-word !important;
            scroll-behavior: auto !important;
            min-height: ${winHeight}px !important;
        }`;
            var inner_style =
                `.JqMA-inner-all{
            box-sizing: border-box !important;
            position: relative !important;
            z-index: 2147483646 !important;
            margin: 0 !important;
            border: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            display: block !important;
            overflow-wrap: break-word !important;
        }
        .JqMA-inner-pic,
        .JqMA-inner-word {
            height: auto !important;
            margin: ${0.2 * winHeight}px 0 ${0.2 * winHeight}px 0 !important;
            background: black !important;
        }
        html body .JqMA-inner-word {
            color: #FEFEFE !important;
            text-align: left !important;
            font-size: ${winW * 0.06}px !important;
            text-indent: 2em !important;
            text-align: left !important;
        }
        .JqMA-inner-pic {
            text-align: right !important;
            font: 0 "Fira Sans", sans-serif !important;
        }
        .JqMA-inner-pic,
        .JqMA-inner-pic *:not(.JqMA-mark-pageNext) {
            box-sizing: border-box !important;
            border-radius: 0 !important;
            float: none !important;
            opacity: 1 !important;
            visibility: visible !important;
        }
        .JqMA-inner-pic *{
            overflow-wrap: break-word !important;
            margin: 0 !important;
            padding: 0 !important;
            position: static !important;
        }
        .JqMA-inner-pic *:not(a){
            border: 0 !important;
        }
        .JqMA-inner-pic *::before,
        .JqMA-inner-pic *::after {
            display: none !important;
        }
        .JqMA-inner-pic picture,
        .JqMA-inner-pic img {
            display: inline-block !important;
            width: 100% !important;
            height: auto !important;
            user-select: none !important;
            object-fit: contain !important;
            background: gray !important;
        }
        html .JqMA-inner-pic > *{
            vertical-align: top !important;
        }
        .JqMA-inner-pic xmp,
        .JqMA-inner-pic a {
            color: #FEFEFE !important;
            height: ${0.4 * SPicH}px !important;
            overflow: hidden !important;
            font-size: ${winW * 0.05}px !important;
            line-height: 1.36 !important;
            cursor: pointer !important;
        }
        html .JqMA-inner-pic picture + xmp:not(.JqMA-css-smallPic) {
            margin-top: ${-0.8 * SPicH}px !important;
        }
        html .JqMA-inner-pic picture + xmp:not(.JqMA-css-smallPic) + xmp{
            margin-top: ${-0.4 * SPicH}px !important;
        }
        .JqMA-inner-pic .JqMA-css-smallPic {
            margin-bottom: ${-0.4 * SPicH}px !important;
            width: 12.5% !important;
            height: ${0.4 * SPicH}px !important;
            overflow: hidden !important;
            position: relative !important;
        }
        html .JqMA-inner-pic .JqMA-css-smallPic:nth-child(8n + 1) {
            margin-bottom: 0 !important;
        }
        html .JqMA-inner-pic xmp {
            background: none !important;
            position: relative !important;
            white-space: pre-wrap !important;
            white-space: -moz-pre-wrap !important;
            white-space: -pre-wrap !important;
            white-space: -o-pre-wrap !important;
            word-wrap: break-word !important;
            text-align: left !important;
            width: 100% !important;
        }
        .JqMA-inner-pic a{
            background: none !important;
            position: absolute !important;
            top: 0 !important;
            left: 50% !important;
            margin-left: ${-0.0625 * winWidth}px !important;
            display: inline-block !important;
            user-select: none !important;
            width: ${winWidth * 0.125}px !important;
            text-align: center !important;
            text-decoration: none !important;
            border: 2px solid red !important;
        }
        .JqMA-btn-all,
        .JqMA-inner-all,
        .JqMA-inner-pic * {
            min-width: none !important;
            max-width: none !important;
            min-height: none !important;
            max-height: none !important;
        }
        .JqMA-btn-all {
            overflow: hidden !important;
            opacity: 1 !important;
            background: rgba(0,0,0,0.4) !important;
            color: #FEFEFE !important;
            display: block !important;
            text-align: center !important;
            line-height: 2.8 !important;
            border-radius: 0 !important;
            cursor: pointer !important;
            user-select: none !important;
            z-index: 999999999999 !important;
            padding: 0 !important;
            border: 0 !important;
            font-weight: bold !important;
            position: fixed !important;
            font-size: ${winW * 0.036}px !important;
            height: ${wHeight}px !important;
            width: ${wHeight}px !important;
        }
        `;

            var css_style =
                `.JqMA-mark-pageNext {
            display: inline-block !important;
            height: 0 !important;
            min-height: none !important;
            margin: 0 !important;
            border: 0 !important;
            padding: 0 !important;
            overflow: hidden !important;
        }
        .JqMA-css-textBig,.JqMA-inner-word {
            letter-spacing: normal !important;
            line-height: normal !important;
            overflow-wrap: break-word !important;
        }
        .JqMA-css-yScroll{
            overflow-y: scroll!important;
        }
        .JqMA-css-xScroll{
            overflow-x: scroll!important;
        }
        .JqMA-css-fixed_hide {
            display: none !important;
        }
        .JqMA-css-transform,.JqMA-css-rotate {
            max-height: none !important;
            height: auto !important;
        }
        .JqMA-css-transform {
            transform: translate(0%, 0%) !important;
            padding-top: ${0.5 * winHeight}px !important;
            padding-bottom: ${0.5 * winHeight}px !important;
        }
        html .JqMA-css-rotate {
            float: right !important;
            position: relative !important;
            left: -100% !important;
            padding-bottom: ${1.5 * winHeight}px !important;
        
            transform: rotateZ(-90deg) !important;
            transform-origin: 100% 0 !important;
            -webkit-transform: rotateZ(-90deg) !important;
            -webkit-transform-origin: 100% 0 !important;
            -moz-transform: rotateZ(-90deg) !important;
            -moz-transform-origin: 100% 0 !important;

            width: ${winHeight}px !important;
            min-width: none !important;
            max-width: none !important;
        }`;
            if (hidePagetual) {
                css_style += `.pagetual_pageBar,#pagetual-sideController {
                display: inline-block !important;
                height: 0 !important;
                min-height: none !important;
                margin: 0 !important;
                border: 0 !important;
                padding: 0 !important;
                overflow: hidden !important;}`;
            }

            var jianG = wHeight;

            var left = 0,
                left2 = wHeight + left,
                left3 = wHeight + left2;

            var leftCss = "left:" + left + "px !important;",
                leftCss2 = "left:" + left2 + "px !important;",
                leftCss3 = "left:" + left3 + "px !important;";

            var animateTime = 800,
                scrollNum = parseInt(winHeight * 6 * animateTime / 100000);

            function locHost() {
                return window.location.hostname;
            }

            if (GM_getValue("scrollJu") === null) GM_setValue("scrollJu", 5);

            var scrollJu = Math.abs(GM_getValue("scrollJu"));

            var [picwhData, picwh] = getDataValue("picwhData", 50);

            var [outerSzData, outerSz] = getDataValue("outerSzData", 0.1);

            if (GM_getValue("smoothScroll") === null) GM_setValue("smoothScroll", 0);

            var smoothScroll = GM_getValue("smoothScroll");

            function addInput(class1, value1, style1) {
                $(document.querySelector("html")).append($('<p>').attr({
                    class: "JqMA-btn-all " + class1,
                    style: style1 + "px !important;"
                }).html(value1));
            }

            addInput('JqMA-btn-del', 'X', leftCss + "top:" + (top));
            addInput('JqMA-btn-width', 'W', leftCss + "top:" + (top - 1 * jianG));
            addInput('JqMA-btn-pic', 'P', leftCss + "top:" + (top - 2 * jianG));
            addInput('JqMA-btn-down', '▽', leftCss + "top:" + (top - 3 * jianG));
            addInput('JqMA-btn-up', '△', leftCss + "top:" + (top - 4 * jianG));
            addInput('JqMA-btn-scrollDiv', "O", leftCss + "top:" + (top - 5 * jianG));
            addInput('JqMA-btn-search', "S", leftCss + "top:" + (top - 6 * jianG));

            addInput('JqMA-btn-transform', "T", leftCss + "top:" + (top + jianG));
            addInput('JqMA-btn-blank', 'B', leftCss + "top:" + (top + 3 * jianG));
            addInput('JqMA-btn-next', "N", leftCss + "top:" + (top + 4 * jianG));
            addInput('JqMA-btn-picwh', picwh, leftCss + "top:" + (top + 5 * jianG));
            addInput('JqMA-btn-outerSz', outerSz, leftCss + "top:" + (top + 6 * jianG));

            addInput('JqMA-btn-Ju', (smoothScroll ? "`" : "") + scrollJu, leftCss + "top:" + (top + 2 * jianG));

            dqSlt(".JqMA-btn-picwh").each(function() {
                this.style.setProperty("color", DSImg ? "green" : null, "important");
            });

            function addInner() {
                if (!dqSlt(".JqMA-mark-pageNext").length) {
                    $(document.querySelector("body")).prepend($("<p>").attr({
                        class: "JqMA-mark-pageNext"
                    }));
                }
            }

            if (GM_getValue("Dhide") === null) GM_setValue("Dhide", 1);

            var Dhide = locHost() == GM_getValue("Dhide_locH") ?
                GM_getValue("Dhide") : 1;

            setTimeout(function() {

                firstRun();

                Dtransform && autoScrollBy(0.5 * winHeight);

                Dhide && delHide();

            }, 10);

            $(document.querySelector("head:not(.JqMA-mark-addStyle)")).append(
                $("<style>").html(html_style + inner_style + css_style)
            ).addClass("JqMA-mark-addStyle");

            addInner();

            var _timeTouch;

            function touchRun() {
                clearTimeout(_timeTouch);

                _timeTouch = setTimeout(function() {
                    firstRun();
                    for (var i = 0; i < 20; i++) {
                        setTimeout(function() {
                            clearTimeout(_timeTouch);
                        }, i * 100);
                    }
                }, 300);
            }

            function firstRun() {

                dqSlt("head:not(.JqMA-mark-addStyle)").append(
                    $("<style>").html(css_style)
                ).addClass("JqMA-mark-addStyle");

                $(document.querySelector("body")).append(document.querySelectorAll(
                    "html > *:not(head,.JqMA-btn-all,#pagetual-picker)"
                )).filter(function() {
                    return $(this).css("overflow-y") == "hidden";
                }).addClass("JqMA-css-yScroll");

                dqSlt(":not(.JqMA-mark-backImg)").filter(function() {
                    return $(this).css("background-image").split(/[""'']/).length > 1;
                }).addClass("JqMA-mark-backImg");

                fontInterFn();

                imgInterFn();

                transformFunc();

                !Dhide && xiuTan();

                aOpenBlank();

                if (Drotate && !dqSlt(".JqMA-css-rotate").length) {
                    Drotate = 0;
                    dqSlt(".JqMA-btn-search").first().trigger("click");
                }
                dqSlt("html:not(.JqMA-mark-htmlFunc)").on("touchend", function() {
                    touchRun();
                }).on('click', function(event) {
                    var _target = $(event.target);

                    if (_target.is("a,a *")) {
                        return;
                    }
                    var direction = scrollJu < 0 ? -1 : 1;

                    if (_target.is(".JqMA-css-textBig,.JqMA-css-textBig *,:has(.JqMA-css-textBig)")) {
                        autoScrollBy(direction * 0.93 * (Drotate ? winWidth : winHeight));
                    } else if (_target.is(".JqMA-inner-pic *") ||
                        (_target.is("img,picture,.JqMA-mark-backImg,:has(img,picture,.JqMA-mark-backImg)") &&
                            _target.outerWidth() > 0.2 * winWidth)) {
                        autoScrollBy(direction * 0.45 * (Drotate ? winWidth : winHeight));
                    }
                }).on("touchstart", ":not(.JqMA-btn-move)", function() {
                    if (Dscroll) {
                        dqSlt(".JqMA-btn-Ju").first().trigger("click");

                        pauseScroll = 1;
                    }
                }).on("touchend", function() {
                    stopPause();
                }).addClass("JqMA-mark-htmlFunc");
            }

            $.fn.slideScreen = function(_target, fn, trsTime) {
                var timeout_1;
                $(this).on('touchmove', _target, function(event) {
                    clearTimeout(timeout_1)

                    timeout_1 = setTimeout(function() {
                        fn(event);
                    }, trsTime || 500);
                });
            }

            $.fn.longPress = function(_target, fn, trsTime) {
                var timeout_2;
                $(this).on('touchstart', _target, function(event) {
                    timeout_2 = setTimeout(function() {
                        fn(event);
                    }, trsTime || 500);
                }).on('touchend', _target, function(event) {
                    clearTimeout(timeout_2)
                });
            }

            if (GM_getValue("scrollDiv") === null) GM_setValue("scrollDiv", 0);

            var scrollDiv = locHost() == GM_getValue("scrollDiv_locH") ?
                GM_getValue("scrollDiv") : 0;

            scrollDiv && dqSlt(".JqMA-btn-scrollDiv").each(function() {
                this.style.setProperty("color", "green", "important");
            });

            dqSlt("html").on('click', '.JqMA-btn-scrollDiv', function() {
                scrollDiv = scrollDiv ? 0 : 1;

                dqSlt(".JqMA-btn-scrollDiv").each(function() {
                    this.style.setProperty("color", scrollDiv ? "green" : null, "important");
                });
                GM_setValue("scrollDiv", scrollDiv);
                GM_setValue("scrollDiv_locH", locHost());
            }).slideScreen('.JqMA-btn-scrollDiv', function() {
                removeShadowRoot();
            });

            dqSlt("html").on('click', '.JqMA-btn-next', function() {
                pageNextFunc("down");
            }).slideScreen('.JqMA-btn-next', function() {
                pageNextFunc("up");
            });
            dqSlt("html").longPress('.JqMA-btn-next', function() {
                var inputNum = prompt("跳转第几个节点:", dqSlt(".JqMA-btn-next").first().text());
                if (Number(inputNum) || inputNum === "0") {
                    var nextNum = Number(inputNum);
                    pageNextFunc(nextNum);
                }
            });

            function pageNextFunc(nextNum) {
                var pageDom = dqSlt("iframe,body,.pagetual_pageBar,.JqMA-mark-pageNext,.JqMA-inner-all"),
                    offsetDiffs = [],
                    minScroll = Drotate ? winWidth : winHeight;
                pageDom.each(function() {
                    var offsetD = -0.1 * minScroll;
                    if (Drotate) {
                        offsetD += $(this).offset().left - $(window).scrollLeft();
                    } else {
                        offsetD += $(this).offset().top - $(window).scrollTop();
                    }
                    if (!/^(up|down)$/.test(nextNum) ||
                        (nextNum == "up" && offsetD < -0.15 * minScroll) ||
                        (nextNum == "down" && offsetD > 0.15 * minScroll)) {
                        offsetDiffs.push(offsetD);
                    }
                });
                if (offsetDiffs.length) {
                    if (!/^(up|down)$/.test(nextNum)) {
                        nextNum = Math.min(nextNum, offsetDiffs.length - 1)
                        autoScrollBy(offsetDiffs[nextNum]);
                        dqSlt(".JqMA-btn-next").html(nextNum);
                    } else {
                        offsetDiffs = offsetDiffs.sort(function(a, b) {
                            return nextNum == "up" ? (b - a) : (a - b);
                        });
                        autoScrollBy(offsetDiffs[0]);
                        dqSlt(".JqMA-btn-next").html(nextNum == "up" ? (offsetDiffs.length - 1) : (pageDom.length - offsetDiffs.length));
                    }
                }
            }

            function transformFunc() {
                dqSlt(".JqMA-btn-transform").each(function() {
                    this.style.setProperty("color", Dtransform ? "green" : null, "important");
                });
                if (!Dtransform) return;
                $(document.querySelector("body")).addClass("JqMA-css-transform");

                dqSlt(":not(.JqMA-css-fixed_hide,head *,link,style,script,noscript,.JqMA-btn-all,#pagetual-picker)").filter(function() {
                    return /sticky|fixed/.test($(this).css("position")) && $(this).outerHeight() < 0.5 * winHeight;
                }).addClass("JqMA-css-fixed_hide");
            }

            if (GM_getValue("Dtransform") === null) GM_setValue("Dtransform", 0);

            var Dtransform = locHost() == GM_getValue("Dtransform_locH") ?
                GM_getValue("Dtransform") : 0;

            dqSlt("html").on('click', '.JqMA-btn-transform', function() {
                Dtransform = Dtransform ? 0 : 1;
                if (Dtransform) {
                    transformFunc();
                } else {
                    dqSlt(".JqMA-css-transform").removeClass("JqMA-css-transform");
                    dqSlt(".JqMA-css-fixed_hide").removeClass("JqMA-css-fixed_hide");
                }
                autoScrollBy((Dtransform ? 0.5 : -0.5) * winHeight);

                GM_setValue("Dtransform", Dtransform);
                GM_setValue("Dtransform_locH", locHost());

            }).slideScreen('.JqMA-btn-transform', function() {
                dqSlt(".JqMA-btn-all").each(function() {
                    this.style.setProperty("display", "none", "important");
                });
                setTimeout(function() {
                    dqSlt("html").on("click.outerSz", function(event) {
                        event.preventDefault();

                        dqSlt("html").off("click.outerSz");

                        dqSlt(".JqMA-btn-all").each(function() {
                            this.style.setProperty("display", "block", "important");
                        });
                        copyToClipboard($(event.target).attr("src"));
                        var inputNum = prompt("请输入图片链接替换(`分隔):", picReplace);
                        if (inputNum == "所有域名") {
                            var resultData = changeDataFunc(picRepData, "");
                            if (resultData)[picRepData, picReplace] = resultData;
                        } else if (typeof inputNum === "string") {
                            picReplace = inputNum;
                            if (picReplace === "") {
                                delete picRepData[locHost()];
                            } else {
                                picRepData[locHost()] = picReplace;
                                if (picZ) {
                                    var _scrollTop = [getScrollTop(), getScrollLeft()];
                                    removePicClass();
                                    imgInterFn();
                                    setTimeout(function() {
                                        autoScrollTo(Drotate ? _scrollTop[1] : _scrollTop[0]);
                                    }, 200);
                                }
                            }
                        }
                        GM_setValue("picRepData", picRepData);
                    });
                }, 100);
            });
            var [picRepData, picReplace] = getDataValue("picRepData", "");

            if (GM_getValue("Drotate") === null) GM_setValue("Drotate", 0);

            var Drotate = locHost() == GM_getValue("Drotate_locH") ?
                GM_getValue("Drotate") : 0;

            dqSlt("html").on('click', '.JqMA-btn-search', function() {

                var _scrollTop = getScrollTop(),
                    _scrollLeft = getScrollLeft();
                autoScrollTo(0);

                Drotate = Drotate ? 0 : 1;
                if (Drotate) {
                    dqSlt("html,body,div").filter(function() {
                        return $(this).css("overflow-y") != "hidden" &&
                            $(this).css("overflow-x") == "hidden" &&
                            $(this).outerHeight() > 0.5 * winHeight;
                    }).addClass("JqMA-css-xScroll");

                    setTimeout(function() {
                        $(document.querySelector('body')).addClass("JqMA-css-rotate");

                        autoScrollTo(_scrollTop * winProp);

                        dqSlt('.JqMA-btn-all').each(function() {
                            $(this).clone().addClass("JqMA-btn-left")
                                .css('margin-left', (winHeight * 1.5) + "px").appendTo(document.querySelector("html"));
                        });
                    }, 100);

                } else {
                    setTimeout(function() {

                        dqSlt(".JqMA-css-rotate").removeClass("JqMA-css-rotate");

                        autoScrollTo(_scrollLeft / winProp);

                        dqSlt(".JqMA-btn-left").remove();
                    }, 100);
                }
                GM_setValue("Drotate", Drotate);
                GM_setValue("Drotate_locH", locHost());
            });

            function getScrollLeft() {
                return $(document.querySelector("html")).scrollLeft() +
                    $(document.querySelector("body")).scrollLeft();

            }

            function getScrollTop() {
                return $(document.querySelector("html")).scrollTop() +
                    $(document.querySelector("body")).scrollTop();

            }

            var pauseScroll = 0,
                Dpause;

            dqSlt(".JqMA-btn-Ju,.JqMA-btn-up").addClass("JqMA-btn-move");

            dqSlt("html").on('click', "a,.JqMA-btn-up", function() {

                if (Dscroll) {
                    dqSlt(".JqMA-btn-Ju").first().trigger("click");
                }
                setTimeout(function() {
                    if (Dscroll) {
                        dqSlt(".JqMA-btn-Ju").first().trigger("click");
                    }
                }, 210);
            });

            function stopPause() {

                if (pauseScroll == 1) {

                    clearTimeout(Dpause);

                    Dpause = setTimeout(function() {

                        pauseScroll = 0;

                        if (!Dscroll) {
                            dqSlt(".JqMA-btn-Ju").first().trigger("click");
                        }
                    }, 200);
                }
            }

            $(document).scroll(function() {

                stopPause();
            });

            function visibleDiv() {
                return dqSlt("div").filter(function() {

                    return $(this).css("display") != "none" &&
                        $(this).css("overflow-y") != "hidden" &&
                        $(this).outerHeight() > 0.5 * winHeight;
                });
            }

            function autoScrollBy(scrollBy_Ju, speed = 0) {

                if (scrollDiv) {

                    visibleDiv().stop().animate({
                        scrollTop: "+=" + scrollBy_Ju + "px"
                    }, speed, "linear");

                } else {
                    if (Drotate) {
                        $(document.querySelectorAll("html,body")).stop().animate({
                            scrollLeft: "+=" + scrollBy_Ju + "px"
                        }, speed, "linear");
                    } else {
                        $(document.querySelectorAll("html,body")).stop().animate({
                            scrollTop: "+=" + scrollBy_Ju + "px"
                        }, speed, "linear");
                    }
                }
            }

            function autoScrollTo(scrollTo_Ju, speed = 0) {

                if (scrollDiv) {

                    visibleDiv().stop().animate({
                        scrollTop: scrollTo_Ju
                    }, speed, "linear");

                } else {
                    if (Drotate) {
                        $(document.querySelectorAll("html,body")).stop().animate({
                            scrollLeft: scrollTo_Ju
                        }, speed, "linear");
                    } else {
                        $(document.querySelectorAll("html,body")).stop().animate({
                            scrollTop: scrollTo_Ju
                        }, speed, "linear");
                    }
                }
            }

            function downloadTxt(filename, textContent) {
                var objectURL = URL.createObjectURL(new Blob([textContent], {
                    type: "text/plain;charset=utf-8"
                }));
                $('<a>').attr({
                    href: objectURL,
                    download: filename,
                    style: 'display:none!important;'
                }).appendTo('body')[0].click();
            }

            function fontInterFn() {
                dqSlt(".JqMA-btn-width").html(widthN ? widthN : "W");
                if (!widthN) return;
                dqSlt(":not(.JqMA-mark-textBig,head *,link,style,script,noscript,.JqMA-inner-pic *,.JqMA-btn-all,#pagetual-picker *)").filter(function() {
                    var textLen = $(this).clone().children().remove().end().text()
                        .replace(/\s+/g, "").length;
                    if (textLen > 0 && (outerSz < 0.15 || ($(this).css("display") != "none" && $(this).outerWidth() > (outerSz - 0.1) * winWidth))) {
                        if (!oldFont && textLen > 50) {
                            oldFont = parseInt($(this).css("font-size").replace("px", ""));
                        }
                        return true;
                    }
                    return false;
                }).addClass("JqMA-css-textBig").attr("style", function(index, curValue) {
                    return curValue + ";font-size:" + widthN + "px !important;";
                });
                var _scale = oldFont ? parseInt(widthN / oldFont * 1000) / 1000 : 1;
                dqSlt(".JqMA-css-textBig").find("em:not(.JqMA-css-textBig,.JqMA-css-textImg),img:not(.JqMA-css-textImg)").filter(function() {
                    return $(this).is("img,.JqMA-mark-backImg") &&
                        $(this).outerWidth() < 0.1 * winWidth;
                }).addClass("JqMA-css-textImg").attr("style", function(index, curValue) {
                    return curValue +
                        ";transform: scale(" + _scale + ") !important;" +
                        "-webkit-transform: scale(" + _scale + ") !important;" +
                        "-moz-transform: scale(" + _scale + ") !important;" +
                        "margin: 0 " + (_scale * 9 - 9) + "px !important;"
                });
            }

            function removeTextClass() {
                dqSlt(".JqMA-css-textBig").removeClass("JqMA-css-textBig").attr("style", function(index, curValue) {
                    return curValue + ";font-size: inherit !important;";
                });
                dqSlt(".JqMA-css-textImg").removeClass("JqMA-css-textImg").attr("style", function(index, curValue) {
                    return curValue +
                        ";transform: scale(1) !important;" +
                        "-webkit-transform: scale(1) !important;" +
                        "-moz-transform: scale(1) !important;" +
                        "margin: 0 !important;";
                });
            }

            if (GM_getValue("widthN") === null) GM_setValue("widthN", 0);

            var widthN = locHost() == GM_getValue("widthN_locH") ?
                GM_getValue("widthN") : 0;

            var oldFont;

            dqSlt("html").on('click', '.JqMA-btn-width', function() {
                var inputNum = prompt("请输入字体大小:", widthN ? widthN : 30);
                widthN = Number(inputNum) ? Number(inputNum) : 0;

                removeTextClass();
                fontInterFn();
                GM_setValue("widthN", widthN);
                GM_setValue("widthN_locH", locHost());

            }).slideScreen('.JqMA-btn-width', function() {
                var innerWordLen = dqSlt(".JqMA-inner-word").length;
                dqSlt('.JqMA-btn-width').each(function() {
                    this.style.setProperty("color", innerWordLen ? null : "green", "important");
                });
                if (innerWordLen) {
                    dqSlt(".JqMA-inner-word").remove();

                    window.speechSynthesis.cancel();
                } else {
                    var allStr = "";
                    dqSlt(":not(head *,link,style,script,noscript)").each(function() {
                        if ($(this).css("display") != "none") {
                            var addStr = $(this).clone().children().remove().end().text();
                            if (addStr.replace(/[一-鿯]/g, "aa").replace(/[^A-Za-z]/g, "").length > 8) {
                                addStr += "<br><br>";
                            }
                            allStr += addStr + " ";
                        }
                    });
                    allStr = allStr.replace(/\s+/g, " ");

                    addInner();

                    $(document.querySelector("body")).prepend($("<p>").attr({
                        class: "JqMA-inner-word JqMA-inner-all"
                    }).html(allStr));
                    if (window.confirm('是否朗读?(插件浏览器有效,取消进入下载)')) {
                        window.speechSynthesis.cancel();
                        var allStrlist = allStr.replace(/<br><br>/g, "\n").split(/([\s\S]{100,400}?[…~;—。!?!?]|[\s\S]{400}[,,\s])/);
                        for (var i = 0; i < allStrlist.length; i++) {
                            if (allStrlist[i].length > 0) {
                                var utterThis = new SpeechSynthesisUtterance(allStrlist[i]);
                                window.speechSynthesis.speak(utterThis);
                            }
                        }
                    } else {
                        downloadTxt(document.title.replace(/[\/:*?""<>|]+/g, " ").trim() + ".txt", allStr.replace(/<br><br>/g, "\n\n"));
                    }
                }
            });

            function picSizeOut(_this, picwh_2 = null) {

                var natureW = _this.naturalWidth;

                var natureH = _this.naturalHeight;

                if (!picwh_2) {
                    picwh_2 = picwh;
                }
                return natureW >= picwh_2 && natureH >= picwh_2 &&
                    natureW / natureH <= 6;
            }

            function formatStr(Istr) {
                var newI = getTrim(Istr);
                if (/%[0-9a-f]{2}/i.test(newI)) {
                    try {
                        newI = decodeURIComponent(newI);
                        newI = decodeURI(newI);
                        newI = unescape(newI);
                    } catch (error) {
                        console.log(error);
                    }
                }
                return newI.replace(/&amp;/g, "&").replace(/\\[/]/g, "/");
            }

            function xiuTan() {

                if (!document.querySelector(".JqMA-btn-hrefAll")) {
                    $(document.querySelector("html")).append($("<p>").attr({
                        class: "JqMA-btn-all JqMA-btn-hrefAll",
                        style: "background: none !important; overflow: scroll !important; height: auto !important; max-height:" + 0.11 * winHeight + "px !important; width: " + 0.4 * winWidth + "px !important; bottom: 4px !important; right: 0 !important;"
                    }).append($("<span>").attr({
                        class: "JqMA-btn-all",
                        style: "margin-left: auto !important; height: 12px !important; line-height: 12px !important; color: red !important; text-align: left !important; position: static !important;"
                    }).html("————")).append($("<span>").attr({
                        class: "JqMA-btn-all",
                        style: "margin-left: auto !important; height: 12px !important; line-height: 12px !important; color: red !important; text-align: left !important; position: static !important;"
                    }).html("————")));
                }
                var preMatches = [];
                $(document.querySelectorAll(".JqMA-btn-hrefAll a")).each(function() {
                    preMatches.push(this.getAttribute("href"));
                });
                var pageSource = "";
                dqSlt("html").each(function() {
                    pageSource += this.outerHTML;
                });
                var regex_2 = /<(video|source|iframe)[^<>]*? src=[""''][^""'']*?(?=[""''])|https?[:%][^''""<>\s]*?\.(avi|mp4|mov|m4v|m3u8|wmv|flv|f4v|webm)([?!/&%](?!quot;)[^''""<>\s]*?)?(?=[''""<>\s一-鿯]|https?[:%]|&quot;|$)/gi;

                var matches = pageSource.match(regex_2);

                if (matches == null) matches = [];

                window.performance.getEntries().forEach(function(entry) {
                    if (/\.(avi|m3u8|mp4|mov|m4v|wmv|flv|f4v|webm)([?!/&%]|$)/.test(entry.name)) {
                        matches.push(entry.name);
                    }
                });
                matches = Array.from(new Set(matches));
                var newI,
                    newMatches = [];
                for (var i = 0; i < matches.length; i++) {

                    newI = formatStr(matches[i].replace(/.* src=[""'']/g, ""));
                    newMatches.push(newI);
                    if (/^(?!blob:http).+https?[:%]/.test(newI)) {
                        newMatches.push(newI.replace(/^.*(?=https?[:%])/, "").replace(/^([^?]+?)&.*$/, "$1"));
                    }
                }
                for (var i = 0; i < newMatches.length; i++) {

                    newI = newMatches[i];

                    if (preMatches.indexOf(newI) > -1 || newI.length < 1 || /^blob:http/.test(newI)) {
                        continue
                    }
                    preMatches.push(newI);

                    $(document.querySelector(".JqMA-btn-hrefAll span")).first().after($("<a>").attr({
                        href: newI,
                        class: "JqMA-btn-all JqMA-btn-href",
                        style: "text-align: left !important; position: static !important; width: " + 0.4 * winWidth + "px !important;"
                    }).html(newI.replace(/\/(?=$|\?)/g, "").replace(/^.*[/]/, "")));
                }
            }

            dqSlt("html").on('click', ".JqMA-btn-outerSz", function() {
                dqSlt(".JqMA-btn-all").each(function() {
                    this.style.setProperty("display", "none", "important");
                });
                setTimeout(function() {
                    dqSlt("html").on("click.outerSz", function(event) {
                        event.preventDefault();

                        dqSlt("html").off("click.outerSz");

                        dqSlt(".JqMA-btn-all").each(function() {
                            this.style.setProperty("display", "block", "important");
                        });
                        var _targetW = $(event.target).outerWidth() - 1;
                        var inputNum = prompt("请输入过滤宽度(0.1-1,空=0):", parseInt(_targetW / winWidth * 100) / 100);
                        if (inputNum == "所有域名") {
                            var resultData = changeDataFunc(outerSzData, 0.1);
                            if (resultData)[outerSzData, outerSz] = resultData;
                        } else if (inputNum === null) {
                            return;
                        } else {
                            if (inputNum === "") {
                                outerSz = 0;
                            } else if (Number(inputNum) || inputNum === "0") {
                                outerSz = Number(inputNum);
                                if (outerSz <= 0.1) {
                                    outerSz = 0.1;
                                    delete outerSzData[locHost()];
                                }
                            }
                            outerSz != 0.1 && (outerSzData[locHost()] = outerSz);
                        }
                        outerSz_run();
                    });
                }, 100);
            });

            function outerSz_run() {
                if (picZ) {
                    var _scrollTop = [getScrollTop(), getScrollLeft()];
                    removePicClass();
                    imgInterFn();
                    setTimeout(function() {
                        autoScrollTo(Drotate ? _scrollTop[1] : _scrollTop[0]);
                    }, 200);
                }
                if (widthN) {
                    removeTextClass();
                    fontInterFn();
                }
                dqSlt(".JqMA-btn-outerSz").html(outerSz);

                GM_setValue("outerSzData", outerSzData);
            }

            dqSlt("html").on('click', ".JqMA-btn-picwh", function() {
                dqSlt(".JqMA-btn-all").each(function() {
                    this.style.setProperty("display", "none", "important");
                });
                setTimeout(function() {
                    dqSlt("html").on("click.picwh", function(event) {
                        event.preventDefault();

                        dqSlt("html").off("click.picwh");

                        dqSlt(".JqMA-btn-all").each(function() {
                            this.style.setProperty("display", "block", "important");
                        });
                        var _target = $(event.target);
                        if (_target.is(".JqMA-inner-pic img.JqMA-mark-imgLoaded")) {
                            var [_natW, natH] = [_target[0].naturalWidth, _target[0].naturalHeight];
                            var _picwh = (_natW < natH ? _natW : natH) + 1;
                        }
                        var inputNum = prompt("请输入过滤尺寸:", _picwh ? _picwh : 50);
                        if (inputNum == "所有域名") {
                            var resultData = changeDataFunc(picwhData, 50);
                            if (resultData)[picwhData, picwh] = resultData;
                        } else if (Number(inputNum)) {
                            picwh = Number(inputNum) < 50 ? 50 : Number(inputNum);
                        } else if (inputNum === null) {
                            return;
                        }
                        picImgFilter();
                    });
                }, 100);
            }).slideScreen('.JqMA-btn-picwh', function() {
                DSImg = DSImg ? 0 : 1;
                if (DSImg) {
                    delete DSImgData[locHost()];
                } else {
                    DSImgData[locHost()] = DSImg;
                }
                dqSlt(".JqMA-btn-picwh").each(function() {
                    this.style.setProperty("color", DSImg ? "green" : null, "important");
                });
                if (picZ) {
                    var _scrollTop = [getScrollTop(), getScrollLeft()];
                    removePicClass();
                    imgInterFn();
                    setTimeout(function() {
                        autoScrollTo(Drotate ? _scrollTop[1] : _scrollTop[0]);
                    }, 200);
                }
                GM_setValue("DSImgData", DSImgData);
            });

            function picImgFilter() {
                if (picZ) {
                    dqSlt(".JqMA-inner-pic xmp").addClass("JqMA-css-smallPic");

                    dqSlt(".JqMA-inner-pic .JqMA-mark-imgLoaded").filter(function() {
                        return picSizeOut(this);
                    }).closest("picture").each(function() {
                        $(this).nextAll("xmp").slice(0, 2).removeClass("JqMA-css-smallPic");
                    }).removeClass("JqMA-css-smallPic");

                    dqSlt(".JqMA-inner-pic .JqMA-mark-imgLoaded").filter(function() {
                        return !picSizeOut(this);
                    }).closest("picture").addClass("JqMA-css-smallPic");
                }
                dqSlt(".JqMA-btn-picwh").html(picwh);

                if (picwh > 50) {
                    picwhData[locHost()] = picwh;
                } else {
                    delete picwhData[locHost()];
                }
                GM_setValue("picwhData", picwhData);
            }

            dqSlt("html").slideScreen('.JqMA-btn-pic', function() {

                var _scrollTop = [getScrollTop(), getScrollLeft()];

                dqSlt(".JqMA-inner-pic").attr("style", "display:none !important;");

                Drotate || autoScrollBy(9000 * winHeight);

                var i = 0;
                var _timeout = setInterval(function() {
                    autoScrollBy(-winHeight * 3, 200);
                    i++;
                    if (getScrollTop() <= 0.25 * winHeight) {
                        clearInterval(_timeout);
                        if (picZ) {
                            removePicClass();
                            imgInterFn();
                        }
                        setTimeout(function() {
                            autoScrollTo(Drotate ? _scrollTop[1] : _scrollTop[0]);
                        }, 200);
                    }
                }, 205);
            });

            if (GM_getValue("picZ") === null) GM_setValue("picZ", 0);

            var picZ = locHost() == GM_getValue("picZ_locH") ?
                GM_getValue("picZ") : 0;

            dqSlt("html").on('click', ".JqMA-btn-pic", function() {
                picZ = picZ ? 0 : 1;
                if (picZ) {
                    imgInterFn();
                } else {
                    removePicClass();
                }
                GM_setValue("picZ", picZ);
                GM_setValue("picZ_locH", locHost());
            });

            function removePicClass() {
                dqSlt(".JqMA-mark-picSlt").removeClass("JqMA-mark-picSlt");

                dqSlt(".JqMA-inner-pic").remove();

                preImgArr.clear();
                preaArr.clear();

                nextDom = 0;
            }

            function getTrim(_str) {
                try {
                    return _str.trim();
                } catch (error) {
                    return null;
                }
            }

            var preImgArr = new Set(),
                preaArr = new Set(),
                newImgArr,
                nextDom = 0,
                preLen;

            function imgInterFn() {
                dqSlt(".JqMA-btn-pic").each(function() {
                    this.style.setProperty("color", picZ ? "green" : null, "important");
                });
                if (!picZ) return;

                newImgArr = [];
                preLen = 0;
                var _text = dqSlt("html").clone().find("head,link,style,script,noscript").remove().end().text()
                    .match(/https?[:%][^''""<>\s]*?\.(xbm|tif|pjp|jpg|jpeg|tiff|gif|jfif|webp|png|bmp|pjpeg|avif)([?!/&%](?!quot;)[^''""<>\s]*?)?(?=[''""<>\s一-鿯]|https?[:%]|&quot;|$)/gi);

                var picSlt = dqSlt("img:not(picture > *),picture,video,iframe,.JqMA-mark-backImg,.pagetual_pageBar")
                    .not(".JqMA-mark-picSlt,.JqMA-inner-pic *,.JqMA-btn-all")
                    .add("<p class='JqMA-mark-picAdd'>");
                var picSlt_len = picSlt.length;

                picSlt.each(function(inum, dom) {
                    if (inum == 0 || $(this).is(".pagetual_pageBar,iframe")) {
                        nextDom += newImgArr.length - preLen;
                        preLen = newImgArr.length;
                        if (nextDom > 20) {
                            newImgArr.push($('<p class="JqMA-mark-pageNext">'));
                            nextDom = 0;
                        }
                        if ($(this).is(".pagetual_pageBar")) return true;
                    }
                    var _img = $(this),
                        _picStr = null,
                        _imgStr = null,
                        dataObj = [],
                        imgSrcset = null;
                    if (_text && inum == picSlt_len - 1) {
                        dataObj = dataObj.concat(_text);
                    }
                    if (outerSz < 0.05 || (_img.css("display") != "none" &&
                            (_img.outerWidth() > outerSz * winWidth || _img.children("img").outerWidth() > outerSz * winWidth))) {
                        if (_img.is("picture") && !DSImg) {
                            _picStr = $("<picture>");
                            _img.children().each(function() {
                                var _src = this.getAttribute("src"),
                                    _srcset = this.getAttribute("srcset"),
                                    _isImg = $(this).is("img");
                                _picStr.append($(_isImg ? "<img>" : "<source>").attr({
                                    src: _src,
                                    loading: "lazy",
                                    alt: "JU-IMG",
                                    width: "300",
                                    height: "100",
                                    srcset: _srcset
                                }));
                                preImgArr.add(_src);
                                preImgArr.add(_srcset);
                            });
                            if (!preImgArr.has(_picStr.prop("outerHTML"))) {
                                preImgArr.add(_picStr.prop("outerHTML"));
                                newImgArr.push(_picStr);
                            } else {
                                _picStr = null;
                            }
                        }
                        _img.is(".JqMA-mark-backImg") && dataObj.push(_img.css("background-image").split(/[""'']/)[1]);

                        var _attributes = [];
                        _attributes.push(this.attributes);
                        if (_img.is("picture")) {
                            _img.children().each(function() {
                                _attributes.push(this.attributes);
                            });
                        }
                        _attributes.forEach(function(attrs) {
                            $.each(attrs, function(index, item) {
                                if (/^(src|poster|srcset)$/i.test(item.name)) {
                                    dataObj.push(item.value);
                                } else if (DSImg && typeof item.value === "string") {
                                    if (/[""'']|&quot;/.test(item.value)) {
                                        var _isp = item.value.split(/[""'']|&quot;/).filter(function(j) {
                                            return /^https?[:%]/.test(getTrim(j));
                                        });
                                        _isp.length && (dataObj = dataObj.concat(_isp));
                                    } else if (/^(href)$/i.test(item.name)) {
                                        if (/\.(xbm|tif|pjp|jpg|jpeg|tiff|gif|jfif|webp|png|bmp|pjpeg|avif)([?!/&%]|$)/i.test(item.value)) {
                                            dataObj.push(item.value);
                                        }
                                    } else if (!/^(style|class|id|type|(on|@)(click|load|error))$|^(:)/i.test(item.name)) {
                                        dataObj.push(item.value);
                                    }
                                }
                            });
                        });
                    }
                    dataObj = Array.from(new Set(dataObj));

                    dataObj.forEach(function(i) {
                        if (typeof i != "string") return;
                        i = formatStr(i);
                        if (/^data:image/.test(i)) {
                            i = i.replace(/[^A-Za-z0-9+/=>;]{0,9}$/, "");
                        }
                        if (/^[a-z/]/.test(i) && /[?/&%]/.test(i) &&
                            !/\.(txt)$/.test(i)) {
                            if (!/^https?[:%]/.test(i)) {
                                try {
                                    i = new URL(i, window.location.origin).href;
                                } catch (error) {
                                    console.log(error);
                                }
                            }
                            if (!preImgArr.has(i)) {
                                preImgArr.add(i);
                                var _html;
                                if (/\.(shtml|html|htm)$/.test(i) || _img.is("iframe")) {
                                    _html = "网页";
                                } else if (/\.(avi|m3u8|mp4|mov|m4v|wmv|flv|f4v|webm)([?!/&%]|$)/.test(i)) {
                                    _html = "视频";
                                }
                                if (_html) {
                                    newImgArr.push($("<xmp>").attr({
                                        style: "display:" + (Dhide ? "none" : "inline-block") + " !important;"
                                    }).addClass("JqMA-css-smallPic").append($("<a>").html(_html).attr({
                                        href: i,
                                        style: "color: green !important; background: rgba(0,0,0,0.4) !important;"
                                    })));
                                } else if (/ \d{1,5}[wx](,|$)/.test(i)) {
                                    imgSrcset = i;
                                } else {
                                    var imgSrcset_2 = _img[0].getAttribute("srcset");
                                    _imgStr = $("<picture>").append($("<img>").attr({
                                        src: i,
                                        loading: "lazy",
                                        alt: "JU-IMG",
                                        width: "300",
                                        height: "100",
                                        srcset: imgSrcset_2 ? imgSrcset_2 : (imgSrcset ? imgSrcset : null)
                                    }));
                                    newImgArr.push(_imgStr);
                                }
                            }
                        }
                    });

                    if ((_imgStr || _picStr) && !_img.is(".JqMA-mark-picAdd")) {
                        _img.addClass("JqMA-mark-picSlt");
                        var _a = _img.closest("a").add(_img.find("a")),
                            _img_2 = _img;
                        for (var i = 0; i < _img.parents().length; i++) {
                            if (_a.length) break;
                            _a = _img_2.siblings().find("*").addBack().filter("a");
                            _img_2 = _img_2.parent();
                        }
                        _a = _a.first();
                        var _newA = $("<a>");
                        if (_a.attr("href") && !/^javascript:/.test(_a.attr("href"))) {
                            _newA.attr("href", _a.attr("href"));
                        } else {
                            _a.children(":not(a)").length || _a.append($("<p>").attr({
                                style: "display: none !important;"
                            }));
                            _newA.on("click", function() {
                                _a.children(":not(a)").first().trigger("click");
                            });
                        }
                        var _element = _img[0];
                        var _newA2 = $("<a>").on("click", function() {
                            pageX.unshift([getScrollLeft(), getScrollTop()]);
                            _element.scrollIntoView({
                                "block": "center"
                            });
                        });
                        newImgArr.push($("<xmp>").attr({
                            style: "display:" + (Dhide ? "none" : "inline-block") + " !important;"
                        }).addClass("JqMA-css-smallPic").append(_newA));
                        newImgArr.push($("<xmp>").attr({
                            style: "display:" + (Dhide ? "none" : "inline-block") + " !important;"
                        }).addClass("JqMA-css-smallPic").append(_newA2));
                    }
                });

                if (newImgArr.length > 0) {
                    nextDom += newImgArr.length - preLen;
                    preLen = newImgArr.length;

                    if (!dqSlt(".JqMA-inner-pic").length) {

                        addInner();

                        $(document.querySelector("body")).prepend($("<p>").attr({
                            class: "JqMA-inner-pic JqMA-inner-all"
                        }));
                    }
                    dqSlt(".JqMA-inner-pic").append(newImgArr);

                    dqSlt(".JqMA-inner-pic img:not(.JqMA-mark-imgLoaded)").on("error.imgError", function() {
                        var oldSrc = this.getAttribute("src"),
                            thisSrc = oldSrc;
                        if (/^(?!blob:http).+https?[:%]/.test(oldSrc)) {
                            thisSrc = oldSrc.replace(/^.*(?=https?[:%])/, "").replace(/^([^?]+?)&.*$/, "$1");
                        } else if (/\?/.test(oldSrc)) {
                            thisSrc = oldSrc.replace(/\?.*$/, "");
                        }
                        if (thisSrc != oldSrc && !preImgArr.has(thisSrc)) {
                            preImgArr.add(thisSrc);
                            $(this).attr("src", thisSrc);
                            return;
                        }
                        $(this).closest("picture").attr({
                            style: "display:" + (Dhide ? "none" : "inline-block") + " !important;"
                        }).addClass("JqMA-css-smallPic");
                    });
                    dqSlt(".JqMA-inner-pic img:not(.JqMA-mark-imgLoaded)").on("load", function() {

                        var oldNatureH = this.naturalHeight;
                        var oldNatureW = this.naturalWidth;
                        if (Math.min(oldNatureW, oldNatureH) < 600) {
                            var oldSrc = this.getAttribute("src"),
                                thisSrc = oldSrc,
                                thisSrcList = [];
                            if (picReplace.indexOf("`") != -1) {
                                var picRepArr = picReplace.split("`");
                                for (var i = 0; i < parseInt(picRepArr.length / 2); i++) {
                                    thisSrc = thisSrc.replace(new RegExp(picRepArr[2 * i].replace(/\d/g, "[0-9]"), "g"), picRepArr[2 * i + 1]);
                                }
                            }
                            thisSrc != oldSrc && thisSrcList.push(thisSrc);

                            thisSrc = oldSrc.replace(/-\d{2,4}x\d{2,4}(?=[.-])|(?<=[&?])([wh]=\d{2,4}|[a-z]+=\d{2,4}([^0-9]|%2C)\d{2,4})([^0-9&].*?)?($|&)/g, "").replace(/[?&]$/, "");

                            thisSrc != oldSrc && thisSrcList.push(thisSrc);

                            /^(?!blob:http).+https?[:%]/.test(oldSrc) && thisSrcList.push(oldSrc.replace(/^.*(?=https?[:%])/, "").replace(/^([^?]+?)&.*$/, "$1"));

                            /\?/.test(oldSrc) && thisSrcList.push(oldSrc.replace(/\?.*$/, ""));

                            var _this = this,
                                promiseArray = [];
                            for (var i = 0; i < thisSrcList.length; i++) {
                                thisSrc = thisSrcList[i];
                                if (thisSrc != oldSrc && !preImgArr.has(thisSrc)) {
                                    preImgArr.add(thisSrc);

                                    promiseArray.push(checkImgExists(thisSrc).catch(err => {
                                        console.log(err)
                                    }));
                                }
                            }
                            Promise.all(promiseArray).then(function(data) {
                                for (var i = 0; i < data.length; i++) {
                                    var resH = data[i];
                                    if (resH.naturalHeight > oldNatureH || resH.naturalWidth > oldNatureW) {
                                        $(_this).attr("src", resH.src).removeAttr("srcset");
                                        break;
                                    }
                                }
                            });
                        }
                        $(this).addClass("JqMA-mark-imgLoaded");

                        if (picSizeOut(this)) {
                            $(this).closest("picture").removeClass("JqMA-css-smallPic").nextAll("xmp").slice(0, 2).removeClass("JqMA-css-smallPic");
                        } else {
                            $(this).closest("picture").attr({
                                style: "display:" + (Dhide ? "none" : "inline-block") + " !important;"
                            }).addClass("JqMA-css-smallPic");
                        }
                    });
                }
            }

            var pageX = [];

            dqSlt("html").on('click', '.JqMA-btn-down', function() {

                pageX.unshift([getScrollLeft(), getScrollTop()]);

                var toHs = [];
                $(document.querySelectorAll("body > *:not(link,style,script,noscript)")).each(function() {
                    var toH = -0.5 * (Drotate ? winWidth : winHeight);
                    if (Drotate) {
                        toH += $(this).offset().left - $(window).scrollLeft();
                    } else {
                        toH += $(this).offset().top - $(window).scrollTop();
                    }
                    toH += $(this).outerHeight();
                    toHs.push(toH);
                });
                if (!scrollDiv && toHs.length) {
                    toHs.sort(function(a, b) {
                        return b - a;
                    });
                    autoScrollBy(toHs[0]);
                } else {
                    autoScrollBy(1000 * winHeight);
                }
            }).slideScreen('.JqMA-btn-down,.JqMA-btn-up', function() {

                if (pageX.length) {
                    pageX = uniqueArr(pageX);

                    autoScrollTo(Drotate ? pageX[0][0] : pageX[0][1]);

                    pageX.splice(0, 1);
                }
            });

            dqSlt("html").on('click', '.JqMA-btn-up', function() {

                pageX.unshift([getScrollLeft(), getScrollTop()]);

                if (scrollDiv) {
                    autoScrollBy(-1000 * winHeight);
                    return;
                }

                if (Dtransform) {

                    autoScrollTo(0.5 * winHeight);
                } else {
                    autoScrollTo(0);
                }

            });

            function delHide() {

                dqSlt(".JqMA-btn-all").each(function() {
                    this.style.setProperty("display", "none", "important");
                });
                if (picZ == 1) {
                    dqSlt(".JqMA-inner-pic xmp,.JqMA-css-smallPic").attr("style", function(index, curValue) {
                        return curValue + ";display: none !important;";
                    });
                }
                dqSlt(".JqMA-btn-del").each(function() {
                    this.style.setProperty("opacity", "0.5", "important");
                    this.style.setProperty("display", "block", "important");
                });
            }

            dqSlt("html").on('click', '.JqMA-btn-del', function() {
                Dhide = Dhide ? 0 : 1;
                if (Dhide) {
                    delHide();
                } else {
                    dqSlt(".JqMA-btn-all").each(function() {
                        this.style.setProperty("display", "block", "important");
                        this.style.setProperty("opacity", "1", 'important');
                    });
                    if (picZ == 1) {
                        dqSlt(".JqMA-inner-pic xmp,.JqMA-css-smallPic").attr("style", function(index, curValue) {
                            return curValue + ";display: inline-block !important;";
                        });
                    }
                }
                GM_setValue("Dhide", Dhide);
                GM_setValue("Dhide_locH", locHost());
            }).slideScreen('.JqMA-btn-del', function() {
                document.querySelector("#pagetual-sideController #loadNow").dispatchEvent(new MouseEvent('click'));
            });

            function aOpenBlank() {
                dqSlt(".JqMA-btn-blank").attr("style", function(index, curValue) {
                    return curValue + ";color: " + (openBlank ? "green" : "white") + " !important;";
                });
                if (!openBlank) return;
                dqSlt("a:not(.JqMA-mark-blank)").addClass("JqMA-mark-blank").filter(function() {
                    return !/^javascript:/.test(this.href);
                }).attr("target", "_blank");
            }

            if (GM_getValue("openBlank") === null) GM_setValue("openBlank", 0);

            var openBlank = locHost() == GM_getValue("openBlank_locH") ?
                GM_getValue("openBlank") : 0;

            var aCssSelect;

            dqSlt("html").on('click', '.JqMA-btn-blank', function() {
                openBlank = openBlank ? 0 : 1;
                if (openBlank) {
                    aOpenBlank();
                } else {
                    dqSlt(".JqMA-mark-blank").removeClass("JqMA-mark-blank").attr("target", null);
                }
                GM_setValue("openBlank", openBlank);
                GM_setValue("openBlank_locH", locHost());

            }).slideScreen('.JqMA-btn-blank', function() {
                dqSlt(".JqMA-btn-all").each(function() {
                    this.style.setProperty("display", "none", "important");
                });
                setTimeout(function() {
                    var firstTarget;
                    dqSlt("html").on("click.aCssSelect", function(event) {
                        event.preventDefault();
                        if (!firstTarget) {
                            firstTarget = event.target;
                            return;
                        }
                        var lastTarget = event.target;
                        dqSlt("html").off("click.aCssSelect");

                        dqSlt(".JqMA-btn-all").each(function() {
                            this.style.setProperty("display", "block", "important");
                        });
                        var isInput = $(firstTarget).is("input") ? 1 : 0,
                            first_aCss;
                        aCssSelect = isInput ? "input" : "a";
                        var preIframes = new Set();
                        $(document.querySelectorAll("iframe")).each(function() {
                            preIframes.add(this.getAttribute("src"));
                        });
                        dqSlt(aCssSelect).each(function() {
                            if ($(this).is(firstTarget)) first_aCss = 1;
                            if (first_aCss && this.href && !preIframes.has(this.href)) {
                                preIframes.add(this.href);
                                $(document.querySelector(".JqMA-mark-pageNext:not(.JqMA-inner-pic *)")).before($("<iframe>").attr({
                                    src: this.href,
                                    loading: "lazy",
                                    scrolling: "no",
                                    style: "box-sizing: border-box !important; overflow: hidden !important; width: 100% !important; min-height: " + 1.5 * winHeight + "px !important;"
                                }).on("load", function() {
                                    $(this).contents().length && this.replaceWith(...$(this).contents().find("body"));
                                }));
                            }
                            isInput && $(this).prop("checked", true);
                            if ($(this).is(lastTarget)) return false;
                        });
                    });
                }, 100);
            });

            var Dscroll = 0,
                timeDown;

            dqSlt("html").on('click', '.JqMA-btn-Ju', function() {

                Dscroll += 1;
                clearInterval(timeDown);

                if (Dscroll < 2) {

                    dqSlt(".JqMA-btn-Ju").each(function() {
                        this.style.setProperty("color", "green", "important");
                    });

                    timeDown = setInterval(function() {

                        autoScrollBy(scrollJu * scrollNum, smoothScroll ? 0 : animateTime);

                    }, animateTime + 5);

                } else {
                    Dscroll = 0;

                    dqSlt("html,body").stop();

                    visibleDiv().stop();

                    dqSlt(".JqMA-btn-Ju").each(function() {
                        this.style.setProperty("color", null, "important");
                    });
                }
                GM_setValue("scrollJu", scrollJu);

            }).slideScreen('.JqMA-btn-Ju', function() {

                var inputNum = prompt("请输入滚动速度(以`开头表间隔):", (smoothScroll ? "`" : "") + scrollJu);

                smoothScroll = inputNum.startsWith("`") ? 1 : 0;

                if (Number(inputNum.replace("`", ""))) {

                    scrollJu = Number(inputNum.replace("`", ""));

                    dqSlt(".JqMA-btn-Ju").html((smoothScroll ? "`" : "") + scrollJu);

                    GM_setValue("scrollJu", scrollJu);
                    GM_setValue("smoothScroll", smoothScroll);
                }
            });

        })(this.jQuery);
    },
    100);