您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动滚动,嗅探图片、视频,字体放大,去除广告浮动
当前为
// ==UserScript== // @name 手机助手 // @namespace http://tampermonkey.net/ // @version 9.500.18.18 // @description 自动滚动,嗅探图片、视频,字体放大,去除广告浮动 // @author You // @match *://*/* // @run-at document-start // @require https://code.jquery.com/jquery-3.7.1.min.js // @require https://code.jquery.com/jquery-migrate-3.4.0.min.js // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @license MIT // ==/UserScript== { 'use strict'; let hengPin = screen.orientation.lock; (function($) { if (document.querySelector('.JqMA-btn-all') || window.frames.length != parent.frames.length) { return; } function dqSlt(selectPath, _iframe = "iframe") { if (_iframe === "one") { return $(document.querySelector(selectPath)); } let doms; try { doms = $(selectPath); } catch (error) { doms = $(document.querySelectorAll(selectPath)); } if (_iframe === "iframe") { doms.add($(document.querySelectorAll('iframe')).contents().find(selectPath)); } return doms; } function removeShadowRoot() { let hasShadowRoot; dqSlt("div", "all").each(function() { if (this.shadowRoot) { this.replaceWith(...this.shadowRoot.childNodes); hasShadowRoot = true; } }); alert(hasShadowRoot ? "#shadow-root 已移除" : "#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 getTouchSite(_element, event) { let rect = _element.getBoundingClientRect(); let offsetY = event.touches[0].clientY - rect.top - _element.offsetHeight / 2; let offsetX = event.touches[0].clientX - rect.left - _element.offsetHeight / 2; return [offsetX, offsetY, _element.offsetHeight]; } function getSelector(element) { let path = "", index = 0; while (index < 3 && element && element.nodeType == Node.ELEMENT_NODE) { let 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).join("."); } path = selector + " > " + path; element = element.parentNode; index++; } return path.replace(/[> ]+$/, ""); } function documentCopy(copyText) { var _input = $("<input style='position:fixed!important;clip:rect(0 0 0 0)!important;top: 10px!important;'>").val(copyText).appendTo(document.body); _input[0].select(); document.execCommand('copy'); _input.remove(); } function copyToClipboard(copyText) { try { navigator.clipboard.writeText(copyText).catch(() => { documentCopy(copyText); }); } catch (error) { documentCopy(copyText); } } 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]; } function getDefValue(gmValName, _default) { if (typeof GM_getValue(gmValName) === "undefined") GM_setValue(gmValName, _default); return GM_getValue(gmValName); } let addCss = getDefValue("addCss", ""); let hidePagetual = getDefValue("hidePagetual", 0) GM_registerMenuCommand("1:隐藏按钮 2:隐藏东方 3:添加css", function() { let isHide = dqSlt(".JqMA-btn-del", "one").css("display") == "none"; let inputNum = window.prompt("1:" + (isHide ? "显示" : "隐藏") + "按钮 2:" + (hidePagetual ? "显示" : "隐藏") + "东方按钮 3:添加css", 1); if (inputNum === "1") { if (isHide) { dqSlt(Dhide ? ".JqMA-btn-del" : ".JqMA-btn-all", "all").each(function() { this.style.cssText += "display:block!important;" + (Dhide ? "opacity:0.5!important;" : ""); }); } else { dqSlt(".JqMA-btn-all", "all").each(function() { this.style.cssText += "display:none!important;"; }); } } else if (inputNum === "2") { hidePagetual = hidePagetual ? 0 : 1; GM_setValue("hidePagetual", hidePagetual); location.reload(false); } else if (inputNum === "3") { inputNum = window.prompt("输入css内容:", addCss); if (inputNum !== null) { GM_setValue("addCss", inputNum); location.reload(false); } } }); function changeDataFunc(_data, _default) { var changeData = window.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; } } var html_style = `html,body { overflow-wrap: break-word!important; scroll-behavior: auto!important; min-height: 100vh!important; }`; var inner_style = `.JqMA-inner-all{ position: relative !important; z-index: 2147483646 !important; margin:20vh 0 5vh 0!important; border: 0 !important; padding: 0 !important; width: 100% !important; height: auto !important; background: black !important; display: block !important; } .JqMA-inner-all, .JqMA-inner-word *, .JqMA-inner-pic * { box-sizing: border-box !important; border-radius: 0 !important; float: none !important; opacity: 1 !important; visibility: visible !important; overflow-wrap: break-word !important; filter: none!important; -webkit-filter: none!important; } .JqMA-inner-word, .JqMA-inner-word > p { color: #FEFEFE!important; text-align: left!important; font-size: calc(2.3vh + 2.3vw)!important; text-indent: 0!important; } .JqMA-inner-word > p { width: 100%!important; } .JqMA-inner-pic { text-align: center !important; font: 0 "Fira Sans", sans-serif !important; } .JqMA-inner-word *, .JqMA-inner-pic *{ margin: 0 !important; padding: 0 !important; border: 0 !important; position: static !important; } .JqMA-inner-pic *::before, .JqMA-inner-pic *::after { display: none !important; } .JqMA-inner-pic img { display: inline-block !important; width: 100% !important; height: auto !important; object-fit: contain !important; background: gray !important; } .JqMA-inner-pic > *{ vertical-align: top !important; overflow: hidden !important; } .JqMA-inner-word a, .JqMA-inner-pic a, .JqMA-mark-pageNum { background: none!important; color: #FEFEFE!important; height: calc(2.7vh + 2.7vw)!important; font-size: calc(1.7vh + 1.7vw)!important; line-height: 1.4!important; text-align: center!important; } .JqMA-mark-pageNum { width: 100%!important; } html .JqMA-inner-pic > img + a { margin-top: calc(-5.4vh - 5.4vw)!important; } html .JqMA-inner-pic > img + a + a{ margin-top: calc(-2.7vh - 2.7vw)!important; } .JqMA-inner-pic img.JqMA-css-smallPic { width: 12.5%!important; height: 8vw!important; } .JqMA-inner-pic p > a{ display: inline!important; } .JqMA-inner-word > a{ display: inline-block!important; width: 100%!important; } .JqMA-inner-pic > a { display: inline-block!important; width: 12.5%!important; margin-right: 43.75%!important; margin-left: 43.75%!important; background: rgba(0,0,0,0.2)!important; } .JqMA-inner-pic > a.JqMA-css-smallPic { display: none!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: none!important; text-align: center!important; text-indent: 0!important; line-height: 2.8!important; border-radius: 0!important; user-select: none!important; z-index: 999999999999!important; margin: 0!important; padding: 0!important; border: 0!important; font-weight: bold!important; position: fixed!important; font-size: calc(1.2vh + 1.2vw)!important; height: calc(3.2vh + 3.2vw)!important; width: calc(3.2vh + 3.2vw)!important; } html .JqMA-btn-del { display: block!important; opacity: 0.5!important; } `; var css_style = `.JqMA-mark-pageNext:not(.JqMA-mark-pageNum) { 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,.JqMA-inner-word > p { letter-spacing: normal !important; line-height: normal !important; overflow-wrap: break-word !important; } .JqMA-css-fixed_hide { display: none !important; } .JqMA-css-overY_auto{ overflow-y: auto!important; } .JqMA-css-transform { transform: translate(0%, 0%) !important; padding: 50vh 0!important; height: auto !important; max-height: none !important; }` + addCss; 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;}`; } function locHost() { return window.location.hostname; } function getValLoc(gValName, _default) { if (locHost() == GM_getValue(gValName + "_locH")) { return GM_getValue(gValName, _default); } else { return _default; } } function setValLoc(gValName, value) { GM_setValue(gValName, value); GM_setValue(gValName + "_locH", locHost()); } let scrollJu = Math.abs(getDefValue("scrollJu", 5)); var [DSImgData, DSImg] = getDataValue("DSImgData", 1); let minPicHD = getDefValue("minPicHD", 500); let minPicwh = getDefValue("minPicwh", 100), picwh = getValLoc("picwh", minPicwh); let minOuterSz = getDefValue("minOuterSz", 10), outerSz = getValLoc("outerSz", minOuterSz); let smoothScroll = getDefValue("smoothScroll", 0); var direction = 1; function addInput(class1, value1, style1) { dqSlt("html", "one").append($('<p>').attr({ class: "JqMA-btn-all " + class1 }).text(value1)); inner_style += ".JqMA-btn-all." + class1 + "{" + style1 + "!important;left: 0!important;}"; } addInput('JqMA-btn-del', 'X', "top:calc(50vh - 1.6vh - 1.6vw)"); addInput('JqMA-btn-down', '♢', "top:calc(50vh - 4.8vh - 4.8vw)"); addInput('JqMA-btn-Ju', (smoothScroll ? "`" : "") + scrollJu, "top:calc(50vh - 8vh - 8vw)"); addInput('JqMA-btn-width', "W", "top:calc(50vh - 11.2vh - 11.2vw)"); addInput('JqMA-btn-scrollDiv', 'O', "top:calc(50vh - 14.4vh - 14.4vw)"); // addInput('JqMA-btn-', "", "top:calc(26.9vh - 8.8vw)"); // addInput('JqMA-btn-', "", "top:calc(22.7vh - 10.4vw)"); addInput('JqMA-btn-transform', "T", "top:calc(50vh + 1.6vh + 1.6vw)"); addInput('JqMA-btn-blank ', 'B', "top:calc(50vh + 4.8vh + 4.8vw)"); addInput('JqMA-btn-pic', picwh, "top:calc(50vh + 8vh + 8vw)"); addInput('JqMA-btn-outerSz', outerSz, "top:calc(50vh + 11.2vh + 11.2vw)"); // addInput('JqMA-btn-', "", "top:calc(68.9vh + 7.2vw)"); // addInput('JqMA-btn-', , "top:calc(73.1vh + 8.8vw)"); var Dhide = getValLoc("Dhide", 1); delHide(); setTimeout(function() { widthN && dqSlt(".JqMA-btn-width", "all").text(widthN); picZ && dqSlt(".JqMA-btn-pic", "all").each(function() { this.style.setProperty("color", "green", "important"); }); openBlank && dqSlt(".JqMA-btn-blank", "all").each(function() { this.style.setProperty("color", "green", "important"); }); scrollDiv && dqSlt(".JqMA-btn-scrollDiv", "all").each(function() { this.style.setProperty("color", "green", "important"); }); DSImg && dqSlt(".JqMA-btn-outerSz", "all").each(function() { this.style.setProperty("color", "green", "important"); }); Drotate && dqSlt(".JqMA-btn-blank", "all").text("BF"); if (Dtransform) { applyClearStyle(); dqSlt(".JqMA-btn-transform", "all").each(function() { this.style.setProperty("color", "green", "important"); }); } firstRun(); dqSlt("html", "one").one("touchend", function() { if (Dscroll) { Dscroll = 0; scrollRun(); } }); }, 200); dqSlt("head", "one").append( $("<style>").html(html_style + inner_style + css_style) ).attr("JqMA-mark-addStyle", 1); var _timeTouch; function touchRun() { clearTimeout(_timeTouch); _timeTouch = setTimeout(function() { firstRun(); for (let i = 0; i < 12; i++) { setTimeout(function() { clearTimeout(_timeTouch); }, i * 200); } }, 300); } let oNextScroll; function firstRun() { dqSlt(":not([JqMA-mark-backImg])").each(function() { const $this = $(this); if ($this.css("background-image").split('"').length > 1) { $this.attr("JqMA-mark-backImg", 1); } }); dqSlt("head:not([JqMA-mark-addStyle])").append( $("<style>").html(css_style) ).attr("JqMA-mark-addStyle", 1); if (Drotate && !document.fullscreenElement) { fullScreen(); } widthN && fontInterFn(); if (picZ) { if (scrollPic && !dqSlt(".JqMA-inner-pic", "one").length) { setTimeout(function() { scrollPicLoad(); }, 500); } else { imgInterFn(); } } openBlank && aOpenBlank(); !Dhide && xiuTan(); dqSlt(".JqMA-inner-word", "one").length && innerWordAdd(); if (!oNextScroll && nextScrollTop && document.querySelector("body").offsetHeight > nextScrollTop + window.innerHeight) { autoScrollTo(nextScrollTop); oNextScroll = 1; } dqSlt("body:not(body *,[JqMA-mark-bodyFunc])").on('click', function(event) { if (nextScrollTop) { autoScrollTo(nextScrollTop); return } let _target = $(event.target); if (_target.is("#JqMA-mark-pageNext_1,#JqMA-mark-pageNext_2")) { pageX.unshift(getScrollTop()); document.querySelector("." + _target.attr("id")).scrollIntoView(); } else if (_target.is("a,a *")) { setTimeout(function() { Dscroll && scrollRun(); }, 210); } else if (dqSlt(".JqMA-btn-del", "one").css("display") != "none") { direction = event.clientY < window.innerHeight / 9 ? -1 : 1; if (widthN) { autoScrollBy(direction * 0.9 * window.innerHeight); } else if (_target.is(".JqMA-inner-pic *") || (_target.is("img,[JqMA-mark-backImg],:has(img,[JqMA-mark-backImg])") && getMinOuter(event.target) > 0.2 * window.innerWidth)) { autoScrollBy(direction * (Drotate ? 0.9 : 0.45) * window.innerHeight); } } }).attr("JqMA-mark-bodyFunc", 1); dqSlt("html:not(html *,[JqMA-mark-htmlFunc])").on("touchstart touchmove", function(event) { if (Dscroll && !pauseScroll) { let _target = $(event.target); if (!_target.is(".JqMA-btn-Ju")) { scrollRun(); if (!_target.is(".JqMA-btn-down")) { pauseScroll = true; } } } }).on("touchend", function() { touchRun(); stopPause(); }).attr("JqMA-mark-htmlFunc", 1); } let pauseScroll; function stopPause() { setTimeout(function() { if (pauseScroll) { pauseScroll = false; Dscroll || scrollRun(); } }, 200); } $.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); document.getSelection().removeAllRanges(); }, trsTime || 500); }).on('touchend touchmove', _target, function(event) { clearTimeout(timeout_2) }); } function btnScrollDivClick() { scrollDiv = scrollDiv ? 0 : 1; dqSlt(".JqMA-btn-scrollDiv", "all").each(function() { this.style.setProperty("color", scrollDiv ? "green" : null, "important"); }); setValLoc("scrollDiv", scrollDiv) } var scrollDiv = getValLoc("scrollDiv", 0); dqSlt("html").on('click', '.JqMA-btn-scrollDiv', btnScrollDivClick).slideScreen('.JqMA-btn-scrollDiv', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > thisHeight || offsetY < -thisHeight || offsetX > thisHeight) { removeShadowRoot(); } else { btnScrollDivClick(); } }); dqSlt("html").longPress('.JqMA-btn-scrollDiv', function() { location.reload() }); function btnDownClick() { if (pageX.length) { pageX = Array.from(new Set(pageX)); if (typeof pageX[0] === "number") { autoScrollTo(pageX[0]); } else { pageX[0].scrollIntoView({ "block": "center" }); } pageX.splice(0, 1); dqSlt(".JqMA-btn-down", "all").text("♢"); } } var pageX = []; dqSlt("html").on('click', '.JqMA-btn-down', btnDownClick).slideScreen('.JqMA-btn-down', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > thisHeight * 3) { pageX.unshift(getScrollTop()); if (Dtransform) { autoScrollTo(0.5 * window.innerHeight); } else { autoScrollTo(0); } dqSlt(".JqMA-btn-down", "all").text("♢"); } else if (offsetY < thisHeight * -3 || offsetX > thisHeight * 3) { pageX.unshift(getScrollTop()); if (scrollDiv) { autoScrollBy(999 * window.innerHeight); return; } let toHs = []; $("body > :visible").each(function() { toHs.push([this.getBoundingClientRect().top + this.offsetHeight, this]); }); toHs.sort(function(a, b) { return b[0] - a[0]; }); toHs[0][1].scrollIntoView({ "block": "end" }); dqSlt(".JqMA-btn-down", "all").text("♢"); } else if (offsetY > thisHeight) { pageNextFunc("up"); } else if (offsetY < -thisHeight || offsetX > thisHeight) { pageNextFunc("down"); } else { btnDownClick(); } }); dqSlt("html").longPress('.JqMA-btn-down', function() { let menuNum = window.prompt("1:跳转节点 2:保存位置", 1); if (menuNum === "1") { let inputNum = window.prompt("跳转第几个节点:", dqSlt(".JqMA-btn-next", "one").text()); if (Number(inputNum) || inputNum === "0") { let nextNum = Number(inputNum); pageNextFunc(nextNum); } } else if (menuNum === "2") { let inputNum = window.prompt("是否保存滚动位置?(取消关闭)", parseInt(getScrollTop())); if (inputNum === null) { nextScrollTop = 0; } else { nextScrollTop = Number(inputNum) } setValLoc("nextScrollTop", nextScrollTop); } }); function pageNextFunc(nextNum) { pageX.unshift(getScrollTop()); let pageDom = dqSlt(".pagetual_pageBar,.JqMA-mark-pageNext,.JqMA-inner-all,.JqMA-inner-all > :visible:last,.JqMA-inner-word > p[style*=rgb]", "all"), offsetDiffs = []; if (nextNum >= pageDom.length) { pageDom.last()[0].scrollIntoView(); dqSlt(".JqMA-btn-down", "all").text(pageDom.length - 1); } $(nextNum == "up" ? pageDom.get().reverse() : pageDom).each(function(index, dom) { let offsetD = this.getBoundingClientRect().top; if (nextNum == index || (nextNum == "up" && offsetD < -0.25 * window.innerHeight) || (nextNum == "down" && offsetD > 0.25 * window.innerHeight)) { this.scrollIntoView(); dqSlt(".JqMA-btn-down", "all").text(nextNum == "up" ? pageDom.length - index - 1 : index); return false; } }); } let clearStyle = document.createElement('style'); clearStyle.type = 'text/css'; function applyClearStyle() { clearStyle.innerHTML = `html { overflow-y: auto!important; } body { transform: translate(0%, 0%) !important; padding: 50vh 0!important; height: auto !important; max-height: none !important; } [JqMA-css-fixed_hide] { display: none !important; }`; document.head.appendChild(clearStyle); setTimeout(function() { let elements = document.querySelectorAll(':not(.JqMA-btn-all)'); for (let i = 0; i < elements.length; i++) { const _this = elements[i]; const style = window.getComputedStyle(_this); if (/sticky|fixed/.test(style.position) && _this.offsetHeight < 0.5 * window.innerHeight) { _this.setAttribute("JqMA-css-fixed_hide", "1"); } } }, 400); } var Dtransform = getValLoc("Dtransform", 0); function btnTransfClick() { Dtransform = Dtransform ? 0 : 1; dqSlt(".JqMA-btn-transform", "all").each(function() { this.style.setProperty("color", Dtransform ? "green" : null, "important"); }); if (Dtransform) { applyClearStyle(); } else { document.head.removeChild(clearStyle); } autoScrollBy((Dtransform ? 0.5 : -0.5) * window.innerHeight, 0, 0); setValLoc("Dtransform", Dtransform); } dqSlt("html").on('click', '.JqMA-btn-transform', btnTransfClick); dqSlt("html").slideScreen('.JqMA-btn-transform', function() { btnTransfClick(); }); dqSlt("html").longPress('.JqMA-btn-transform', function() { alert(`O: ==点击:切换滚动对象 ==滑动:移除#shadow-root ==长按:刷新页面 W: ==点击:输入字体大小 ==滑动:上加下减 ==长按:朗读或下载文字 5: ==点击:启动/停止滚动 ==滑动:上加下减 ==长按:输入滚动速度 ♢: ==点击:回上一位置 ==短滑:上/下:下/上一节点 ==长滑:上/下:到底/顶部 ==长按:记录本域名滚动位置 X: ==点击:隐藏/显示其他按钮 ==滑动:触发 立即翻页 按钮 ==长按:自动点击下一页 T: ==点击:元素取消浮动 ==长按:显示操作清单 B: ==点击:切换a链接打开方式 ==滑动:点击2个a链接,加载页面 ==长按:横屏全屏,返回键退出 120: ==点击:开关页首图片集 ==短滑:上加下减 ==长滑:点击图片,修改过滤尺寸 ==长按:点击图片,输入替换规则 10: ==点击:点击元素,修改过滤尺寸 ==短滑:上加下减 ==长滑:滚动加载图片集 ==长按:开关深度搜索`); }); var [picRepData, picReplace] = getDataValue("picRepData", ""); function getScrollTop() { let maxTop = 0; visibleDiv().each(function() { maxTop = Math.max(maxTop, this.scrollTop); }); return maxTop; } function visibleDiv(scDiv = null) { scDiv = scDiv === null ? scrollDiv : scDiv; let visDiv = dqSlt("html,body", "all"); scDiv && $(":visible:not(html,body)").each(function() { if ($(this).css("overflow-y") != "hidden" && this.offsetHeight > 0.5 * window.innerHeight && this.scrollHeight > this.offsetHeight + 0.5 * window.innerHeight) { visDiv = $(this); return false; } }); return visDiv; } function xScrollDiv() { return $(":visible:not(html,body)").filter(function() { return $(this).css("overflow-x") != "hidden" && this.offsetWidth > 0.5 * window.innerWidth && this.scrollWidth > this.offsetWidth + 0.5 * window.innerWidth; }); } function visibleDiv_js() { let visDiv = [document.documentElement, document.body]; let elements = document.querySelectorAll(":not(html,body)"); for (let i = 0; i < elements.length; i++) { let element = elements[i]; if (window.getComputedStyle(element).overflowY !== "hidden" && element.offsetHeight > 0.5 * window.innerHeight && element.scrollHeight > element.offsetHeight + 0.5 * window.innerHeight) { visDiv.push(element); break; // 使用 break 来中断循环 } } return visDiv; } function autoScroll_js(scrollBy, _by) { const visDiv = visibleDiv_js(); for (let i = 0; i < visDiv.length; i++) { const element = visDiv[i]; const oldScrollTop = element.scrollTop; if (_by === "by") { element.scrollTop += scrollBy; } else { element.scrollTop = scrollBy; } if (element.scrollTop > oldScrollTop) { break; } } } function autoScrollBy(scrollBy_Ju, speed = 0, scDiv = null) { if (speed === 0) { autoScroll_js(scrollBy_Ju, "by"); return; } visibleDiv(scDiv).stop().animate({ scrollTop: "+=" + scrollBy_Ju + "px" }, speed, "linear"); } function autoScrollTo(scrollTo_Ju, speed = 0) { if (speed === 0) { autoScroll_js(scrollTo_Ju, "to"); return; } visibleDiv().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(); setTimeout(function() { URL.revokeObjectURL(objectURL); }, 2000); } function changeStyle(_id, _style) { dqSlt("head").filter(function() { return !$(this).find("style#" + _id).length; }).append($("<style id='" + _id + "'>")); dqSlt("style#" + _id).filter(function() { return $(this).html() != _style; }).html(_style); } let defWidthN = getDefValue("defWidthN", 30); function fontInterFn() { dqSlt(":not([JqMA-css-textBig], .JqMA-inner-pic *, .JqMA-btn-all, #pagetual-picker *)").each(function() { const $this = $(this); const textLen = $this.clone().children().remove().end().text() .replace(/\s+/g, "").length; if (textLen > 0 && (outerSz < minOuterSz + 1 || getPercentW(this) >= outerSz)) { $this.attr("JqMA-css-textBig", 1); } }); changeStyle("JqMA-css-textBig", "html body [JqMA-css-textBig] {font-size:" + widthN + "px!important;}"); } function removeTextClass() { dqSlt("[JqMA-css-textBig]").removeAttr("JqMA-css-textBig"); } function btnWidthClick() { let inputNum = window.prompt("请输入字体大小:(@=修改默认)", widthN ? widthN : defWidthN); if (inputNum === "@") { inputNum = window.prompt("请修改默认字体大小:", defWidthN); defWidthN = Number(inputNum) ? Number(inputNum) : 30; GM_setValue("defWidthN", defWidthN); return; } widthN = Number(inputNum) ? Number(inputNum) : 0; widthNFunc(); } function widthNFunc() { if (widthN > 0) { fontInterFn(); } else { widthN = 0; removeTextClass(); } dqSlt(".JqMA-btn-width", "all").text(widthN ? widthN : "W"); setValLoc("widthN", widthN); } var widthN = getValLoc("widthN", 0); dqSlt("html").on('click', '.JqMA-btn-width', btnWidthClick).slideScreen('.JqMA-btn-width', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > 3 * thisHeight || offsetY < -3 * thisHeight || offsetX > 3 * thisHeight) { readPause(); } else if (offsetY > thisHeight) { widthN -= 1; } else if (offsetY < -thisHeight || offsetX > thisHeight) { widthN += 1; } else { btnWidthClick(); return; } widthNFunc(); }); let speakRate = getDefValue("speakRate", 1); function readStr() { window.speechSynthesis.cancel(); let wordP = dqSlt(".JqMA-inner-word > p", "all"); for (let i = currentStr; i < wordP.length; i++) { let utterThis = new SpeechSynthesisUtterance(); utterThis.text = wordP.eq(i).text(); utterThis.rate = speakRate; utterThis.volume = 1.0; window.speechSynthesis.speak(utterThis); utterThis.onstart = function() { currentStr = i; wordP.removeAttr("style").eq(currentStr).attr("style", "background:rgb(0,50,64)!important;"); innerWordAdd(); let pLen = dqSlt(".JqMA-inner-word > p", "all").length; if (currentStr > pLen - 9) { pageX.unshift(getScrollTop()); autoScrollBy(9999 * window.innerHeight, 400); setTimeout(function() { btnDownClick(); }, 400); } if (wordP.length < pLen) { readStr(); } } } } function getText(_this) { return $(_this).clone().find("style,script,noscript").remove().end().text(); } function readPause() { try { new SpeechSynthesisUtterance(); } catch (error) { alert("浏览器不支持JS朗读!"); return; } let readbtn = dqSlt(".JqMA-inner-word > a:eq(1)", "all"); if (readbtn.text() == "暂停") { readbtn.text("朗读"); window.speechSynthesis.cancel(); } else { readbtn.text("暂停"); readStr(); } } function innerWordAdd() { let allStr = ""; dqSlt(textSlt).not("[JqMA-mark-word]").each(function() { allStr += getText(this) + " "; }).attr("JqMA-mark-word", 1); allStr = allStr.replace(/\s+/g, " "); let allStrlist = allStr.replace(/<\/?br>/g, "\n").split(/(.{1,150}(?:$|[^一-鿯0-9A-Za-z\/,,、]))/); allStrlist = allStrlist.filter((s) => { return s && s.trim(); }); for (let i = 0; i < allStrlist.length; i++) { dqSlt(".JqMA-mark-wordEnd", "one").before($("<p>").html(allStrlist[i].replace("\n", "<br>"))); } } var [textSltData, textSlt] = getDataValue("textSltData", ""); let currentStr = 0; dqSlt("html").longPress('.JqMA-btn-width', function() { let noFirstR; if (dqSlt(".JqMA-inner-word", "one").length) { dqSlt(".JqMA-inner-word", "all").remove(); dqSlt("[JqMA-mark-word]").removeAttr("JqMA-mark-word"); noFirstR = 1; } else { dqSlt('.JqMA-btn-width', "all").each(function() { this.style.setProperty("color", "green", "important"); }); } if (noFirstR || !textSlt.length) { waitClick("off", function(event) { let _target = $(event.target); while (true) { if (_target.is("body") || getText(_target[0]).replace(/\s+/g, "").length > 50) { break; } else { _target = _target.parent(); } } let selector = getSelector(_target[0]); if (noFirstR) { let inputNum = window.prompt(`修改选择器:${selector}`, textSlt.length ? textSlt : selector); if (inputNum == "所有域名") { let resultData = changeDataFunc(textSltData, ""); if (resultData)[textSltData, textSlt] = resultData; } else if (typeof inputNum === "string") { textSlt = inputNum; if (textSlt === "") { delete textSltData[locHost()]; } else { textSltData[locHost()] = textSlt; } } else if (inputNum === null) { return; } } else if (!textSlt.length) { textSlt = selector; textSltData[locHost()] = textSlt; } GM_setValue("textSltData", textSltData); appendWord(); }); } else { appendWord(); } }); function appendWord() { dqSlt("body", "one").prepend($("<p>").attr({ class: "JqMA-inner-word JqMA-inner-all" }).append($("<p class='JqMA-mark-wordEnd'>!阅读结束!</p>"))); innerWordAdd(); dqSlt(".JqMA-inner-word", "all").on("click", "p", function() { if (readbtn.text() == "朗读") return currentStr = $(this).prevAll("p").length; readStr(); }); let readbtn = $("<a>朗读</a>"), downbtn = $("<a>下载</a>"), ratebtn = $(`<a>语速:${speakRate}</a>`); dqSlt(".JqMA-inner-word", "all").prepend(ratebtn).prepend(readbtn).prepend(downbtn); readbtn.click(readPause); ratebtn.click(function() { let inputNum = window.prompt("输入语速:", speakRate); if (inputNum === null) return; speakRate = inputNum; $(this).text("语速:" + speakRate); GM_setValue("speakRate", speakRate); if (readbtn.text() == "朗读") return readStr(); }); downbtn.click(function() { downloadTxt(document.title.replace(/[\/:*?""<>|]+/g, " ").replace(/^\s+|\s+$/g, "") + ".txt", dqSlt(".JqMA-inner-word", "one").clone().children("a").remove().end().text()); }); autoScrollTo(0); } let whProp = getDefValue("whProp", 3.9); function picSizeOut(_this, picwh_2 = null) { let natureW = _this.naturalWidth, natureH = _this.naturalHeight, _targetW = $(_this).attr("img-outerWH") ? $(_this).attr("img-outerWH") : getPercentW(_this); if (!picwh_2) { picwh_2 = picwh; } return Math.min(natureW, natureH) >= picwh_2 && natureW / natureH <= whProp && _targetW >= outerSz; } function formatStr(_url) { if (typeof _url === "string") { return _url.replace(/^\s+|\s+$/g, "").replace(/&/g, "&").replace(/\\u002F/g, "/").replace(/\\[/]/g, "/"); } else { return ""; } } function decodeStr(_url) { let newI = _url; if (/^https?%/.test(newI)) { try { newI = decodeURIComponent(newI); } catch (error) { console.log(error); } } return newI; } function delHttp(_url) { let newI = []; if (/^(?!blob:|data:).+https?[:%]/.test(_url)) { let _urlSpl = _url.split(/.(?=https?[:%])/); for (let i = 1; i < _urlSpl.length; i++) { if (!/\.html(&|$)/.test(_urlSpl[i])) { newI.push(decodeStr(_urlSpl[i].replace(/^([^?]+?)&.*$/, "$1"))); } } } return newI; } var preMatches = []; function xiuTan() { if (!document.querySelector(".JqMA-btn-hrefAll")) { const spanStyle = ".JqMA-btn-hrefSpan {margin-left: auto!important; height: 6px!important; line-height: 6px!important;color:red!important;text-align:center!important;position:static!important;}"; const hrefAllStyle = ".JqMA-btn-hrefAll {background: none!important; overflow: scroll!important; height: auto!important; max-height: calc(4vh + 4vw)!important; width: calc(15vw + 15vh)!important; bottom: 4px!important; right: 0!important;}" const hrefStyle = ".JqMA-btn-href {text-align: left!important; position: static!important; width: 100%!important;}" const spanStr = '<span class="JqMA-btn-all JqMA-btn-hrefSpan">——</span>'; dqSlt("head", "one").append($("<style>").text(spanStyle + hrefAllStyle + hrefStyle)); dqSlt("html", "one").append($("<p class='JqMA-btn-all JqMA-btn-hrefAll'>").append(spanStr).append(spanStr)); } let pageSource = ""; dqSlt("html").each(function() { pageSource += this.outerHTML; }); let videoList = []; dqSlt("iframe").each(function() { let srcDomain; try { srcDomain = new URL(this.src).origin; } catch (error) { console.log(error); } if (srcDomain && srcDomain != window.location.origin) { videoList.push(this.src); } }); dqSlt("video").each(function() { videoList.push(this.currentSrc); }); let regex = /https?[:%][^""<>\s]*?\.(avi|mp4|mov|m4v|m3u8|wmv|flv|f4v|webm)([?!/&%][^""<>\s]*?)?(?=[""<>\s一-鿯]|https?[:%]|$)/gi; let matches = pageSource.replace(/"|['']/g, '"').match(regex); if (matches) videoList.push(...matches); window.performance.getEntries().forEach(function(entry) { if (/\.(avi|m3u8|mp4|mov|m4v|wmv|flv|f4v|webm)([?!/&%]|$)/.test(entry.name)) { videoList.push(entry.name); } }); videoList = Array.from(new Set(videoList)); var newI, newMatches = []; for (let i = 0; i < videoList.length; i++) { newI = formatStr(videoList[i]); if (!newI.replace(/[\s/]/g, "").length || /^(?!https?:)[a-z]{3,15}:/.test(newI)) continue; newMatches.push(newI); let delHtList = delHttp(newI); if (delHtList.length) newMatches.push(...delHtList); } for (let i = 0; i < newMatches.length; i++) { newI = addLocation(decodeStr(newMatches[i])); if (preMatches.indexOf(newI) > -1) continue; preMatches.push(newI); dqSlt(".JqMA-btn-hrefAll span", "one").after($("<a>").attr({ href: newI, class: "JqMA-btn-all JqMA-btn-href" }).text(newI.replace(/\/(?=$|\?)/g, "").replace(/^[^?]*[/]/, "").replace(/(?<=[^?/.]{9})[^?/.]+/, ""))); } } function getMinOuter(_this) { return Math.min(_this.offsetWidth, _this.offsetHeight); } function getMinPicwh(_this) { return Math.min(_this.naturalWidth, _this.naturalHeight); } function getPercentW(_this) { return parseInt(_this.offsetWidth / window.innerWidth * 100); } function waitClick(offClick, afterFunc) { dqSlt(".JqMA-btn-all", "all").each(function() { this.style.setProperty("display", "none", "important"); }); setTimeout(function() { dqSlt("body:not(body *)").on("click.tempClickFunc", function(event) { event.preventDefault(); if (offClick === "off") { dqSlt("body").off("click.tempClickFunc"); dqSlt(".JqMA-btn-all", "all").each(function() { this.style.setProperty("display", "block", "important"); }); } afterFunc(event); }); }, 100); } function btnOuterSzClick() { waitClick("off", function(event) { let _this = $(event.target); let _targetW = _this.attr("img-outerWH") ? _this.attr("img-outerWH") : getPercentW(event.target); let inputNum = window.prompt("请输入过滤尺寸:", _targetW - 5); if (Number(inputNum) || inputNum === "0") { outerSz = Number(inputNum); if (outerSz < minOuterSz) outerSz = minOuterSz; outerSz_run(); } }); } dqSlt("html").on('click', ".JqMA-btn-outerSz", btnOuterSzClick).slideScreen('.JqMA-btn-outerSz', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > thisHeight * 3 || offsetY < thisHeight * -3 || offsetX > thisHeight * 3) { scrollPic = scrollPic ? 0 : 1; setValLoc("scrollPic", scrollPic); scrollPic && scrollPicLoad(); } else if (offsetY > thisHeight) { if (minOuterSz < outerSz && outerSz < minOuterSz + 10) { outerSz = minOuterSz; } else if (outerSz <= 1) { outerSz = 0; } else if (outerSz <= minOuterSz) { outerSz = 1; } else { outerSz -= 10; } } else if (offsetY < -thisHeight || offsetX > thisHeight) { if (outerSz === 0) { outerSz = 1; } else if (outerSz === 1) { outerSz = minOuterSz; } else { outerSz += 10; } } else { btnOuterSzClick(); } outerSz_run(); }); function outerSz_run() { if (outerSz < 0) outerSz = 0; if (picZ) { if (outerSz === 0) { let _scrollTop = getScrollTop(); removePicClass(); imgInterFn(); setTimeout(function() { autoScrollTo(_scrollTop); }, 400); } else { picImgFilter(); } } if (widthN) { removeTextClass(); fontInterFn(); } dqSlt(".JqMA-btn-outerSz", "all").text(outerSz); setValLoc("outerSz", outerSz); } dqSlt("html").longPress('.JqMA-btn-pic', function() { waitClick("off", function(event) { if (event.target.currentSrc && window.confirm("是否复制图片链接?")) copyToClipboard(event.target.currentSrc); setTimeout(function() { var inputNum = window.prompt("请输入图片链接替换(`分隔,@开头:正则且数字->[0-9]):", 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(); removePicClass(); imgInterFn(); setTimeout(function() { autoScrollTo(_scrollTop); }, 400); } } } GM_setValue("picRepData", picRepData); }, 200); }); }); function btnPicwhClick() { waitClick("off", function(event) { let _picwh = $(event.target).is("img") ? getMinPicwh(event.target) + 20 : minPicwh, inputNum = window.prompt("请输入 过滤尺寸:(@ = 修改默认)", _picwh); if (/^\d+$/.test(inputNum)) { picwh = Number(inputNum); if (picwh < minPicwh) picwh = minPicwh; picImgFilter(); } else if (inputNum === "@") { let _whProp = parseInt(event.target.naturalWidth / event.target.naturalHeight * 10) / 10, _targetW = $(event.target).attr("img-outerWH") ? $(event.target).attr("img-outerWH") : getPercentW(event.target); inputNum = window.prompt(`请输入 过滤宽高比,最小过滤尺寸,最小过滤宽度,最大转高清尺寸:(点击元素:${_whProp},${getMinPicwh(event.target)},${_targetW} 推荐:3.9,100,10,500)`, [whProp, minPicwh, minOuterSz, minPicHD]); if (/^[\d.,]+$/.test(inputNum)) { whProp = Number(inputNum.split(",")[0]); minPicwh = Number(inputNum.split(",")[1]); minOuterSz = Number(inputNum.split(",")[2]); minPicHD = Number(inputNum.split(",")[3]); picImgFilter(); GM_setValue("whProp", whProp); GM_setValue("minPicwh", minPicwh); GM_setValue("minOuterSz", minOuterSz); GM_setValue("minPicHD", minPicHD); } } }); } dqSlt("html").longPress('.JqMA-btn-outerSz', function() { DSImg = DSImg ? 0 : 1; dqSlt(".JqMA-btn-outerSz", "all").each(function() { this.style.setProperty("color", DSImg ? "green" : null, "important"); }); if (picZ) { var _scrollTop = getScrollTop(); removePicClass(); imgInterFn(); setTimeout(function() { autoScrollTo(_scrollTop); }, 400); } if (DSImg) { delete DSImgData[locHost()]; } else { DSImgData[locHost()] = DSImg; } GM_setValue("DSImgData", DSImgData); }); function picImgFilter() { if (picwh < 0) picwh = 0; if (picZ) { dqSlt(".JqMA-inner-pic > a", "all").addClass("JqMA-css-smallPic"); dqSlt(".JqMA-inner-pic .JqMA-mark-imgLoaded", "all").each(function() { if (picSizeOut(this)) { $(this).nextAll("a:lt(2)").add(this).removeClass("JqMA-css-smallPic"); } else { $(this).addClass("JqMA-css-smallPic"); } }); } dqSlt(".JqMA-btn-pic", "all").text(picwh); setValLoc("picwh", picwh); } function btnPicClick() { picZ = picZ ? 0 : 1; dqSlt(".JqMA-btn-pic", "all").each(function() { this.style.setProperty("color", picZ ? "green" : null, "important"); }); setValLoc("picZ", picZ); if (picZ) { if (scrollPic) { scrollPicLoad(); } else { imgInterFn(); } } else { removePicClass(); } } let scrollPic = getValLoc("scrollPic", 0) function scrollPicLoad() { const _scrollTop = getScrollTop(), _picZ = picZ; picZ = 0; dqSlt(".JqMA-inner-pic", "all").remove(); autoScrollTo(0); let maxTop = 0, scrollnum = 0; visibleDiv().each(function() { maxTop = Math.max(maxTop, this.scrollHeight); }); const downJu = Math.max(maxTop / 8, window.innerHeight), endnum = parseInt((maxTop + 9) / downJu); let _timeout = setInterval(function() { scrollnum++; autoScrollBy(downJu, 100); if (scrollnum > endnum) { clearInterval(_timeout); xScrollDiv().stop().animate({ scrollLeft: 10 * window.innerWidth }, 100, "linear"); autoScrollTo(0, 200); setTimeout(function() { if (_picZ) { picZ = 1; removePicClass(); imgInterFn(); } setTimeout(function() { autoScrollTo(_scrollTop); }, 400); }, 400); } }, 105); } var picZ = getValLoc("picZ", 0); dqSlt("html").on('click', ".JqMA-btn-pic", btnPicClick).slideScreen('.JqMA-btn-pic', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > thisHeight * 3 || offsetY < thisHeight * -3 || offsetX > thisHeight * 3) { btnPicwhClick(); } else if (offsetY > thisHeight) { if (minPicwh < picwh && picwh < minPicwh + 40) { picwh = minPicwh; } else if (picwh <= minPicwh) { picwh = 0 } else { picwh -= 40; } picImgFilter(); } else if (offsetY < -thisHeight || offsetX > thisHeight) { if (picwh == 0) { picwh = minPicwh; } else { picwh += 40; } picImgFilter(); } else { btnPicClick(); } }); function removePicClass() { dqSlt(".JqMA-inner-pic", "all").remove(); preImgArr = [new Set(), new Set(), new Set()]; } function addLocation(_href) { try { return new URL(_href, window.location.origin).href; } catch (error) { return _href; } } function getImgList(dataObj, _img, findA, preImgNum) { let imgList = [], imgOuterWH; dataObj.forEach(function(i) { i = formatStr(i); if (!i.replace(/[\s/]/g, "").length) return; i = addLocation(decodeStr(i)); if (!preImgArr[preImgNum].has(i)) { preImgArr[preImgNum].add(i); imgOuterWH = _img ? getPercentW(_img[0]) : minOuterSz; imgList.push($("<img>").attr({ src: i, loading: "lazy", width: "300", height: "100", "img-outerWH": imgOuterWH })); } }); if (findA && imgList.length) { let _newA = $(aStr), _a = _img.closest("a"), _img_2 = _img; for (let i = 0; i < 3; i++) { if (_a.length || _img_2.is("body")) break; _a = _img_2.find("a[href]:first"); _img_2 = _img_2.parent(); } const _href = _a.attr("href"); if (_href && !/^(?!https?:)[a-z]{3,15}:|^#/.test(_href)) { _newA.attr({ href: _href, target: _a.attr("target") }); } else { if (_a.length) { _a.children(":not(a)").length || _a.append('<p style="display:none!important;">'); _a = _a.children(":not(a):first"); } else { _a = _img; } _newA.on("click", function() { _a.trigger("click"); }); } let _element = _img[0], _newA2 = $(aStr).on("click", function() { pageX.unshift($(this).prevAll("img:first")[0]); _element.scrollIntoView({ "block": "center" }); }); imgList.push(_newA); imgList.push(_newA2.text(imgOuterWH)); } return imgList; } var preImgArr = [new Set(), new Set(), new Set()]; var imgRegex_1 = /https?[:%][^""<>\s]*?\.(xbm|tif|pjp|jpg|jpeg|tiff|gif|jfif|webp|png|bmp|pjpeg|avif)([?!/&%][^""<>\s]*?)?(?=[""<>\s一-鿯]|https?[:%]|$)/gi var imgRegex_2 = /((?<=[""])[a-z]*[/]|https?[:%])[^""<>\s]*?\.(xbm|tif|pjp|jpg|jpeg|tiff|gif|jfif|webp|png|bmp|pjpeg|avif)([?!/&%][^""<>\s]*?)?(?=[""<>\s]|https?[:%]|$)/i let pageNext_0, pageNext_1, pageNext_2; const aStr = '<a class="JqMA-css-smallPic">'; function imgInterFn() { picaImgHide(); if (!dqSlt(".JqMA-inner-pic", "one").length) { dqSlt("body", "one").prepend($("<p>").attr({ class: "JqMA-inner-pic JqMA-inner-all" }).append('<p class="JqMA-mark-pageNext JqMA-mark-pageNext_0 JqMA-mark-pageNum">可见元素</p>') .append('<p class="JqMA-mark-pageNext JqMA-mark-pageNext_1 JqMA-mark-pageNum">深度搜索</p>') .append('<p class="JqMA-mark-pageNext JqMA-mark-pageNext_2 JqMA-mark-pageNum">文字链接</p>')); } pageNext_0 = dqSlt(".JqMA-mark-pageNext_0", "one"); pageNext_1 = dqSlt(".JqMA-mark-pageNext_1", "one"); pageNext_2 = dqSlt(".JqMA-mark-pageNext_2", "one"); let imgArr_0 = [], imgArr_1 = []; dqSlt("img:not(.JqMA-inner-pic > *),video,[JqMA-mark-backImg],.pagetual_pageBar").each(function() { const _img = $(this); if (_img.hasClass("pagetual_pageBar")) { !pageNext_1.prev().hasClass("JqMA-mark-pageNext") && pageNext_1.before($('<p class="JqMA-mark-pageNext">')); DSImg && !pageNext_2.prev().hasClass("JqMA-mark-pageNext") && pageNext_2.before($('<p class="JqMA-mark-pageNext">')); return true; } if (outerSz === 0 || getPercentW(this) >= 1) { let srcArr = []; if (_img.is("img")) { srcArr.push(this.currentSrc); } else if (_img.is("video")) { srcArr.push(this.poster); } if (_img.is("[JqMA-mark-backImg]")) { srcArr.push(_img.css("background-image").split(/[""]/)[1]); } let imgList = getImgList(srcArr, _img, 1, 0); if (imgList.length) imgArr_0.push(...imgList); if (DSImg) { let _imgHtml = ""; if (_img.is("a img")) _imgHtml = _img.closest("a").clone().removeAttr("style").empty().prop("outerHTML"); _imgHtml += _img.clone().removeAttr("src poster style").empty().prop("outerHTML"); let _isp = _imgHtml.replace(/"|['']/g, '"').match(imgRegex_2); if (_isp) { imgList = getImgList([_isp[0]], _img, 1, 1); if (imgList.length) imgArr_1.push(...imgList); } } } }); imgArr_0.length && pageNext_1.before(imgArr_0); imgArr_1.length && pageNext_2.before(imgArr_1); if (DSImg) { let _text = ""; dqSlt("body > :visible").each(function() { _text += getText(this); }); _text = _text.replace(/"|['']/g, '"').match(imgRegex_1); if (_text) { _text = getImgList(_text, 0, 0, 2); _text.length && dqSlt(".JqMA-inner-pic", "one").append(_text); } } picImgCount(pageNext_0, pageNext_1, pageNext_2); dqSlt(".JqMA-inner-pic img:not(.JqMA-mark-preAdd)").addClass("JqMA-mark-preAdd").on("load error", function() { picImgCount(pageNext_0, pageNext_1, pageNext_2); var oldNatureH = this.naturalHeight, oldNatureW = this.naturalWidth; if (Math.min(oldNatureW, oldNatureH) < minPicHD) { var thisSrcList = picHD(this.currentSrc), _this = $(this), promiseArray = []; for (let i = 0; i < thisSrcList.length; i++) { promiseArray.push(checkImgExists(thisSrcList[i]).catch(err => { console.log(err) })); } Promise.all(promiseArray).then(function(data) { for (let i = 0; i < data.length; i++) { let resH = data[i]; if (resH.naturalHeight > oldNatureH || resH.naturalWidth > oldNatureW) { _this.attr({ src: resH.src, "JqMA-mark-imgHD": 1 }); return; } } }); } if (picSizeOut(this)) { $(this).nextAll("a:lt(2)").add(this).removeClass("JqMA-css-smallPic"); } else { $(this).addClass("JqMA-css-smallPic"); } }).on("load", function() { $(this).addClass("JqMA-mark-imgLoaded").nextAll("a:eq(0)").text(getMinPicwh(this)); }); } var picImgTime; function picImgCount(pageNext_0, pageNext_1, pageNext_2) { clearTimeout(picImgTime); picImgTime = setTimeout(function() { let picImgLen = dqSlt(".JqMA-inner-pic img:not(.JqMA-css-smallPic)", "all").length, keJian_Img = pageNext_1.prevAll("img:not(.JqMA-css-smallPic)"), search_len = pageNext_2.prevAll("img:not(.JqMA-css-smallPic)").length; pageNext_0.html(`可见:${keJian_Img.length} <a id="JqMA-mark-pageNext_1">深度</a>:${search_len - keJian_Img.length} <a id="JqMA-mark-pageNext_2">文字</a>:${picImgLen - search_len}`); }, 400); } function picHD(oldSrc) { var thisSrc = oldSrc, thisSrcList = []; if (picReplace.indexOf("`") != -1) { let numberToRe = /^@/.test(picReplace) ? 1 : 0, picRepArr = picReplace.replace(/^@/, "").split("`"); for (let i = 0; i < parseInt(picRepArr.length / 2); i++) { thisSrc = thisSrc.replace(numberToRe ? new RegExp(picRepArr[2 * i].replace(/(?<![{])\d(?![}])/g, "[0-9]")) : picRepArr[2 * i], picRepArr[2 * i + 1]); } thisSrcList.push(thisSrc); } thisSrcList.push(oldSrc.replace(/-\d{2,4}x\d{2,4}(?=[.-])/, "")); thisSrcList.push(oldSrc.replace(/^(?=data:)(.+?)[^A-Za-z0-9+/=>;]+$/, "$1")); let delHtList = delHttp(oldSrc); if (delHtList.length) thisSrcList.push(...delHtList); if (!/.https?[:%]/.test(oldSrc)) { thisSrcList.push(oldSrc.replace(/^([^?]+?)&.*$/, "$1")); } var newSrcList = []; for (let i = 0; i < thisSrcList.length; i++) { thisSrc = thisSrcList[i]; if (thisSrc != oldSrc) { newSrcList.push(thisSrc); } } return newSrcList; } function picaImgHide() { if (Dhide) { changeStyle("JqMA-inner-picaImg", ".JqMA-inner-pic > a {" + "height: 0!important; border: 0!important;}" + ".JqMA-inner-pic > img.JqMA-css-smallPic {" + "height: 0!important; border: 4px solid gray!important;}"); } else { dqSlt("style#JqMA-inner-picaImg").html(""); } } function delHide() { dqSlt(".JqMA-btn-all", "all").each(function() { if ($(this).is(".JqMA-btn-del")) { this.style.cssText += "opacity:" + (Dhide ? "0.5" : "1") + "!important;"; } else { this.style.cssText += "display:" + (Dhide ? "none" : "block") + "!important;"; } }); } function btnDelClick() { Dhide = Dhide ? 0 : 1; delHide(); picaImgHide(); setValLoc("Dhide", Dhide); } dqSlt("html").on('click', '.JqMA-btn-del', btnDelClick).slideScreen('.JqMA-btn-del', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetX > thisHeight || offsetY > thisHeight || offsetY < -thisHeight) { let loadNow = document.querySelector("#pagetual-sideController #loadNow"); if (loadNow) { loadNow.dispatchEvent(new MouseEvent('click')); } else { alert("请启用 东方永夜机 立即翻页"); } } else { btnDelClick(); } }); var nextScrollTop = getValLoc("nextScrollTop", 0); dqSlt("html").longPress('.JqMA-btn-del', function() { let newHref; if (/[^a-z]page[=/]\d+(?=$|&)/.test(location.href)) { let hrefSplit = location.href.split(/(?<=[^a-z]page)([=/])(?=\d)/); openHref(getNextPage(hrefSplit)); return; } else if (/[/_\-]\d+(\.html)?$/.test(location.href)) { let hrefSplit = location.href.split(/([/_\-])(?=\d+(?:\.html)?$)/); newHref = getNextPage(hrefSplit); } let pageEnter; $(dqSlt("a").get().reverse()).each(function() { if (/^\s*2\s*$/.test($(this).text()) && /[^a-z]page[=/]\d+(?=$|&)/.test(this.href)) { pageEnter = 1; openHref(this.href); return false; } else if (/^\s*(>|次のページ|下.?[章页]|下[一—].)\s*$|^\s*next\s*(page\s*)?$/i.test($(this).text())) { pageEnter = 1; let _a = $(this); _a.children(":not(a)").length || _a.append('<p style="display:none!important;">'); _a.children(":not(a):first").trigger("click"); return false; } else if (newHref && this.href === newHref) { pageEnter = 1; openHref(newHref); return false; } }); if (!pageEnter && /[^a-z\d]\d+$/.test(location.href)) { let hrefSplit = location.href.split(/([^a-z\d])(?=\d+$)/); openHref(getNextPage(hrefSplit)); } }); function getNextPage(hrefSplit) { let pNumber = Number(hrefSplit[2].split(/[^\d]/)[0]) + 1; let newHref = hrefSplit[0] + hrefSplit[1] + pNumber + hrefSplit[2].replace(/^\d+/, ""); return newHref; } function openHref(newHref) { if (openBlank) { window.open(newHref); } else { location.href = newHref; } } function aOpenBlank() { dqSlt("a:not([JqMA-mark-blank])").attr("JqMA-mark-blank", 1).filter(function() { return !/^javascript:|^#$/.test(this.href); }).attr("target", "_blank"); } function btnBlankClick() { openBlank = openBlank ? 0 : 1; dqSlt(".JqMA-btn-blank", "all").each(function() { this.style.setProperty("color", openBlank ? "green" : null, "important"); }); if (openBlank) { aOpenBlank(); } else { dqSlt("[JqMA-mark-blank]").removeAttr("JqMA-mark-blank").attr("target", null); } setValLoc("openBlank", openBlank); } var openBlank = getValLoc("openBlank", 0), preIframes = new Set(); dqSlt("html").on('click', '.JqMA-btn-blank', btnBlankClick).slideScreen('.JqMA-btn-blank', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > thisHeight || offsetY < -thisHeight || offsetX > thisHeight) { let firstTarget; waitClick("not", function(event) { if (!firstTarget) { firstTarget = event.target; return; } dqSlt("body").off("click.tempClickFunc"); dqSlt(".JqMA-btn-all", "all").each(function() { this.style.setProperty("display", "block", "important"); }); let isInput = $(firstTarget).closest("a").length ? 0 : 1, first_aCss; if ($(firstTarget).is(event.target)) copyToClipboard(getSelector(event.target)); firstTarget = $(firstTarget).closest(isInput ? "input" : "a"); let lastTarget = $(event.target).closest(isInput ? "input" : "a"); if (firstTarget.length && lastTarget.length) { dqSlt(isInput ? "input" : "a").each(function() { if ($(this).is(firstTarget)) first_aCss = 1; if (first_aCss && this.href && !preIframes.has(this.href)) { preIframes.add(this.href); dqSlt("body", "one").append($("<iframe>").attr({ src: this.href, scrolling: "no", sandbox: 'allow-scripts allow-same-origin', style: "box-sizing: border-box !important; overflow: hidden !important; width: 100% !important; min-height: 150vh!important;" }).on("load", function() { $(this).before($('<p class="pagetual_pageBar">')); let _this = this; setTimeout(function() { $(_this).contents().length && _this.replaceWith(...$(_this).contents().find("html")); }, 1000); })); } first_aCss && isInput && $(this).prop("checked", true); if ($(this).is(lastTarget)) return false; }); } else { alert("请点击链接或复选框!"); } }); } else { btnBlankClick(); } }); function fullScreen() { document.querySelector("html").requestFullscreen(); dqSlt("head", "one").append( $("<style>").html("body {width: 100vw!important; max-width: none!important;}")); screen.orientation.lock = hengPin; screen.orientation.lock('landscape'); } let Drotate = getValLoc("Drotate", 0); dqSlt("html").longPress('.JqMA-btn-blank', function() { Drotate = Drotate ? 0 : 1; if (Drotate) { fullScreen(); } else { document.exitFullscreen(); } dqSlt(".JqMA-btn-blank", "all").text(Drotate ? "BF" : "B"); setValLoc("Drotate", Drotate); }); function scrollRun() { Dscroll = Dscroll ? 0 : 1; clearInterval(timeDown); dqSlt(".JqMA-btn-Ju", "all").each(function() { this.style.setProperty("color", Dscroll ? "green" : null, "important"); }); if (Dscroll) { timeDown = setInterval(function() { autoScrollBy(direction * scrollJu * window.innerHeight * 0.05, smoothScroll ? 0 : 800); }, 805); GM_setValue("scrollJu", scrollJu); } else { dqSlt("html,body", "all").stop(); visibleDiv().stop(); } } function btnJuClick() { scrollRun(); setValLoc("Dscroll", Dscroll); } var Dscroll = getValLoc("Dscroll", 0), timeDown; dqSlt("html").on('click', '.JqMA-btn-Ju', btnJuClick).slideScreen('.JqMA-btn-Ju', function(event) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > thisHeight) { scrollJu -= 1; } else if (offsetY < -thisHeight || offsetX > thisHeight) { scrollJu += 1; } else { btnJuClick(); return; } scrollJu = Math.max(scrollJu, 0); dqSlt(".JqMA-btn-Ju", "all").text((smoothScroll ? "`" : "") + scrollJu); GM_setValue("scrollJu", scrollJu); }); dqSlt("html").longPress('.JqMA-btn-Ju', function(event) { var inputNum = window.prompt("请输入滚动速度(以`开头表间隔):", (smoothScroll ? "`" : "") + scrollJu); smoothScroll = inputNum.startsWith("`") ? 1 : 0; if (Number(inputNum.replace("`", ""))) { scrollJu = Number(inputNum.replace("`", "")); scrollJu = Math.max(scrollJu, 0); dqSlt(".JqMA-btn-Ju", "all").text((smoothScroll ? "`" : "") + scrollJu); GM_setValue("scrollJu", scrollJu); GM_setValue("smoothScroll", smoothScroll); } }); })(jQuery); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址