// ==UserScript==
// @name 手机看图、小说适配
// @namespace http://tampermonkey.net/
// @version 9.500.9.30
// @description 自动滚动,图片集合,页面旋转,字体放大,去除浮动广告,模拟点击
// @author You
// @match *://*/*
// @require https://cdn.bootcss.com/jquery/3.7.1/jquery.min.js
// @run-at document-body
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @license MIT
// ==/UserScript==
if (GM_getValue("rate_change") == null) {
GM_setValue("rate_change", 1);
}
this.$ = this.jQuery = jQuery.noConflict(true);
(function($) {
'use strict';
if (document.querySelector('.JqMA-btn-all') ||
$(".JqMA-btn-all", window.parent.document).length > 0) {
return;
}
function dqSlt(selectPath) {
return $(document.querySelectorAll(selectPath)).add($(document.querySelectorAll('iframe')).contents().find(selectPath));
}
var DSImg = 1;
var winWidth = parseInt(dqSlt("html").width()),
winProp = window.innerHeight / window.innerWidth,
winHeight = parseInt(winWidth * winProp);
if (winHeight < 400 || winWidth < 200) {
winWidth = 393;
winHeight = 767;
winProp = 767 / 393;
}
var winW = winWidth > winHeight ? winHeight * 0.9 : winWidth;
var wHeight = winW * 0.1,
SPicH = winWidth * 0.12,
top = (winHeight - wHeight) * 0.5;
var html_style = `html,body {
overflow-wrap: break-word !important;
scroll-behavior: auto !important;
filter: none !important;
min-height: ${winHeight}px !important;
}`;
var Jq_style = `.JqMA-css-yScroll{
overflow-y: scroll!important;
}
.JqMA-css-xScroll{
overflow-x: scroll!important;
}
.JqMA-css-hide{
display: none !important;
}
.JqMA-css-fixed {
position: fixed !important;
}
.JqMA-css-transform {
transform: translate(0%, 0%) !important;
padding-bottom: ${winHeight * winProp - 0.6 * winWidth}px !important;
}
.JqMA-css-rotate {
float: right !important;
position: relative !important;
left: -100% !important;
padding-bottom: ${winHeight * winProp - 0.6 * winWidth}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;
}
.JqMA-inner-all{
position: relative !important;
z-index: 2147483646 !important;
margin: 0 !important;
width: 100% !important;
display: block !important;
background: black !important;
}
#JqMA-inner-blank,
#JqMA-inner-pic,
#JqMA-inner-word {
overflow: visible !important;
overflow-wrap: break-word !important;
padding: ${0.25 * winHeight}px 0 ${0.25 * winHeight}px 0 !important;
border: 0 !important;
border-top: 1px solid white !important;
}
#JqMA-inner-blank {
padding-top: ${1.25 * winHeight}px !important;
}
#JqMA-inner-pic {
height: auto !important;
text-align: left !important;
font: 0 "Fira Sans", sans-serif !important;
}
#JqMA-inner-pic,
#JqMA-inner-pic img {
min-width: auto !important;
max-width: auto !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;
filter: none !important;
max-height: auto !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;
width: 100%;
height: auto;
user-select: none !important;
object-fit: contain !important;
min-height: auto !important;
background: gray !important;
}
#JqMA-inner-pic xmp,
#JqMA-inner-pic a {
color: #F2F2F2;
background: black !important;
vertical-align: top !important;
min-height: auto !important;
height: ${SPicH}px !important;
overflow: hidden !important;
font-size: ${winW * 0.045}px !important;
cursor: pointer !important;
}
#JqMA-inner-pic a:visited {
color: #741274 !important;
}
.JqMA-css-smallPic {
width: 12% !important;
height: ${SPicH}px !important;
}
#JqMA-inner-pic xmp {
display: none;
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: inherit !important;
line-height: 1.3 !important;
width: 76% !important;
min-width: auto !important;
max-width: auto !important;
}
#JqMA-inner-pic a{
display: inline-block;
user-select: none !important;
line-height: normal !important;
width: 12% !important;
min-width: auto !important;
max-width: auto !important;
text-align: center !important;
text-decoration: none !important;
border: 1px solid red !important;
}
.JqMA-btn-all {
color: white;
background:black !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;
filter: none !important;
position: fixed !important;
font-size: ${winW * 0.036}px !important;
height: ${wHeight}px !important;
max-height: auto !important;
min-height: auto !important;
width: ${wHeight}px !important;
max-width: auto !important;
min-width: auto !important;
}
.JqMA-mark-pageNext,
.pagetual_pageBar {
display: block !important;
height: 0 !important;
min-height: auto !important;
margin: 0 !important;
border: 0 !important;
padding: 0 !important;
overflow: hidden !important;
}
.JqMA-css-textBig,#JqMA-inner-word {
text-align: left !important;
text-indent: 2em !important;
letter-spacing: normal !important;
line-height: normal !important;
filter: none !important;
overflow-wrap: break-word !important;
}
.JqMA-css-textBig:not(a,a *),#JqMA-inner-word {
color: #F2F2F2 !important;
background-color: black !important;
}`;
var jianG = wHeight;
var left = 0,
left2 = wHeight + left,
left3 = wHeight + left2;
var leftCss = "left:" + left + "px;",
leftCss2 = "left:" + left2 + "px;",
leftCss3 = "left:" + left3 + "px;";
var animateTime = 800,
scrollNum = parseInt(winHeight * 5.2 * animateTime / 100000);
var scrollJu = 4;
var picwh = 50;
function addInput(id1, value1, style1, class1 = "") {
dqSlt("html").first().append($('<div>').attr({
class: "JqMA-btn-all" + " " + class1,
id: id1,
style: style1 + "px;"
}).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-rotate', 'R', leftCss + "top:" + (top - 5 * jianG));
addInput('JqMA-btn-DS', "S", leftCss + "top:" + (top - 6 * jianG));
addInput('JqMA-btn-scrollPH', "O", leftCss + "top:" + (top - 7 * jianG));
addInput('JqMA-btn-transform', "T", leftCss + "top:" + (top + jianG));
addInput('JqMA-btn-jia', '+', leftCss + "top:" + (top + 2 * jianG));
addInput('JqMA-btn-jian', '-', 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-video', GM_getValue("rate_change"), leftCss + "top:" + (top + 6 * jianG));
addInput('JqMA-btn-Ju', scrollJu, leftCss2 + "top:" + (top));
function addInner() {
if (dqSlt(".JqMA-inner-all").length == 0) {
dqSlt("body").first().prepend($("<div>").attr({
class: "JqMA-inner-all"
}));
}
}
dqSlt("body").first().prepend($("<div>").attr({
class: "JqMA-mark-pageNext"
}));
setTimeout(function() {
delHide();
dqSlt("body").filter(function() {
return $(this).css("overflow-y") == "hidden";
}).addClass("JqMA-css-yScroll");
checkIframe();
var iframeNum = 0;
setInterval(function() {
dqSlt("video")[0].playbackRate = GM_getValue("rate_change");
var newIfrNum = dqSlt("*").length;
if (iframeNum < newIfrNum) {
iframeNum = newIfrNum;
checkIframe();
if (fSize && fSize != "inherit") {
fontInterFn();
}
if (picZ > 0 && picZ < 3) {
imgInterFn()
}
if (Dtransform == 1) {
dqSlt(":not(.JqMA-css-hide,head *,.JqMA-btn-all,#pagetual-picker)").filter(function() {
return /sticky|fixed/.test($(this).css("position"));
}).addClass("JqMA-css-hide JqMA-css-fixed");
} else if (Dtransform == 2) {
dqSlt(":not(.JqMA-css-fixed,head *,.JqMA-btn-all,#pagetual-picker)").filter(function() {
return /sticky/.test($(this).css("position"));
}).addClass("JqMA-css-fixed");
}
}
}, 3 * 1000);
}, 10);
dqSlt("head:not(.JqMA-mark-addStyle)").first().addClass("JqMA-mark-addStyle").append(
$("<style>").attr({
type: 'text/css'
}).html(html_style + Jq_style)
);
function checkIframe() {
dqSlt('body').first().append(
dqSlt("html").first().children(":not(head,body,.JqMA-btn-all,#pagetual-picker)")
);
dqSlt("head:not(.JqMA-mark-addStyle)").addClass("JqMA-mark-addStyle").append(
$("<style>").attr({
type: 'text/css'
}).html(Jq_style)
);
dqSlt("html").off("click.clickScroll").on('click.clickScroll', function(event) {
var _target = $(event.target);
if (_target.is("a,a *")) {
return;
}
var direction = 1;
if (scrollJu < 0) {
direction = -1;
}
if (_target.is(".JqMA-css-textBig,.JqMA-css-textBig *,:has(.JqMA-css-textBig)")) {
autoScrollBy(direction * ((xMove == 1 ? winWidth : winHeight) - parseInt(fSize) * 1.4));
} else if (_target.is("img,:has(img,picture),#JqMA-inner-pic *")) {
if (_target.is("img:not(#JqMA-inner-pic *)") &&
_target[0].naturalWidth && !picSizeOut(_target[0], 50)) {
return;
}
autoScrollBy(direction * 0.4 * (xMove == 1 ? winWidth : winHeight));
}
});
dqSlt("html").off("touchstart.stopPause").on("touchstart.stopPause", ":not(.JqMA-btn-move)", function() {
if (Dscroll % 2 != 0) {
dqSlt("#JqMA-btn-Ju").trigger("click");
pauseScroll = 1;
}
}).off("touchend.stopPause").on("touchend.stopPause", function() {
stopPause();
});
}
dqSlt("html").on('click', '#JqMA-btn-video', function() {
if (GM_getValue("rate_change") < 2.5) {
GM_setValue("rate_change", GM_getValue("rate_change") + 0.5);
} else {
GM_setValue("rate_change", 1);
}
dqSlt("#JqMA-btn-video").html(GM_getValue("rate_change"));
});
var scrollPH = 0;
dqSlt("html").on('click', '#JqMA-btn-scrollPH', function() {
scrollPH += 1;
if (scrollPH % 2 != 0) {
dqSlt("#JqMA-btn-scrollPH").css("color", "green");
} else {
dqSlt("#JqMA-btn-scrollPH").css("color", "white");
}
});
var timeout_3;
dqSlt("html").on('click', '#JqMA-btn-next', function() {
var pageDom = dqSlt(".pagetual_pageBar,.JqMA-mark-pageNext,.JqMA-inner-all");
pageDom.each(function(index, dom) {
var offsetDiff = -0.5 * (xMove == 1 ? winWidth : winHeight);
if (xMove == 1) {
offsetDiff += $(this).offset().left - $(window).scrollLeft();
} else {
offsetDiff += $(this).offset().top - $(window).scrollTop();
}
if (offsetDiff > 1) {
autoScrollBy(offsetDiff);
dqSlt("#JqMA-btn-next").html(index);
return false;
}
});
}).on('touchmove', '#JqMA-btn-next', function() {
if (timeout_3) {
clearTimeout(timeout_3)
}
timeout_3 = setTimeout(function() {
var pageDom = dqSlt(".pagetual_pageBar,.JqMA-mark-pageNext,#JqMA-inner-word,#JqMA-inner-pic");
var offsetDiff, index;
pageDom.each(function(ind, dom) {
var offsetD = -0.5 * (xMove == 1 ? winWidth : winHeight);
if (xMove == 1) {
offsetD += $(this).offset().left - $(window).scrollLeft();
} else {
offsetD += $(this).offset().top - $(window).scrollTop();
}
if (offsetD > 0) {
return false;
} else {
offsetDiff = offsetD;
index = ind;
}
});
if (offsetDiff) {
autoScrollBy(offsetDiff);
dqSlt("#JqMA-btn-next").html(index + 1);
}
}, 500);
});
var Dtransform = 0;
dqSlt("html").on('click', '#JqMA-btn-transform', function() {
Dtransform += 1;
if (Dtransform > 0 && Dtransform < 3) {
dqSlt("body").first().addClass("JqMA-css-transform");
addInner();
dqSlt(".JqMA-inner-all").first().attr({
id: "JqMA-inner-blank"
});
if (Dtransform == 1) {
dqSlt(":not(head *,.JqMA-btn-all,#pagetual-picker)").filter(function() {
return /sticky|fixed/.test($(this).css("position"));
}).addClass("JqMA-css-hide JqMA-css-fixed");
autoScrollBy(1.5 * winHeight);
} else {
dqSlt(".JqMA-css-hide").removeClass("JqMA-css-hide");
}
dqSlt("#JqMA-btn-transform").css("color", "green").html("T" + Dtransform);
} else {
Dtransform = 0;
dqSlt(".JqMA-css-transform").removeClass("JqMA-css-transform");
dqSlt(".JqMA-css-fixed").removeClass("JqMA-css-fixed");
dqSlt("#JqMA-inner-blank").removeAttr("id");
autoScrollBy(-1.5 * winHeight);
dqSlt("#JqMA-btn-transform").css("color", "white").html("T");
}
});
dqSlt("#JqMA-btn-DS").css("color", "green");
dqSlt("html").on('click', '#JqMA-btn-DS', function() {
DSImg += 1;
if (DSImg == 2) {
DSImg = 0;
dqSlt("#JqMA-btn-DS").css("color", "white");
} else {
dqSlt("#JqMA-btn-DS").css("color", "green");
}
if (picZ > 0) {
picZ -= 1;
dqSlt("#JqMA-btn-pic").trigger("click");
}
});
var Drotate = 0,
xMove = 0;
dqSlt("html").on('click', '#JqMA-btn-rotate', function() {
Drotate += 1;
if (Drotate % 2 != 0) {
var _scrollTop = getScrollTop();
dqSlt("#JqMA-btn-rotate").css("color", "green");
dqSlt("html,body,div").filter(function() {
return $(this).css("overflow-y") != "hidden" &&
$(this).css("overflow-x") == "hidden" &&
$(this).height() > 0.5 * winHeight;
}).addClass("JqMA-css-xScroll");
autoScrollTo(0);
setTimeout(function() {
dqSlt('body').first().addClass("JqMA-css-rotate");
xMove = 1;
autoScrollTo(_scrollTop * winProp);
dqSlt('.JqMA-btn-all').each(function() {
var _this = $(this);
var _clone = _this.clone().removeAttr("id").addClass("JqMA-btn-left")
.css('margin-left', (winHeight * winProp - winWidth * 0.8) + "px");
_clone.on("scroll", function() {
$(this).html(_this.html()).css("color", _this.css("color"));
}).on("click", function() {
_this.trigger("click");
setTimeout(function() {
dqSlt(".JqMA-btn-left").trigger("scroll");
}, 100);
}).on("touchmove", function() {
_this.trigger("touchmove");
setTimeout(function() {
dqSlt(".JqMA-btn-left").trigger("scroll");
}, 510);
}).appendTo(dqSlt("html").first());
});
}, 100);
} else {
var _scrollLeft = getScrollLeft();
dqSlt("#JqMA-btn-rotate").css("color", "white");
autoScrollTo(0);
setTimeout(function() {
dqSlt(".JqMA-css-rotate").removeClass("JqMA-css-rotate");
xMove = 0;
autoScrollTo(_scrollLeft / winProp);
dqSlt(".JqMA-btn-left").remove();
}, 100);
}
});
function getScrollLeft() {
return dqSlt("html").scrollLeft() + dqSlt("body").scrollLeft();
}
function getScrollTop() {
return dqSlt("html").scrollTop() + dqSlt("body").scrollTop();
}
var pauseScroll = 0,
Dpause;
dqSlt("#JqMA-btn-Ju,#JqMA-btn-down,#JqMA-btn-up").addClass("JqMA-btn-move");
dqSlt("html").on('click', "a,#JqMA-btn-down,#JqMA-btn-up", function() {
if (Dscroll % 2 != 0) {
dqSlt("#JqMA-btn-Ju").trigger("click");
}
setTimeout(function() {
if (Dscroll % 2 != 0) {
dqSlt("#JqMA-btn-Ju").trigger("click");
}
}, 210);
});
function stopPause() {
if (pauseScroll == 1) {
clearTimeout(Dpause);
Dpause = setTimeout(function() {
pauseScroll = 0;
if (Dscroll % 2 == 0) {
dqSlt("#JqMA-btn-Ju").trigger("click");
}
}, 200);
}
}
$(document).scroll(function() {
stopPause();
});
function visibleDiv() {
return dqSlt("div").filter(function() {
return $(this).css("overflow-y") != "hidden" &&
$(this).height() > 0.5 * winHeight;
});
}
function autoScrollBy(scrollBy_Ju, speed = 0) {
if (scrollPH % 2 == 0) {
if (xMove == 1) {
dqSlt("html,body").stop().animate({
scrollLeft: "+=" + scrollBy_Ju + "px"
}, speed, "linear");
} else {
dqSlt("html,body").stop().animate({
scrollTop: "+=" + scrollBy_Ju + "px"
}, speed, "linear");
}
} else {
visibleDiv().stop().animate({
scrollTop: "+=" + scrollBy_Ju + "px"
}, speed, "linear");
}
}
function autoScrollTo(scrollTo_Ju, speed = 0) {
if (scrollPH % 2 == 0) {
if (xMove == 1) {
dqSlt("html,body").stop().animate({
scrollLeft: scrollTo_Ju
}, speed, "linear");
} else {
dqSlt("html,body").stop().animate({
scrollTop: scrollTo_Ju
}, speed, "linear");
}
} else {
visibleDiv().stop().animate({
scrollTop: scrollTo_Ju
}, speed, "linear");
}
}
var timeout_4;
dqSlt("html").on('touchmove', '#JqMA-btn-width', function() {
if (timeout_4) {
clearTimeout(timeout_4)
}
timeout_4 = setTimeout(function() {
if (document.querySelector("#JqMA-inner-word")) {
dqSlt("#JqMA-inner-word").remove();
dqSlt('#JqMA-btn-width').css("color", "white");
} else {
var allStr = "";
dqSlt(":not(style,script,noscript)").each(function() {
var addStr = $(this).clone().children().remove().end().text().replace(/\s+/g, " ");
if (addStr.replace(/[^一-鿯0-9]/g, "").length > 6) {
allStr += "<br><br>";
}
allStr += addStr + " ";
});
addInner();
dqSlt(".JqMA-inner-all").first().after($("<div>").attr({
id: "JqMA-inner-word",
class: "JqMA-inner-all"
}).html(allStr));
dqSlt('#JqMA-btn-width').css("color", "green");
}
}, 500);
});
function fontInterFn() {
dqSlt(":not(.JqMA-css-textBig,#JqMA-inner-pic,#JqMA-inner-pic *,.JqMA-btn-all,#pagetual-picker *)").filter(function() {
var textLen = $(this).clone().children().remove().end().text()
.replace(/[0-9\s]+/g, "").length;
if (oldFont == 22 && textLen > 50) {
oldFont = 1.1 * parseInt($(this).css("font-size").replace("px", ""));
}
return textLen > 0;
}).addClass("JqMA-css-textBig");
var textBig = $(dqSlt(".JqMA-css-textBig"));
textBig.css(wordCss);
var _scale = fSize != "inherit" ? parseInt(fSize / oldFont * 100) / 100 : 1;
var DShadow = "grayscale(100%) contrast(200%) brightness(1000%)";
textBig.children("em:not(.JqMA-css-textBig),img").filter(function() {
return $(this).outerWidth() < 0.1 * winW && $(this).outerHeight() < 0.1 * winW;
}).css({
"transform": "scale(" + _scale + ")",
"-webkit-transform": "scale(" + _scale + ")",
"-moz-transform": "scale(" + _scale + ")",
"margin": "0 " + (_scale * 9 - 9) + "px",
"filter": DShadow,
"-webkit-filter": DShadow,
"-moz-filter": DShadow,
});
if (fSize == "inherit") {
textBig.removeClass("JqMA-css-textBig");
}
}
var widthN = 13;
var fSize, oldFont, wordCss;
dqSlt("html").on('click', '#JqMA-btn-width', function() {
oldFont = 22;
fSize = widthN > 13 + 3 ? "inherit" : parseInt(winWidth / widthN);
wordCss = {
"font-size": fSize
};
fontInterFn();
if (fSize != "inherit") {
dqSlt("#JqMA-btn-width").html(20 - widthN);
} else {
dqSlt("#JqMA-btn-width").html("W");
widthN -= 3 * 3;
}
widthN += 3;
});
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;
}
dqSlt("html").on('click', "#JqMA-btn-picwh", function() {
dqSlt(".JqMA-btn-all").hide();
var _outStop = setTimeout(function() {
$(document).off("click.picwh");
dqSlt(".JqMA-btn-all").show();
}, 3000);
setTimeout(function() {
$(document).on("click.picwh", function(event) {
var _target = $(event.target);
$(document).off("click.picwh");
dqSlt(".JqMA-btn-all").show();
clearTimeout(_outStop);
if (_target.is("#JqMA-inner-pic .JqMA-mark-imgLoaded")) {
if (_target[0].naturalWidth < _target[0].naturalHeight) {
picwh = _target[0].naturalWidth + 1;
} else {
picwh = _target[0].naturalHeight + 1;
}
if (picwh < 50) {
picwh = 50;
}
} else {
picwh = 50;
}
if (picZ == 1) {
dqSlt("#JqMA-inner-pic br").hide();
dqSlt("#JqMA-inner-pic xmp").hide();
dqSlt("#JqMA-inner-pic .JqMA-mark-imgLoaded").filter(function() {
return picSizeOut(this);
}).each(function() {
$(this).closest("#JqMA-inner-pic > *")
.nextAll("br").slice(0, 9).show();
$(this).closest("#JqMA-inner-pic > *")
.nextAll("xmp").slice(0, 9).css("display", "inline-block");
}).removeClass("JqMA-css-smallPic").closest("picture").removeClass("JqMA-css-smallPic");
dqSlt("#JqMA-inner-pic .JqMA-mark-imgLoaded").filter(function() {
return !picSizeOut(this);
}).addClass("JqMA-css-smallPic").closest("picture").addClass("JqMA-css-smallPic");
} else {
dqSlt("#JqMA-inner-pic .JqMA-mark-imgLoaded").filter(function() {
return picSizeOut(this);
}).show().closest("picture").show();
dqSlt("#JqMA-inner-pic .JqMA-mark-imgLoaded").filter(function() {
return !picSizeOut(this);
}).hide().closest("picture").hide();
}
dqSlt("#JqMA-btn-picwh").html(picwh);
});
}, 100);
});
var timeout_1;
dqSlt("html").on('touchmove', '#JqMA-btn-pic', function() {
if (timeout_1) {
clearTimeout(timeout_1)
}
timeout_1 = setTimeout(function() {
if (picZ > 0) {
picZ -= 1;
dqSlt("#JqMA-btn-pic").trigger("click");
}
}, 500);
});
var picZ = 0;
dqSlt("html").on('click', "#JqMA-btn-pic", function() {
getImgArr();
});
function getTrim(_str) {
try {
return _str.trim();
} catch (error) {
return null;
}
}
function getAttr(_this, _attr) {
return $(_this).attr(_attr) ? getTrim($(_this).attr(_attr)) : null;
}
function testHref(_href) {
return !/^javascript:|^#($|[A-Za-z_][A-Za-z0-9_]*$)/.test(_href);
}
function returnLength(lStr) {
return lStr.replace(/[0-9\s]+/g, "").replace(/[一-龟]/g, "aa").length > 9;
}
function imgInterFn() {
var newImgArr = [];
var _text = dqSlt("html").clone().find("head,style,script,noscript").remove().end().text()
.match(/http.*?[.](xbm|tif|pjp|svgz|jpg|jpeg|ico|tiff|gif|svg|jfif|webp|png|bmp|pjpeg|avif)/g);
if (picZ == 1) {
dqSlt("a").filter(function() {
return testHref(getAttr(this, "href")) && !/_blank/.test(getAttr(this, "target"));
}).attr({
target: "_blank",
rel: "noopener noreferrer"
}).addClass("JqMA-mark-aNewPage");
}
dqSlt(":not(html,.JqMA-mark-imgSelected,picture *,#JqMA-inner-pic *)").filter(function() {
var _img = $(this);
return _img.is("a,img,:has(img),.pagetual_pageBar") || _img.css("background-image").split(/[""'']/).length > 1;
}).each(function(inum, dom) {
var dataObj = [],
_img = $(this);
_img.addClass("JqMA-mark-imgSelected");
if (_img.is(".pagetual_pageBar")) {
newImgArr.push($("<div>").attr({
class: "JqMA-mark-pageNext"
}));
return true;
}
if (picZ == 2 && inum == 0 && _text) {
dataObj = dataObj.concat(_text);
}
var _picStr = null;
if (_img.is("picture")) {
_picStr = $("<picture>");
var _picChild;
_img.children().each(function() {
if ($(this).is("img")) {
_picChild = $("<img>").attr({
width: "300",
height: "100",
alt: "JU-IMG",
src: getAttr(this, "src"),
});
} else {
_picChild = $("<source>");
}
_picStr.append(_picChild.attr({
srcset: getAttr(this, "srcset"),
media: getAttr(this, "media"),
type: getAttr(this, "type"),
}));
preImgArr.push(getAttr(this, "srcset"), getAttr(this, "src"));
});
_picStr = _picStr.prop("outerHTML");
if (preImgArr.indexOf(_picStr) == -1) {
preImgArr.push(_picStr);
newImgArr.push(_picStr);
} else {
_picStr = null;
}
}
var _backImg = _img.css("background-image").split(/[""'']/);
dataObj.push(
getAttr(_img, "src"),
_backImg.length > 1 ? _backImg[1] : null
);
if (DSImg != 0) {
var _attributes = [],
_data = Object.values(_img.data());
_attributes.push(_img[0].attributes);
if (_img.is("picture")) {
_img.children().each(function() {
_attributes.push($(this)[0].attributes);
_data = _data.concat(Object.values($(this).data()));
});
}
_attributes.forEach(function(attrs) {
$.each(attrs, function(index, item) {
if (!/^(src|style|srcset|class|id|type|href|onclick)$|^data-|^:/.test(item.name)) {
_data.push(item.value);
}
});
});
_data.forEach(function(i) {
if (typeof i == "object") {
try {
i = JSON.stringify(i);
} catch (error) {
return;
}
} else if (typeof i != "string") {
return;
}
if (/[""'']|%22%2C/.test(i)) {
var _isp = i.split(/[""'']|%22/).filter(function(j) {
return j.length > 9 && /^http/.test(getTrim(j));
});
dataObj = dataObj.concat(_isp);
} else {
dataObj.push(i);
}
});
}
dataObj = Array.from(new Set(dataObj));
var _imgStr = null;
dataObj.forEach(function(i) {
if (typeof i != "string") {
return
}
i = getTrim(i);
try {
i = decodeURIComponent(i);
i = decodeURI(i);
i = unescape(i);
} catch (error) {
console.log(error);
}
if (/^data:image/.test(i)) {
i = i.replace(/[^A-Za-z0-9+/=>;]{0,9}$/, "");
}
if (/^[a-z/]/.test(i) && /[?/]/.test(i) &&
!/[.](txt|shtml|html|htm)$/.test(i) &&
preImgArr.indexOf(i) == -1) {
preImgArr.push(i);
_imgStr = $("<img>").attr({
src: i,
loading: "lazy",
alt: "JU-IMG",
width: "300",
height: "100",
srcset: getAttr(_img, "srcset")
}).prop("outerHTML");
newImgArr.push(_imgStr);
}
});
if (_imgStr || _picStr) {
var _a = _img.find("a").first();
if (_a.length == 0) {
_a = _img.closest("a");
}
var _img_2 = _img;
for (var i = 0; i < 9; i++) {
if (_a.length > 0 || _img_2.is("body")) {
break;
} else {
_a = _img_2.siblings("a").first();
if (_a.length == 0) {
_a = _img_2.siblings().find("a").first();
}
_img_2 = _img_2.parent();
}
}
var _newA = $("<a>").html("IMG").on("click", function() {
_img.trigger("click");
});
var _imgText = _img.clone().find("style,script,noscript").remove().end().text();
var _pStr = (_img.attr("alt") && returnLength(_img.attr("alt")) ? _img.attr("alt") :
_img.attr("title") ? _img.attr("title") :
returnLength(_imgText) ? _imgText :
"");
if (_a.length > 0) {
var _a_2 = _a;
for (var i = 0; i < 9; i++) {
if (_pStr != "" || _a_2.is("body")) {
break
} else {
_imgText = _a_2.clone().find("style,script,noscript").remove().end().text();
_pStr = (_a_2.attr("title") ? _a_2.attr("title") :
returnLength(_imgText) ? _imgText :
"");
_a_2 = _a_2.parent();
}
}
_newA.on("click", function() {
_a.trigger("click");
});
var _aHref = getAttr(_a, "href");
if (_aHref) {
if (_img.is("a") || _img.closest("a").length == 0) {
_newA.attr({
href: _aHref
});
}
if (testHref(_aHref)) {
_newA.attr({
target: "_blank",
rel: "noopener noreferrer"
});
}
var hrefImg = _aHref.match(/http.*?[.](xbm|tif|pjp|svgz|jpg|jpeg|ico|tiff|gif|svg|jfif|webp|png|bmp|pjpeg|avif)/g);
if (DSImg != 0 && hrefImg) {
hrefImg = hrefImg[0];
try {
hrefImg = decodeURIComponent(hrefImg);
hrefImg = decodeURI(hrefImg);
hrefImg = unescape(hrefImg);
} catch (error) {
console.log(error);
}
if (preImgArr.indexOf(hrefImg) == -1) {
preImgArr.push(hrefImg);
_imgStr = $("<img>").attr({
src: hrefImg,
loading: "lazy",
alt: "JU-IMG",
width: "300",
height: "100",
srcset: getAttr(_img, "srcset")
}).prop("outerHTML");
newImgArr.push(_imgStr);
}
}
}
}
newImgArr.push($("<br>").hide(), _newA,
$("<xmp>").html(getTrim(_pStr).replace(/\s+/g, " ").substring(0, 99)), _newA.clone(true).attr("class", "JqMA-clone-a"));
}
});
newImgArr = Array.from(new Set(newImgArr));
if (newImgArr.toString() != imgArr.toString()) {
var newArrEx = newImgArr.filter(function(n) {
return imgArr.indexOf(n) == -1;
});
imgArr = imgArr.concat(newArrEx);
dqSlt("#JqMA-inner-pic").append(newArrEx);
dqSlt("#JqMA-inner-pic img").off("error.imgError").on("error.imgError", function() {
if (getAttr(this, "src").indexOf("=http") > -1) {
$(this).attr("src", getAttr(this, "src").replace(/(?<==http.*?)&.*$/, "").replace(/^.*=(?=http)/, ""));
}
if (picZ == 1 && !/^data:image/.test(getAttr(this, "src"))) {
$(this).addClass("JqMA-css-smallPic").closest("picture").addClass("JqMA-css-smallPic");
} else {
$(this).hide().closest("picture").hide();
}
});
dqSlt("#JqMA-inner-pic img:not(.JqMA-mark-imgLoaded)").on("load", function() {
$(this).addClass("JqMA-mark-imgLoaded");
if (picSizeOut(this)) {
if (picZ == 1) {
$(this).removeClass("JqMA-css-smallPic").closest("picture").removeClass("JqMA-css-smallPic");
$(this).closest("#JqMA-inner-pic > *")
.nextAll("br").slice(0, 9).show();
$(this).closest("#JqMA-inner-pic > *")
.nextAll("xmp").slice(0, 9).css("display", "inline-block");
} else {
$(this).show().closest("picture").show();
}
} else {
if (picZ == 1) {
$(this).addClass("JqMA-css-smallPic").closest("picture").addClass("JqMA-css-smallPic");
} else {
$(this).hide().closest("picture").hide();
}
}
});
}
if (picZ == 2) {
dqSlt("#JqMA-inner-pic > *:not(img,picture)").hide();
}
}
var imgArr,
preImgArr;
function getImgArr() {
dqSlt("#JqMA-inner-pic").remove();
dqSlt(".JqMA-mark-imgSelected").removeClass("JqMA-mark-imgSelected");
dqSlt(".JqMA-mark-aNewPage").removeClass("JqMA-mark-aNewPage").removeAttr("target rel");
picZ += 1;
if (picZ < 3) {
addInner();
dqSlt(".JqMA-inner-all").first().after($("<div>").attr({
id: "JqMA-inner-pic",
class: "JqMA-inner-all"
}));
picwh = 50;
imgArr = [];
preImgArr = [];
dqSlt("#JqMA-btn-picwh").html(picwh);
dqSlt("#JqMA-btn-pic").css("color", "green").html("P" + picZ);
imgInterFn();
} else {
dqSlt("#JqMA-btn-pic").css("color", "white").html("P");
picZ = 0;
}
}
var Dxy = 0;
var pageX;
var pageY;
var timeHu;
dqSlt("html").on('click', '#JqMA-btn-down', function() {
Dxy += 1;
clearTimeout(timeHu);
if (Dxy % 2 == 1) {
pageX = getScrollLeft();
pageY = getScrollTop();
if (Dtransform > 0) {
Dtransform = -1;
dqSlt("#JqMA-btn-transform").trigger("click");
setTimeout(function() {
dqSlt("#JqMA-btn-transform").trigger("click");
}, 100);
}
var toH_2 = -(xMove == 1 ? winWidth : winHeight);
var toH = toH_2;
if (scrollPH % 2 == 0) {
dqSlt("body > *").each(function() {
toH += $(this).outerHeight();
});
var _wrapHeight = toH_2 + dqSlt("body").height();
if (_wrapHeight < toH && _wrapHeight > toH - 2 * winHeight) {
toH = _wrapHeight;
}
} else {
toH = 1000 * winHeight;
}
if (toH < toH_2 + 2 * winHeight) {
toH = 1000 * winHeight;
}
autoScrollTo(toH);
dqSlt("#JqMA-btn-down").html("=");
dqSlt("#JqMA-btn-up").html("=");
timeHu = setTimeout(function() {
Dxy += 1;
dqSlt("#JqMA-btn-up").html("△");
dqSlt("#JqMA-btn-down").html("▽");
}, scrollPH % 2 == 0 ? 15 * 1000 : 0);
} else {
autoScrollTo(xMove == 1 ? pageX : pageY);
dqSlt("#JqMA-btn-up").html("△");
dqSlt("#JqMA-btn-down").html("▽");
}
});
var timeout_6;
dqSlt("html").on('touchmove', '#JqMA-btn-down,#JqMA-btn-up', function() {
if (timeout_6) {
clearTimeout(timeout_6)
}
timeout_6 = setTimeout(function() {
if (Dxy % 2 == 1) {
Dxy = 0;
dqSlt("#JqMA-btn-up").html("△");
dqSlt("#JqMA-btn-down").html("▽");
}
}, 510);
});
dqSlt("html").on('click', '#JqMA-btn-up', function() {
Dxy += 1;
clearTimeout(timeHu);
if (Dxy % 2 == 1) {
pageX = getScrollLeft();
pageY = getScrollTop();
if (Dtransform > 0) {
autoScrollTo(1.5 * winHeight);
} else {
autoScrollTo(0);
}
dqSlt("#JqMA-btn-down").html("=");
dqSlt("#JqMA-btn-up").html("=");
timeHu = setTimeout(function() {
Dxy += 1;
dqSlt("#JqMA-btn-up").html("△");
dqSlt("#JqMA-btn-down").html("▽");
}, scrollPH % 2 == 0 ? 15 * 1000 : 0);
} else {
autoScrollTo(xMove == 1 ? pageX : pageY);
dqSlt("#JqMA-btn-up").html("△");
dqSlt("#JqMA-btn-down").html("▽");
}
});
function delHide() {
dqSlt(".JqMA-btn-all").hide();
dqSlt("#JqMA-btn-del").show().css({
"opacity": "0.3"
});
Dhide = 1;
}
var Dhide = 0;
dqSlt("html").on('click', '#JqMA-btn-del', function() {
if (Dhide % 2 == 0) {
delHide();
} else {
Dhide = 0;
dqSlt(".JqMA-btn-all").show().css({
"opacity": "0.6"
});
}
});
var timeout_2;
dqSlt("html").on('touchmove', '#JqMA-btn-del', function() {
if (timeout_2) {
clearTimeout(timeout_2)
}
timeout_2 = setTimeout(function() {
dqSlt(".JqMA-btn-all").css({
"opacity": "0.1"
});
Dhide = 1;
}, 500);
});
var timeout_7;
dqSlt("html").on('click', '#JqMA-btn-jia', function() {
scrollJu += 1;
if (scrollJu * scrollNum > winHeight - 50) {
scrollJu = 0;
}
dqSlt("#JqMA-btn-Ju").html(scrollJu);
}).on('touchmove', '#JqMA-btn-jia', function() {
if (timeout_7) {
clearTimeout(timeout_7)
}
timeout_7 = setTimeout(function() {
scrollJu += 6;
if (scrollJu * scrollNum > winHeight - 50) {
scrollJu = 0;
}
dqSlt("#JqMA-btn-Ju").html(scrollJu);
}, 500);
});
var timeout_8;
dqSlt("html").on('click', '#JqMA-btn-jian', function() {
scrollJu -= 1;
if (-scrollJu * scrollNum > winHeight - 50) {
scrollJu = 0;
}
dqSlt("#JqMA-btn-Ju").html(scrollJu);
}).on('touchmove', '#JqMA-btn-jian', function() {
if (timeout_8) {
clearTimeout(timeout_8)
}
timeout_8 = setTimeout(function() {
scrollJu -= 6;
if (-scrollJu * scrollNum > winHeight - 50) {
scrollJu = 0;
}
dqSlt("#JqMA-btn-Ju").html(scrollJu);
}, 500);
});
var timeout_5;
dqSlt("html").on('touchmove', '#JqMA-btn-Ju', function() {
if (timeout_5) {
clearTimeout(timeout_5)
}
timeout_5 = setTimeout(function() {
scrollJu = 0;
dqSlt("#JqMA-btn-Ju").html(scrollJu);
}, 500);
});
var Dscroll = 0;
var timeDown;
dqSlt("html").on('click', '#JqMA-btn-Ju', function() {
Dscroll += 1;
clearInterval(timeDown);
if (Dscroll % 2 != 0) {
dqSlt("#JqMA-btn-Ju").css("color", "green");
autoScrollBy(scrollJu * scrollNum, scrollJu > 9 || scrollJu < -9 ? 0 : animateTime);
timeDown = setInterval(function() {
autoScrollBy(scrollJu * scrollNum, scrollJu > 9 || scrollJu < -9 ? 0 : animateTime);
}, animateTime + 10);
} else {
dqSlt("html,body").stop();
visibleDiv().stop();
dqSlt("#JqMA-btn-Ju").css("color", "white");
}
});
// Your code here...
})(this.jQuery);