|
3 | 3 | // @name:zh-CN 自动无缝翻页 |
4 | 4 | // @name:zh-TW 自動無縫翻頁 |
5 | 5 | // @name:en AutoPager |
6 | | -// @version 6.5.12 |
| 6 | +// @version 6.5.13 |
7 | 7 | // @author X.I.U |
8 | 8 | // @description ⭐无缝加载 下一页内容 至网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、B 站(bilibili)、NGA、V2EX、煎蛋网、龙的天空、起点中文、千图网、千库网、Pixabay、Pixiv、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、RuTracker、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、小众软件、【动漫狂、动漫屋、漫画猫、漫画屋、漫画 DB、动漫之家、HiComic、Mangabz、Xmanhua 等漫画网站...】、PubMed、Z-Library、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了... |
9 | 9 | // @description:zh-TW ⭐無縫加載 下一頁內容 至網頁底部(類似瀑布流)⭐,支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎(Google、Bing、Yahoo...) 等網站~ |
|
126 | 126 | loadMoreExclude1 = ['.smzdm.com','stackoverflow.com'], |
127 | 127 | loadMoreExclude2 = ['.steampowered.com','.zcool.com.cn'], |
128 | 128 | menuId = [], webType = 0, curSite = {SiteTypeID: 0}, DBSite, DBSite2, pausePage = true, pageNum = {now: 1, _now: 1}, urlC = false, nowLocation = '', lp = location.pathname, scriptHandler; |
129 | | - window.autoPage = {lp: ()=>location.pathname, indexOF: indexOF, isMobile: isMobile, isUrlC: isUrlC, blank: forceTarget, getAll: getAll, getOne: getOne, getAllXpath: getAllXpath, getXpath: getXpath, getAllCSS: getAllCSS, getCSS: getCSS, getNextE: getNextE, getNextEP: getNextEP, getNextSP: getNextSP, getNextEPN: getNextEPN, getNextUPN: getNextUPN, getNextUP: getNextUP, getNextF: getNextF, getSearch: getSearch, getCookie: getCookie, insStyle: insStyle, insScript: insScript, src_bF: src_bF, xs_bF: xs_bF} |
| 129 | + window.autoPage = {lp: ()=>location.pathname, indexOF: indexOF, isMobile: isMobile, isUrlC: isUrlC, blank: forceTarget, getAll: getAll, getOne: getOne, getAllXpath: getAllXpath, getXpath: getXpath, getAllCSS: getAllCSS, getCSS: getCSS, getNextE: getNextE, getNextEP: getNextEP, getNextSP: getNextSP, getNextEPN: getNextEPN, getNextUPN: getNextUPN, getNextUP: getNextUP, getNextF: getNextF, getSearch: getSearch, getCookie: getCookie, insStyle: insStyle, insScript: insScript, cleanuEvent: cleanuEvent, src_bF: src_bF, xs_bF: xs_bF} |
130 | 130 | if (typeof GM_info != 'undefined') {scriptHandler = GM_info.scriptHandler;} else if (typeof GM != 'undefined' && typeof GM.info != 'undefined') {scriptHandler = GM.info.scriptHandler;} else {scriptHandler = '';} |
131 | 131 | for (let i=0;i<menuAll.length;i++){ // 如果读取到的值为 null 就写入默认值 |
132 | 132 | if (GM_getValue(menuAll[i][0]) == null){GM_setValue(menuAll[i][0], menuAll[i][3])}; |
@@ -2641,6 +2641,22 @@ function: { |
2641 | 2641 | }); |
2642 | 2642 | } |
2643 | 2643 | } |
| 2644 | + |
| 2645 | + // 清理元素上绑定的事件(不包括父元素上监听的事件委托) |
| 2646 | + // css 为元素选择器(也支持 Xpath) |
| 2647 | + // delay 为延迟时间,确保其放在 url 规则中执行时网页已经加载完成 |
| 2648 | + // mode 为 0 时清理全部,为 1 时额外清理 onclick 属性,为 2 时添加空点击事件并阻止冒泡 |
| 2649 | + function cleanuEvent(css, delay = 0, mode = -1) { |
| 2650 | + setTimeout(()=>{ |
| 2651 | + getAll(css).forEach(function (a) { |
| 2652 | + const clonedLink = a.cloneNode(true); // 克隆原元素 |
| 2653 | + if (mode == 0 || mode == 1) {if (clonedLink.getAttribute('onclick') != undefined) {clonedLink.removeAttribute('onclick')}} // 清理 onclick 属性 |
| 2654 | + if (mode == 0 || mode == 2) clonedLink.addEventListener('click', function(e) {e.stopPropagation();}); // 添加空点击事件并阻止冒泡(避免父元素事件委托捕获该元素的点击事件) |
| 2655 | + a.insertAdjacentElement('afterend', clonedLink); // 把克隆的元素插入原元素后面 |
| 2656 | + a.remove(); // 删除原元素 |
| 2657 | + }, delay); |
| 2658 | + }) |
| 2659 | + } |
2644 | 2660 | // 初始化事件 |
2645 | 2661 | /*function initEvent() { |
2646 | 2662 | if (curSite.initE[1] == undefined) curSite.initE[1] = 500; |
|
0 commit comments