").attr({ class: "JqMA-inner-word JqMA-inner-all" }).append($("
!阅读结束!
"))); innerWordAdd(); dqSlt(".JqMA-inner-word", "all").on("click", "p", function() { if (getText(readbtn) == "朗读") return currentStr = $(this).prevAll("p").length; readStr(); }); let readbtn = createStyle("朗读", false, "a"); let downbtn = createStyle("下载", false, "a"); let ratebtn = createStyle(`语速:${speakRate}`, false, "a"); document.querySelectorAll(".JqMA-inner-word").forEach(function(element) { element.insertBefore(downbtn, element.firstChild); element.insertBefore(readbtn, element.firstChild); element.insertBefore(ratebtn, element.firstChild); }); readbtn.addEventListener("click", readPause); ratebtn.addEventListener("click", function() { let inputNum = window.prompt("输入语速:", speakRate); if (inputNum === null) return; speakRate = inputNum; this.textContent = "语速:" + speakRate; GM_setValue("speakRate", speakRate); if (getText(readbtn) == "朗读") return readStr(); }); downbtn.addEventListener("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 = GM_getValue("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; } let preMatches = new Set(); const locOrigin = window.location.origin 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 = '——'; let styleElement = document.createElement('style'); styleElement.appendChild(document.createTextNode(spanStyle + hrefAllStyle + hrefStyle)); document.head.appendChild(styleElement); let pElement = document.createElement('p'); pElement.className = 'JqMA-btn-all JqMA-btn-hrefAll'; pElement.innerHTML = spanStr + spanStr; document.querySelector("html").appendChild(pElement); } let pageSource = ""; dqSlt("html").each(function() { pageSource += this.outerHTML; }); let videoList = []; document.querySelectorAll("iframe").forEach(function(elet) { let srcDomain; try { srcDomain = new URL(elet.src).origin; } catch (error) { console.log(error); } if (srcDomain && srcDomain != locOrigin) { videoList.push(elet.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.has(newI)) continue; preMatches.add(newI); dqSlt(".JqMA-btn-hrefAll span", "one").after($("").attr({ href: newI, class: "JqMA-btn-all JqMA-btn-href" }).text(newI.replace(/\/(?=$|\?)/g, "").replace(/^[^?]*[/]/, "").replace(/(?<=[^?/.]{9})[^?/.]+/, ""))); } } 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(); } }); } document.querySelector('html').addEventListener('click', function(event) { if (event.target.classList.contains('JqMA-btn-outerSz')) { btnOuterSzClick(); } }); onSlideScreen(document.querySelector('html'), function(event) { if (event.target.classList.contains('JqMA-btn-outerSz')) { let [offsetX, offsetY, thisHeight] = getTouchSite(event.target, event); if (offsetY > thisHeight * 3 || offsetY < thisHeight * -3 || offsetX > thisHeight * 3) { scrollPic = confirm("是否滚动加载图片?"); 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); } onLongPress(document.querySelector('html'), function(event) { if (event.target.classList.contains('JqMA-btn-pic')) { 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.matches("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); } } }); } onLongPress(document.querySelector('html'), function(event) { if (event.target.classList.contains('JqMA-btn-outerSz')) { 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(); const _picZ = picZ; picZ = 0; dqSlt(".JqMA-inner-pic", "all").remove(); autoScrollTo(0); const maxTop = visibleDiv().scrollHeight; autoScrollBy(maxTop, 900); setTimeout(function() { 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); }, 1000); } let picZ = getValLoc("picZ", 0); document.querySelector('html').addEventListener('click', function(event) { if (event.target.classList.contains('JqMA-btn-pic')) { btnPicClick(); } }); onSlideScreen(document.querySelector('html'), function(event) { if (event.target.classList.contains('JqMA-btn-pic')) { 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, _this, 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 = _this ? getPercentW(_this) : minOuterSz; let newImg = $("