自动无缝翻页

⭐无缝加载 下一页内容 至网页底部(类似瀑布流)⭐,目前支持:【所有「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(以上仅一小部分,更多的写不下了...

当前为 2022-09-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 自动无缝翻页
  3. // @name:zh-CN 自动无缝翻页
  4. // @name:zh-TW 自動無縫翻頁
  5. // @name:en AutoPager
  6. // @version 6.2.5
  7. // @author X.I.U
  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. // @description:zh-TW ⭐無縫加載 下一頁內容 至網頁底部(類似瀑布流)⭐,支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎(Google、Bing、Yahoo...) 等網站~
  10. // @description:en Append the next page content to the bottom seamlessly (like a waterfall)~
  11. // @match *://*/*
  12. // @connect userscript.xiu2.xyz
  13. // @connect userscript.gh2233.ml
  14. // @connect bitbucket.org
  15. // @connect gitea.com
  16. // @connect raw.fastgit.org
  17. // @connect raw.iqiq.io
  18. // @connect ghproxy.net
  19. // @connect gh-proxy-download.moeyy.cn
  20. // @connect raw.njuu.cf
  21. // @connect raw.kgithub.com
  22. // @connect cdn.staticaly.com
  23. // @connect ghproxy.futils.com
  24. // @connect ghproxy.fsofso.com
  25. // @connect raw.xn--p8jhe.tw
  26. // @connect git.yumenaka.net
  27. // @connect raw.cithub.icu
  28. // @connect raw-gh.gcdn.mirr.one
  29. // @connect gcore.jsdelivr.net
  30. // @connect fastly.jsdelivr.net
  31. // @connect raw.githubusercontents.com
  32. // @connect www.xuexiniu.com
  33. // @connect bbs.xuexiniu.com
  34. // @connect weili.ooopic.com
  35. // @connect www.ykmh.com
  36. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAALfElEQVRYhX2Xe3Bd1XXGf3vvc859X+nq6nUlW5Yly7JlI2xsYzAwtnk4ATpAxkNTHm0mnaTT/gHTTvrIBDLTpp1JUoZppqHQls5AKTR2INOWJJQSXF4x2BhsJCRZ8kuWZckPSVf3/Trn7N3RVTFpQrNn1l97n7O/vda31reWMKMPcmUJA9U8vrwHGdqCHn4HPzePaIxhVSoYbYRXrn7BeMVbCUduF6kVUXHwvQP+6amDaqDnoIompmQytaBnTmB8H5lowrjgFss48SBeI/hUEEZeudLi1ywhJEIJdL6Q8rzal/1a5SGC4XZrYBvWwEZobMdLdH6RH+z/Io1taEeh52fe8tOZbysl/ouWFvANYP7fSz4DgAEBBIL4xiS8ubmnVcTZK68aRK29Dtm8dgnZJydRW+/E2nrnp19nz+7U77+60zt0qMz07J/KxuQTwrIw4rMBCDP6wC+FIIcO34eudDdXf/7jD52Opi772lugY3AZr++hp06gz48j+waRqTWYmVHcS+chEMFeuw1hBzBzY7g/fQE9fmqBYPzBQKrpVa/R4OkCAnXlSvXnX9sIllk220BE4Z8OdHoj54YCK6Od1i2/iUmuRyDRk6NUn3+M0pv/hnf0AE40jEjEqP3oe6Rf/CGOWUTNjFKby2MP7EBtugURFWFxfOhB4+o4yfhrGAdZsxHaqZt6dNce9KXYFSPfGWS68JFqTXSqO7+MCaTqETGTwxSeeoRCOoPT2YUIhFC2jbQF/uwUatU6rPbVUM5T+OfHUO3dWKv6kSsGUIOD6PEPr+fswnanpecFZYVQhFAyjPS9Tj4xw2rcU+pJApEutWsvRjaBW8NUShilkE1JIqlUPfi6VMLNFTBVr+7KYKqJ8uEjlM+dJrR5K0L7eB+9hTd2CFrWYt33h0jH3O5Nj37TBGtgZUBkUN/6q4dQ7UmsnlW450//gU5PPRq460uQXAu+j//i99A/+UdUMoXqbMNkz2OnUkixlF4u9spe/HMTULyEaA7jXkoT2fEbQIXi838DJ4cRDXHkEjc2b0MPHdptZubGpBUbM0UfKQpBRDmKWRSD3tTMk87gddA2WGe4+dkzMD0CyQ5qP/4XVDCAvfkaLMvHamzEClpQzGDF46iuJOH1CaKr2tDZRfzhQ0Ru24NYsYrCM4/jDb+FiHdi3XU/0s3vr7WsGKxcfyPSy+bxi0UqJ8f/IriiE2vrnuWsLefQk8NoO4AMBBB9/XjDI6hQCjdTxq9WCaQ6ULaDFrIeKr3oIlv70Olz2K1xlAVaSUQojD786nKi9e5A3LBHMHn0W+LUUaS1FI9q+iZZWLhHdq/FxFbWSSfsIDIQwVw4g/GK2OuuhloNMzaCaF+DNBJtQfX8LFYigElX0OkQtZKHVy3jqwDlqWncCzPI3nU4t+2FWrH+OLHzHpRl3109memTOhqDi9NfkefHEKvWLTO+VKD68Qf4G27CueFWhJ/Df+0lVFcXJOJYnobm1ZjsJUxuFjyDjK/GNK2gND4ESuDPXcCOSaI7thPqX0ft8OtUn/oTKOQgkET39KJU4RbpZXOtNRW717p+FyRSdYT+v36H4u/fQXbfc3iRDkT3FsTGjWAWEU0OZKfAU9CyEdXVD2lQPduplmo4jkBEbMzK1VgDu5EVTe3gm1RHx6Bcxpz6YLkEO0lMYeFGi6z7eVMqhkT/ZrCb0LNT+NMTRH/nt/BLRdy3X8Nv68Lu6cZEHURjE6K3hirYeLRhDWyA4jxzH40RXJwkeuM29MpN+JcziEsz+Avz6GgcW1pYbUlEQCyHwYpSyxS7rGo+v8man4ZMATrAHf+QSt7FTkWR4QbsjlbIX8IMH0VuuAqj4piGAbhmEPPzI/injnNxMUPuwOtseOIxKKTJ7/8BTBxDdXcjO9sJdTeg01VqH4wg3CDB9bshHMKORbGolVOmeRW09dVdUxkbp3ruNM7GXnS1hK5OYSoSbBDZBcxCBtF3DcUzk6hkhGA0RmtHKx1rOkE04lbzWC1tqMRt1CZHUafPIs8H6/JsNTcgN+9YFq1qgbBUFUvnK9qrVghXCvWN8MBmivueJDtylqaeBKWJaXR4JZEtNyBWrkGt6AJboCZO4J49Rc64xGIhcgtZgm6egKhgtUQQto17WeHOLqCNj5Vowbr7q4j+Lcs1JhhEphcXLTebd0jPwpkx6Lwa++bbCR95ALecp5a6BrvrJoLdHajmMOTnKb3+BrVMntjARpzeFbz8jcfpa22gGm+kMJlm95Zu9M9+iI5G0G3d6EgIUSnjzs/gv/Icgd6rqcvz0IeYWnXc8pEtYnEe8gtXNL7xz74LehHSE3DqNP7EIdx3p5DSh7JNJePiBE/gN3Uz8NWHae5sRJYXqKQvU+raQPg7L6L3/QNMHcfp6EREGjC5LDp9GaOs5VQ/NQI93YctOxFPlwniDh/C3n47JHvrQPTBl3DHjiIDQUQ4jGhOYcqaQFuE0Nl53OnLRHfsZV33KsTxd6GlHeaP477zMl5uAWv7dkyLg6kZREsb+vgCcvPOuoaYuWNQWERs3jAuQ6nooXK6TH566cXnrjQK7uwFaoseWA3oJf2WEhEJUjm/gMgXCfdvQlFFv/R3uCND6FIRv7MfMnOIiaPoI/8NEb2kWAhfoLbdjLr2jmUv/8f+pVbkHRGNnZHum2/udxxtCn4j/vgEIjNTD4O9upfIprUYoxBKo9Z14jumTq7YYD9WayvuR++hs1lkshmha4iuNeDYiIAFMoCevIi+cJHaa29gmvsRTUn0R29g9u1D7bxxv+jrRnpD56cCkdjfV9NzpA+8A5VlLojWAczlGVTAYKXimIU8MlsjtKEXgiF0aRGdm8cEYnXm+O+/gdAGuWsP3shhTHoOEYqCCEF2DsrF5f+e/xiikUldrT6l3z+GevSaTahaZdRY6uFqxRXR1sRyzU/21Gu6OTOMfzmPd6kI8TgiX8B4imouj1QCKmVUNITJ59AnR1F77kH4ZaRnQFroMyeRW3egdt6DwIX391Gshv+4LK2jtcuLqK9t7ALjZXzH1uVM/mb/7BTRnjZEex+idQ2EAnjjR/BdF1PIoV2Bae/F/fh9dL5IYE0XUmpMNo+ev4AINSJWb0UPHa63Z7SvRN3/CHJpFHj2G4iZzAuBbTu+GWpIEGxrQ/3RnlvxG5M4kYa3Lc2u4uyFblnIE+xfAbF2RMtqZGsn/uTYUgHH+dz9eFMnqYx8gO+CEwkjhcDPF/DLHurSaeTm3RiWMsDHeuDrSFvBv3+bi08+N1Vwuj/vZWtu+dwclZlFrESoeZmZysJXoTsCjnVk8dDQBuN+n8RDD9fbcdG7leBX1iOkQjhBOHmQfKGAHW3CS6fR+QClmYuYMyPY265DtPVgtfctiw4V/GcfYfGNQzj3/u4DqlormUoZEQwuc0I//eSnY4G0wPJjmdGhw+mh0fWxNZ0037cXccPd1MXgk+GjNE/tR3+Le+YEyg5TnT6LXlwgcu1u7C99HZlsv3K2+vjvkTs2RvDe3747tm7Dy1SKvzSYPP/MLwxFAkIKEzEye2zswOXX395lJyK0fOFzRHfuglQfqPin59Nn0RNDuJk09vprkd0brmx5H7xCbfgQbrZ83OkfvN1pj0+ZmkBYNhjzCwCeffr/AsBDJyU6kqBwbPzRuTcP/GXV82lYlaJpfQ+BjVdhXX0tNKTAjvzKqKXPTeC++1NKY0c9kVz1SGzb9X8tjIdfzSFCDfUw/noA0scPuxBrwcvmmH3rQIvMm3/y0XdJS4JfIpiIUG9g+wcg6KDnZpGZNDQ0Ii5cSAtlPRHYct13axWvJNwadiiAli4iEP8VAJ89HQtR129TLiG1nos0Nt8dSOi12qi9lRq3utVqT/lirql24hW3vLBQi3d3XUqu73+PZOonBNR/WnbYSMeGTO5/Xf6ZtwDwPwtFRezQVs+sAAAAAElFTkSuQmCC
  37. // @grant GM_xmlhttpRequest
  38. // @grant GM_registerMenuCommand
  39. // @grant GM_unregisterMenuCommand
  40. // @grant GM_openInTab
  41. // @grant GM_getValue
  42. // @grant GM_setValue
  43. // @grant GM_notification
  44. // @grant GM_info
  45. // @grant GM.info
  46. // @grant window.onurlchange
  47. // @grant unsafeWindow
  48. // @license GPL-3.0 License
  49. // @run-at document-end
  50. // @namespace https://github.com/XIU2/UserScript
  51. // @supportURL https://github.com/XIU2/UserScript
  52. // @homepageURL https://github.com/XIU2/UserScript
  53. // @exclude https://*.taobao.com/*
  54. // @exclude https://*.tmall.com/*
  55. // @exclude https://*.1688.com/*
  56. // @exclude https://*.jd.com/*
  57. // @exclude https://*.vip.com/*
  58. // @exclude https://*.suning.com/*
  59. // @exclude https://*.aliexpress.com/*
  60. // @exclude https://*.paypal.com/*
  61. // @exclude https://*.iqiyi.com/*
  62. // @exclude https://*.youku.com/*
  63. // @exclude https://m.v.qq.com/*
  64. // @exclude https://v.qq.com/*
  65. // @exclude https://*.acfun.cn/*
  66. // @exclude https://t.bilibili.com/*
  67. // @exclude https://www.bilibili.com/*
  68. // @exclude https://live.bilibili.com/*
  69. // @exclude https://space.bilibili.com/*
  70. // @exclude https://manga.bilibili.com/*
  71. // @exclude https://member.bilibili.com/*
  72. // @exclude https://message.bilibili.com/*
  73. // @exclude https://*.youtube.com/*
  74. // @exclude https://*.youtube-nocookie.com/*
  75. // @exclude https://*.cnki.net/*
  76. // @exclude https://mail.qq.com/*
  77. // @exclude https://weread.qq.com/*
  78. // @exclude https://*.weread.qq.com/*
  79. // @exclude https://bz.zzzmh.cn/*
  80. // @exclude https://wallhaven.cc/*
  81. // @exclude https://chrome.zzzmh.cn/*
  82. // @exclude https://*.guazi.com/*
  83. // @exclude https://*.liepin.com/*
  84. // @exclude https://*.58.com/*
  85. // ==/UserScript==
  86.  
  87. (function() {
  88. 'use strict';
  89. var menuAll = [
  90. ['menu_disable', '✅ 已启用 (点击对当前网站禁用)', '❌ 已禁用 (点击对当前网站启用)', []],
  91. ['menu_thread', '帖子内自动翻页 (社区类网站)', '帖子内自动翻页 (社区类网站)', true],
  92. ['menu_page_number', '显示当前页码及点击暂停翻页', '显示当前页码及点击暂停翻页', true],
  93. ['menu_pause_page', '左键双击网页空白处暂停翻页', '左键双击网页空白处暂停翻页', false],
  94. ['menu_history', '添加历史记录+修改地址/标题', '添加历史记录+修改地址/标题', true],
  95. ['menu_rules', '更新外置翻页规则 (每天自动)', '更新外置翻页规则 (每天自动)', {}],
  96. ['menu_customRules', '自定义翻页规则', '自定义翻页规则', {}]
  97. ], urlArr = [ // 外置翻页规则更新地址分流,以确保更新成功率(记得 connect)
  98. 'https://userscript.gh2233.ml/other/Autopage/rules.json',
  99. 'https://bitbucket.org/xiu2/userscript/raw/master/other/Autopage/rules.json',
  100. 'https://gitea.com/XIU2/UserScript/raw/branch/master/other/Autopage/rules.json',
  101. 'https://raw.fastgit.org/XIU2/UserScript/master/other/Autopage/rules.json',
  102. 'https://raw.iqiq.io/XIU2/UserScript/master/other/Autopage/rules.json',
  103. 'https://raw.kgithub.com/XIU2/UserScript/master/other/Autopage/rules.json',
  104. 'https://ghproxy.net/https://raw.githubusercontent.com/XIU2/UserScript/master/other/Autopage/rules.json',
  105. 'https://gh-proxy-download.moeyy.cn/gh-proxy/https:/raw.githubusercontent.com/XIU2/UserScript/master/other/Autopage/rules.json',
  106. 'https://raw.njuu.cf/XIU2/UserScript/master/other/Autopage/rules.json',
  107. //'https://ghproxy.futils.com/https://github.com/XIU2/UserScript/blob/master/other/Autopage/rules.json',
  108. //'https://ghproxy.fsofso.com/https://github.com/XIU2/UserScript/blob/master/other/Autopage/rules.json',
  109. //'https://raw.xn--p8jhe.tw/XIU2/UserScript/master/other/Autopage/rules.json',
  110. //'https://git.yumenaka.net/https://raw.githubusercontent.com/XIU2/UserScript/master/other/Autopage/rules.json',
  111. //'https://raw.cithub.icu/XIU2/UserScript/master/other/Autopage/rules.json',
  112. //'https://raw-gh.gcdn.mirr.one/XIU2/UserScript/master/other/Autopage/rules.json',
  113. 'https://cdn.staticaly.com/gh/XIU2/UserScript/master/other/Autopage/rules.json',
  114. 'https://gcore.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json',
  115. 'https://fastly.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json',
  116. 'https://raw.githubusercontents.com/XIU2/UserScript/master/other/Autopage/rules.json'
  117. ], urlArr2 = [
  118. 'https://userscript.gh2233.ml/other/Autopage/rules.json',
  119. 'https://userscript.xiu2.xyz/other/Autopage/rules.json',
  120. 'https://bitbucket.org/xiu2/userscript/raw/master/other/Autopage/rules.json',
  121. 'https://gitea.com/XIU2/UserScript/raw/branch/master/other/Autopage/rules.json',
  122. 'https://raw.fastgit.org/XIU2/UserScript/master/other/Autopage/rules.json',
  123. 'https://raw.iqiq.io/XIU2/UserScript/master/other/Autopage/rules.json',
  124. 'https://raw.kgithub.com/XIU2/UserScript/master/other/Autopage/rules.json',
  125. 'https://ghproxy.net/https://raw.githubusercontent.com/XIU2/UserScript/master/other/Autopage/rules.json',
  126. 'https://gh-proxy-download.moeyy.cn/gh-proxy/https:/raw.githubusercontent.com/XIU2/UserScript/master/other/Autopage/rules.json',
  127. 'https://raw.njuu.cf/XIU2/UserScript/master/other/Autopage/rules.json'
  128. //'https://ghproxy.futils.com/https://github.com/XIU2/UserScript/blob/master/other/Autopage/rules.json',
  129. //'https://ghproxy.fsofso.com/https://github.com/XIU2/UserScript/blob/master/other/Autopage/rules.json',
  130. //'https://raw.xn--p8jhe.tw/XIU2/UserScript/master/other/Autopage/rules.json',
  131. //'https://git.yumenaka.net/https://raw.githubusercontent.com/XIU2/UserScript/master/other/Autopage/rules.json'
  132. ],
  133. loadMoreExclude1 = ['stackoverflow.com'],
  134. loadMoreExclude2 = ['.smzdm.com','.steampowered.com','.zcool.com.cn','.baidu.com'],
  135. menuId = [], webType = 0, curSite = {SiteTypeID: 0}, DBSite, DBSite2, pausePage = true, pageNum = {now: 1, _now: 1}, urlC = false, nowLocation = '', lp = location.pathname, scriptHandler;
  136. 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}
  137. if (typeof GM_info != 'undefined') {scriptHandler = GM_info.scriptHandler;} else if (typeof GM != 'undefined' && typeof GM.info != 'undefined') {scriptHandler = GM.info.scriptHandler;} else {scriptHandler = '';}
  138. for (let i=0;i<menuAll.length;i++){ // 如果读取到的值为 null 就写入默认值
  139. if (GM_getValue(menuAll[i][0]) == null){GM_setValue(menuAll[i][0], menuAll[i][3])};
  140. }
  141.  
  142. getRulesUrl();
  143. registerMenuCommand();
  144. if (menuId.length < 4) {return}
  145. // 注册(不可用)脚本菜单
  146. function registerMenuCommand() {
  147. if (menuId.length != []){
  148. for (let i=0;i<menuId.length;i++){
  149. GM_unregisterMenuCommand(menuId[i]);
  150. }
  151. }
  152. for (let i=0;i<menuAll.length;i++) { // 循环注册(不可用)脚本菜单
  153. menuAll[i][3] = GM_getValue(menuAll[i][0]);
  154.  
  155. if (menuAll[i][0] === 'menu_disable') { // 启用/禁用
  156.  
  157. if (menu_disable('check')) { // 当前网站在禁用列表中
  158. menuId[i] = GM_registerMenuCommand(`${menuAll[i][2]}`, function(){menu_disable('del')});
  159. return
  160. } else { // 不在禁用列表中
  161. webType = doesItSupport(); // 判断网站类型(即是否支持),顺便直接赋值
  162. if (webType === 0) {
  163. menuId[0] = GM_registerMenuCommand('❌ 当前网页暂不支持 [点击申请]', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://gf.qytechs.cn/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});});
  164. menuId[1] = GM_registerMenuCommand('🔄 更新外置翻页规则 (每天自动)', function(){getRulesUrl(true)});
  165. menuId[2] = GM_registerMenuCommand('#️⃣ 自定义翻页规则', function(){customRules()});
  166. console.info('[自动无缝翻页] - 暂不支持当前网页 [ ' + location.href + ' ],申请支持: https://github.com/XIU2/UserScript / https://gf.qytechs.cn/zh-CN/scripts/419215/feedback');
  167. return
  168. } else if (webType === -1) {
  169. return
  170. }
  171. menuId[i] = GM_registerMenuCommand(`${menuAll[i][1]}`, function(){menu_disable('add')});
  172. }
  173.  
  174. } else if (menuAll[i][0] === 'menu_rules') {
  175. menuId[i] = GM_registerMenuCommand(`🔄 ${menuAll[i][1]}`, function(){getRulesUrl(true)});
  176.  
  177. } else if (menuAll[i][0] === 'menu_customRules') {
  178. menuId[i] = GM_registerMenuCommand(`#️⃣ ${menuAll[i][1]}`, function(){customRules()});
  179.  
  180. } else {
  181. menuId[i] = GM_registerMenuCommand(`${menuAll[i][3]?'✅':'❌'} ${menuAll[i][1]}`, function(){menu_switch(menuAll[i][3], menuAll[i][0], menuAll[i][2])});
  182. }
  183. }
  184. menuId[menuId.length] = GM_registerMenuCommand('💬 反馈失效 / 申请支持', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://gf.qytechs.cn/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});});
  185. }
  186.  
  187.  
  188. // --------------------------------------------------------
  189.  
  190.  
  191. // 判断是支持
  192. function doesItSupport() {
  193. setDBSite(); // 配置 DBSite 变量对象
  194.  
  195. // 遍历判断是否是某个已支持的网站,顺便直接赋值
  196. let support = false;
  197. end:
  198. for (let now in DBSite) { // 遍历 对象
  199. if (!DBSite[now].host) continue; // 如果不存在则继续下一个循环
  200. // 如果是 数组
  201.  
  202. if (Array.isArray(DBSite[now].host)) {
  203.  
  204. for (let i of DBSite[now].host) { // 遍历 数组
  205.  
  206. // 针对自定义翻页规则中的正则
  207. if (typeof i === 'string' && i.slice(0,1) === '/') i = new RegExp(i.slice(1,i.length-1))
  208. if ((i instanceof RegExp && i.test(location.hostname)) || (typeof i === 'string' && i === location.hostname)) {
  209.  
  210. if (self != top) {if (!DBSite[now].iframe) continue end;} // 如果当前位于 iframe 框架下,就需要判断是否需要继续执行
  211. if (DBSite[now].url) {
  212. if (typeof DBSite[now].url == 'function') {
  213. DBSite[now].url();
  214. } else { // 自定义翻页规则时,因为同域名不同页面 url 分开写,所以如果没找到就需要跳出当前数组循环,继续规则循环
  215. try {
  216. if (DBSite[now].url.slice(0,1) === '/') { // 如果是正则,则对 URL 路径进行匹配
  217. if (new RegExp(DBSite[now].url.slice(1,DBSite[now].url.length-1), 'i').test(location.pathname + location.search) === true) {curSite = DBSite[now];} else {if (urlC === true) {support = true;}; break;}
  218. } else { // 如果是函数,那就执行代码
  219. if (new Function('fun', DBSite[now].url)(window.autoPage)) {curSite = DBSite[now];} else {if (urlC === true) {support = true;}; break;}
  220. }
  221. } catch (e) {
  222. console.error('[自动无缝翻页] - 当前网页规则 "url" 有误,请检查!', e, DBSite[now].url);
  223. }
  224. }
  225. } else {
  226. curSite = DBSite[now];
  227. }
  228. support = true; break end; // 如果找到了就退出所有循环
  229. }
  230. }
  231.  
  232. // 如果是 正则/字符串
  233. } else {
  234. // 针对自定义翻页规则中的正则
  235. if (typeof DBSite[now].host === 'string' && DBSite[now].host.slice(0,1) === '/') DBSite[now].host = new RegExp(DBSite[now].host.slice(1,DBSite[now].host.length-1))
  236. if ((DBSite[now].host instanceof RegExp && DBSite[now].host.test(location.hostname)) || (typeof DBSite[now].host === 'string' && DBSite[now].host === location.hostname)) {
  237.  
  238. if (self != top) {if (!DBSite[now].iframe) continue;} // 如果当前位于 iframe 框架下,就需要判断是否需要继续执行
  239. if (DBSite[now].url) {
  240. if (typeof DBSite[now].url == 'function') {
  241. DBSite[now].url();
  242. } else { // 自定义翻页规则时,因为同域名不同页面 url 分开写,所以如果没找到就需要继续规则循环
  243. try {
  244. if (DBSite[now].url.slice(0,1) === '/') { // 如果是正则,则对 URL 路径进行匹配
  245. if (new RegExp(DBSite[now].url.slice(1,DBSite[now].url.length-1), 'i').test(location.pathname + location.search) === true) {curSite = DBSite[now];} else {if (urlC === true) {support = true;}; continue;}
  246. } else { // 如果是函数,那就执行代码
  247.  
  248. if (new Function('fun', DBSite[now].url)(window.autoPage)) {curSite = DBSite[now];} else {if (urlC === true) {support = true;}; continue;}
  249.  
  250. }
  251. } catch (e) {
  252. console.error('[自动无缝翻页] - 当前网页规则 "url" 有误,请检查!', e, DBSite[now].url);
  253. }
  254. }
  255. } else {
  256. curSite = DBSite[now];
  257. }
  258. support = true; break; // 如果找到了就退出循环
  259. }
  260. }
  261. }
  262.  
  263. if (support) {
  264. console.info('[自动无缝翻页] - 独立规则 网站'); return 1;
  265. } else if (self != top) {
  266. return -1;
  267. } else if (typeof discuz_uid != 'undefined' || getCSS('meta[name="author" i][content*="Discuz!" i], meta[name="generator" i][content*="Discuz!" i], body[id="nv_forum" i][class^="pg_" i][onkeydown*="27"], body[id="nv_search" i][onkeydown*="27"]') || getXpath('id("ft")[contains(string(),"Discuz!")]')) {
  268. console.info(`[自动无缝翻页] - <Discuz!> 论坛`); return 2;
  269.  
  270. } else if (typeof flarum != 'undefined' || getCSS('#flarum-loading')) {
  271. console.info(`[自动无缝翻页] - <Flarum> 论坛`); return 3;
  272.  
  273. } else if (typeof phpbb != 'undefined' || getCSS('body#phpbb')) {
  274. console.info(`[自动无缝翻页] - <phpBB> 论坛`); return 4;
  275.  
  276. } else if (typeof xn != 'undefined' && getXpath('//footer//a[contains(string(), "Xiuno")] | //link[contains(@href, "xiuno")] | //script[contains(@src, "xiuno")]')) {
  277. console.info(`[自动无缝翻页] - <Xiuno> 论坛`); return 5;
  278.  
  279. } else if (typeof XF != 'undefined') {
  280. console.info(`[自动无缝翻页] - <XenForo> 论坛`); return 6;
  281.  
  282. } else if (getCSS('head meta[name="generator" i][content="nexusphp" i]') || getXpath('id("footer")[contains(string(), "NexusPHP")]')) {
  283. console.info(`[自动无缝翻页] - <NexusPHP> 论坛`); return 7;
  284.  
  285. } else if (loadMoreExclude(loadMoreExclude1) && getAllCSS('.load-more, .load_more, .loadmore, #load-more, #load_more, #loadmore, .show-more, .show_more').length === 1) {
  286. console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 1`); return 8;
  287.  
  288. } else if (loadMoreExclude(loadMoreExclude2) && getAllXpath('//*[self::a or self::span or self::button or self::div][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]').length === 1) {
  289. console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 2`); return 9;
  290.  
  291. } else if (getCSS('link[href*="/wp-content/" i], script[src*="/wp-content/" i]')) {
  292.  
  293. //if (getAllCSS('article[class], div[id^="post-"], ul[class*="post"]>li.item, .post').length < 4 || getCSS('#nav-below, nav.navigation, nav.paging-navigation, .pagination, .wp-pagenavi, .pagenavi')) return 0;
  294.  
  295. if (getCSS('.post-page-numbers.current+a')) {
  296. if (getAllCSS('.entry-content').length == 1) {
  297. DBSite.wp_article_post.pager.pageE = '.entry-content>*:not(.wbp-cbm):not(.page-links):not(.article-paging):not(.entry-pagination):not(.pagination)'
  298. } else if (getAllCSS('.article-content').length == 1) {
  299. DBSite.wp_article_post.pager.pageE = '.article-content>*:not(.page-links):not(.article-paging):not(.entry-pagination):not(.pagination)'
  300. } else if (getAllCSS('article').length == 1) {
  301. DBSite.wp_article_post.pager.pageE = 'article>*:not(.page-links):not(.article-paging):not(.entry-pagination):not(.pagination)'
  302. }
  303. if (DBSite.wp_article_post.pager.pageE != undefined) console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 - 文章内`); return 11;
  304. }
  305.  
  306. if (getCSS('a.next, a.next-page')) {
  307. DBSite.wp_article.pager.nextL = 'a.next, a.next-page'
  308. } else if (getCSS('a[rel="next" i], a[aria-label="Next Page" i], a[aria-label="下一页"], a[rel="下一页"], a[title="下一页"], a[aria-label="下一頁"], a[rel="下一頁"], a[title="下一頁"]')) {
  309. DBSite.wp_article.pager.nextL = 'a[rel="next" i], a[aria-label="Next Page" i], a[aria-label="下一页"], a[rel="下一页"], a[title="下一页"], a[aria-label="下一頁"], a[rel="下一頁"], a[title="下一頁"]'
  310. } else if (getCSS('li.next-page > a, li.next > a, li.pagination-next>a')) {
  311. DBSite.wp_article.pager.nextL = 'li.next-page > a, li.next > a, li.pagination-next>a'
  312. } else if (getCSS('span.current+a')) {
  313. DBSite.wp_article.pager.nextL = 'span.current+a'
  314. } else if (getCSS('.nav-previous a, a.nav-previous')) {
  315. DBSite.wp_article.pager.nextL = '.nav-previous a, a.nav-previous'
  316. } else if (getXpath('//a[contains(text(), "下一页") or contains(text(), "下一頁") or contains(text(), ">") or contains(text(), "next") or contains(text(), "Next") or contains(text(), "NEXT")]', getCSS('#nav-below, nav.navigation, nav.paging-navigation, .pagination:not([class*="entry"]), .wp-pagenavi, .pagenavi, nav[role="navigation"]'))) {
  317. DBSite.wp_article.pager.nextL = '//*[self::ul or self::nav or self::div][@id="nav-below" or contains(@class, "navigation") or contains(@class, "pagination") or contains(@class, "pagenavi") or @role="navigation"]//a[contains(text(), "下一页") or contains(text(), "下一頁") or contains(text(), ">") or contains(text(), "next") or contains(text(), "Next") or contains(text(), "NEXT")]'
  318. }
  319.  
  320. if (DBSite.wp_article.pager.nextL != undefined) {
  321. if (getAllCSS('main').length == 1) {
  322. if (getAllCSS('main article[class]').length > 3) {
  323. DBSite.wp_article.pager.pageE = 'main article[class]'
  324. } else if (getAllCSS('main div[id^="post-"]').length > 3) {
  325. DBSite.wp_article.pager.pageE = 'main div[id^="post-"]'
  326. } else if (getAllCSS('main .post').length > 3) {
  327. DBSite.wp_article.pager.pageE = 'main .post'
  328. }
  329. if (DBSite.wp_article.pager.pageE != undefined) {console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站`); return 10;}
  330. }
  331.  
  332. if (getAllCSS('article[class]').length > 3) {
  333. DBSite.wp_article.pager.pageE = 'article[class]'
  334. } else if (getAllCSS('div[id^="post-"]').length > 3) {
  335. DBSite.wp_article.pager.pageE = 'div[id^="post-"]'
  336. } else if (getAllCSS('ul[class*="post"]>li.item').length > 3) {
  337. DBSite.wp_article.pager.pageE = 'ul[class*="post"]>li.item'
  338. } else if (getAllCSS('.post').length > 3) {
  339. DBSite.wp_article.pager.pageE = '.post'
  340. } else if (getAllCSS('#posts, .posts').length == 1) {
  341. DBSite.wp_article.pager.pageE = '#posts, .posts'
  342. }
  343. if (DBSite.wp_article.pager.pageE != undefined) {console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站`); return 10;}
  344. }
  345. } else if (getCSS('meta[name="template" i][content="handsome" i]') && getCSS('.page-navigator')) {
  346. console.info(`[自动无缝翻页] - 部分使用 Typecho 的网站 (handsome)`); return 12;
  347. } else if (getCSS('meta[name="template" i][content="Mirages" i]') && getCSS('.page-navigator')) {
  348. console.info(`[自动无缝翻页] - 部分使用 Typecho 的网站 (Mirages)`); return 13;
  349.  
  350. } else if (getCSS('.stui-page, .stui-page__item, #long-page, .myui-page, .myui-page__item')) {
  351. console.info(`[自动无缝翻页] - 部分影视网站`); return 300;
  352. } else if (getCSS('#page') && getCSS('.module-items')) {
  353. console.info(`[自动无缝翻页] - 部分影视网站 2`); return 301;
  354.  
  355. } else if (getCSS('.ArticleImageBox, .PictureList') && getCSS('.article_page') && getXpath('//div[contains(@class,"article_page")]//a[text()="下一页"]')) {
  356. console.info(`[自动无缝翻页] - 部分美女图站 - 手机版`); return 302;
  357.  
  358. } else if (getCSS('.content > #content') && getXpath('//div[contains(@class,"page_chapter")]//a[text()="下一章"]')) {
  359. console.info(`[自动无缝翻页] - <笔趣阁 1> 模板的小说网站`); return 200;
  360. } else if (getCSS('#nr1, #chaptercontent, .Readarea, .ReadAjax_content') && getCSS('#pb_next, #linkNext')) {
  361. console.info(`[自动无缝翻页] - <笔趣阁 1 - 手机版> 模板的小说网站`); return 201;
  362. } else if (getCSS('#txt, .txt') && getCSS('#pb_next, .url_next') && getCSS('.chapter-control, .chapter-page-btn')) {
  363. console.info(`[自动无缝翻页] - <笔趣阁 2> 模板的小说网站`); return 202;
  364. } else if ((getCSS('meta[name="description" i][content*="小说"], meta[name="description" i][content*="章节"], meta[name="description" i][content*="阅读"]') || location.hostname.indexOf('biqu')!=-1 || document.title.match(/笔趣阁|小说|章/)!=null) && (getCSS('[id="content" i], [class~="content" i], [id="chaptercontent" i], [class~="chaptercontent" i], [id="booktext" i], [id="txtcontent" i], [class~="txtnav" i]') && getXpath('//a[contains(text(), "下一章") or contains(text(), "下一页") or contains(text(), "下一节")]'))) {
  365. console.info(`[自动无缝翻页] - <笔趣阁 3> 模板的小说网站`); return 203;
  366. } else if (getCSS('meta[content^=SearXNG i], link[href*=SearXNG i], script[src*=SearXNG i]')) {
  367. console.info(`[自动无缝翻页] - <SearXNG> 元搜索引擎`); return 303;
  368. }
  369. return 0;
  370. }
  371. // 判断网站类型
  372. function webTypeIf() {
  373. if (webType != 1) {
  374. switch (webType) {
  375. case 2: // < 所有 Discuz!论坛 >
  376. discuz_(); break;
  377. case 3: // < 所有 Flarum 论坛 >
  378. DBSite.flarum.url(); break;
  379. case 4: // < 所有 phpBB 论坛 >
  380. DBSite.phpbb.url(); break;
  381. case 5: // < 所有 Xiuno 论坛 >
  382. DBSite.xiuno.url(); break;
  383. case 6: // < 所有 XenForo 论坛 >
  384. DBSite.xenforo.url(); break;
  385. case 7: // < 所有 NexusPHP 论坛 >
  386. DBSite.nexusphp.url(); break;
  387. case 8: // < 部分自带 自动无缝翻页 的网站 1 >
  388. DBSite.loadmore.url('.load-more, .load_more, .loadmore, #load-more, #load_more, #loadmore, .show-more, .show_more'); break;
  389. case 9: // < 部分自带 自动无缝翻页 的网站 2 >
  390. DBSite.loadmore.url('//*[self::a or self::span or self::button or self::div][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]'); break;
  391. case 10: // < 部分使用 WordPress 的网站 >
  392. DBSite.wp_article.url(); break;
  393. case 11: // < 部分使用 WordPress 的网站 - 文章内 >
  394. curSite = DBSite.wp_article_post; break;
  395. case 12: // < 部分使用 Typecho 的网站 (handsome) >
  396. curSite = DBSite.typecho_handsome; break;
  397. case 13: // < 部分使用 Typecho 的网站 (Mirages) >
  398. curSite = DBSite.typecho_mirages; break;
  399. case 200: // < 所有使用 笔趣阁 1 模板的小说网站 >
  400. DBSite.biquge1.url(); break;
  401. case 201: // < 所有使用 笔趣阁 1 - 手机版 模板的小说网站 >
  402. curSite = DBSite.biquge1_m; break;
  403. case 202: // < 所有使用 笔趣阁 2 模板的小说网站 >
  404. DBSite.biquge2.url(); break;
  405. case 203: // < 所有使用 笔趣阁 3 模板的小说网站 >
  406. curSite = DBSite.biquge3; break;
  407. case 300: // < 部分影视网站 >
  408. curSite = DBSite.yingshi; break;
  409. case 301: // < 部分影视网站 2 >
  410. curSite = DBSite.yingshi2; break;
  411. case 302: // < 部分美女图站 - 手机版 >
  412. curSite = DBSite.meinvtu_m; break;
  413. case 303: // < SearXNG 元搜索引擎 >
  414. document.cookie='infinite_scroll=1; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/';
  415. document.cookie='results_on_new_tab=1; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/';
  416. break;
  417. }
  418. }
  419. }
  420. // 内置翻页规则
  421. function setDBSite() {
  422. /*
  423. url: 匹配到该域名后要执行的函数/正则(一般用于根据 URL 分配相应翻页规则)
  424. urlC: 对于使用 pjax 技术的网站,需要监听 URL 变化来重新判断翻页规则(需要放在 url: 中,自定义规则的话需要使用 fun.isUrlC())
  425.  
  426. noReferer: 获取下一页内容时,不携带 Referer(部分网站携带与不携带可能不一样)
  427. hiddenPN: 不显示脚本左下角的页码
  428. history: 添加历史记录 并 修改当前 URL(默认开启,对于不支持的网站要设置为 false)
  429. thread: 对于社区类网站,要在 帖子内 的规则中加入这个,用于脚本的 [帖子内自动翻页] 功能(即用户可以选择开启/关闭所有社区类网站帖子内的自动翻页)
  430. style: 要插入网页的 CSS Style 样式
  431. retry: 允许获取失败后重试
  432. blank: 强制新标签页打开链接(1 = <base>,2 = 对 body 点击事件委托,3 = 仅对 pageE 的父元素点击事件委托,4 = 仅对 pageE 的父元素添加 target="_blank")
  433.  
  434. pager: {
  435. type: 翻页模式
  436. 1 = 由脚本实现自动无缝翻页,可省略(适用于:静态加载内容网站,常规模式)
  437.  
  438. 2 = 只需要点击下一页按钮(适用于:网站自带了 自动无缝翻页 功能)
  439. nextText: 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页,下同)
  440. nextTextOf: 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页
  441. nextHTML: 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页
  442. interval: 点击间隔时间,对于没有按钮文字变化的按钮,可以手动指定间隔时间(单位 ms,默认 500,当指定上面三个时,会忽略 interval)
  443. isHidden: 只有下一页按钮可见时(没有被隐藏),才会点击
  444.  
  445. 3 = 依靠 [基准元素] 与 [浏览器可视区域底部] 之间的距离缩小来触发翻页(适用于:主体元素下方内容太多 且 高度不固定时)
  446. scrollE: 作为基准线的元素(一般为底部页码元素),和 replaceE 一样的话可以省略
  447. scrollD: 基准元素 - 可视区域底部
  448.  
  449. 4 = 动态加载类网站(适用于:简单的动态加载内容网站)
  450. insertE: 用来插入元素的函数
  451.  
  452. 5 = 插入 iframe 方式来加载下一页,无限套娃(适用于:部分动态加载内容的网站,需要允许 iframe 且支持通过 GET/POST 直接打开下一页)
  453. style: 加载 iframe 前要插入的 CSS Style 样式(比如为了悬浮的样式与下一页的重叠,隐藏网页底部间距提高阅读连续性)
  454. iframe: 这个必须加到 pager{} 外面(这样才会在该域名的 iframe 框架下运行脚本)
  455.  
  456. 6 = 通过 iframe 获取下一页动态加载内容插入本页,只有一个娃(适用于:部分动态加载内容的网站,与上面不同的是,该模式适合简单的网页,没有复杂事件什么的)
  457. loadTime: 预留的网页加载时间,确保网页内容加载完成
  458.  
  459. nextL: 下一页链接所在元素
  460. pageE: 要从下一页获取的元素
  461. insertP: 下一页元素插入本页的位置(数组第一个是基准元素,第二个是基准元素的前后具体位置)
  462. 1 = 插入基准元素自身的前面
  463. 2 = 插入基准元素内,第一个子元素前面
  464. 3 = 插入基准元素内,最后一个子元素后面
  465. 4 = 插入基准元素自身的后面
  466. 5 = 插入 pageE 列表最后一个元素的后面(该 insertP 可以直接省略不写,等同于 ['pageE', 5] )
  467. 6 = 插入该元素自身内部末尾(针对小说网站等文本类的),附带参数 insertP6Br: true, 用来中间插入换行
  468. // 小技巧:当基准元素是下一页主体元素的父元素时(或者说要将下一页元素插入到本页同元素最后一个后面时)是可以省略不写 insertP
  469. 例如:当 pageE: 'ul>li' 且 insertP: ['ul', 3] 时,实际等同于 ['ul>li', 5]
  470. 当 pageE: '.item' 且 insertP: ['.item', 4] 时,实际等同于 ['.item', 5]
  471. 当 pageE: '.item' 且 insertP: ['.page', 1] 时,实际等同于 ['.item', 5]
  472. 注意:如 pageE 中选择了多类元素,则不能省略 insertP(比如包含 `,` 与 `|` 符号),除非另外的选择器是 <script> <style> <link> 标签
  473.  
  474. replaceE: 要替换为下一页内容的元素(比如页码)
  475. scrollD: 翻页动作触发点([滚动条] 与 [网页底部] 之间的距离),数值越大,越早开始翻页,一般是访问网页速度越慢,该值就需要越大,省略后默认 2000
  476.  
  477. scriptT: 单独插入 <script> 标签
  478. 0 = 下一页的所有 <script> 标签
  479. 1 = 下一页的所有 <script> 标签(不包括 src 链接)
  480. 2 = 下一页主体元素 (pageE) 的同级 <script> 标签
  481. 3 = 下一页主体元素 (pageE) 的子元素 <script> 标签
  482.  
  483. interval: 翻页后间隔时间(单位 ms)
  484. forceHTTPS: 下一页链接强制 HTTPS
  485. },
  486. function: {
  487. bF = 插入前执行函数
  488. bFp = 参数
  489. aF = 插入后执行函数
  490. aFp = 参数
  491. }
  492. */ //<<< 规则简单说明 >>>
  493. DBSite = {
  494. loadmore: {
  495. url: function(nextL) {curSite = DBSite.loadmore; curSite.pager.nextL = nextL;},
  496. pager: {
  497. type: 2,
  498. isHidden: true,
  499. interval: 1000
  500. }
  501. }, // 部分自带 自动无缝翻页 的网站
  502. wp_article: {
  503. url: ()=> {
  504. if (!indexOF('/post/') && !getCSS('#comments, .comments-area, #disqus_thread')) {
  505. curSite = DBSite.wp_article;
  506. // 自适应瀑布流样式
  507. setTimeout(()=>{if (getCSS(curSite.pager.pageE).style.cssText.indexOf('position: absolute') != -1){insStyle(curSite.pager.pageE + '{position: static !important; float: left !important; height: '+ parseInt(getCSS(curSite.pager.pageE).offsetHeight * 1.1) + 'px !important;}');}}, 1500);
  508. }
  509. },
  510. style: 'img[data-src], img[data-original] {opacity: 1 !important;}',
  511. blank: 3,
  512. pager: {
  513. replaceE: '#nav-below, nav.navigation, nav.paging-navigation, .pagination:not([class*="entry"]), .wp-pagenavi, .pagenavi, nav[role="navigation"]',
  514. forceHTTPS: true,
  515. scrollD: 3000
  516. },
  517. function: {
  518. bF: src_bF
  519. }
  520. }, // 部分使用 WordPress 的网站
  521. wp_article_post: {
  522. pager: {
  523. type: 3,
  524. nextL: '.post-page-numbers.current+a',
  525. replaceE: '//a[contains(@class,"post-page-numbers")]/parent::*',
  526. scrollD: 3000
  527. },
  528. function: {
  529. bF: src_bF
  530. }
  531. }, // 部分使用 WordPress 的网站 - 文章内
  532. typecho_handsome: {
  533. blank: 3,
  534. pager: {
  535. nextL: 'li.next>a',
  536. pageE: '.blog-post, .post-list',
  537. replaceE: '.page-navigator'
  538. }
  539. }, // 部分使用 Typecho 的网站 (handsome)
  540. typecho_mirages: {
  541. blank: 3,
  542. pager: {
  543. nextL: 'li.next>a',
  544. pageE: '#index>article, #archive>article',
  545. scriptT: 3,
  546. replaceE: '.page-navigator'
  547. }
  548. }, // 部分使用 Typecho 的网站 (Mirages)
  549. biquge1: {
  550. url: ()=> {curSite = DBSite.biquge1;xs_bF(getAllCSS('.content > #content'),[/<br>.{0,10}秒记住.+$/, '']);},
  551. style: 'img, .posterror, a[href*="posterror()"], [style*="background"][style*="url("]:not(html):not(body), #content > *:not(br):not(p) {display: none !important;}',
  552. history: true,
  553. pager: {
  554. nextL: '//div[@class="page_chapter"]//a[text()="下一章"]',
  555. pageE: '.content > #content',
  556. insertP: ['.content > #content', 6],
  557. replaceE: '.page_chapter'
  558. },
  559. function: {
  560. bF: xs_bF,
  561. bFp: [/<br>.{0,10}秒记住.+$/, '']
  562. }
  563. }, // 笔趣阁 1 模板的小说网站
  564. biquge1_m: {
  565. style: 'img, .posterror, .show-app2, a[href*="posterror()"], [onclick*="location.href"], [style*="background"][style*="url("]:not(html):not(body), #nr1>*:not(br):not(p), #chaptercontent>*:not(br):not(p), .Readarea>*:not(br):not(p), .ReadAjax_content>*:not(br):not(p) {display: none !important;}',
  566. history: true,
  567. pager: {
  568. nextL: '#pb_next, #linkNext',
  569. pageE: '#nr1, #chaptercontent, .Readarea, .ReadAjax_content',
  570. insertP: ['#nr1, #chaptercontent, .Readarea, .ReadAjax_content', 6],
  571. replaceE: '//a[@id="pb_next" or @id="linkNext"]/parent::*'
  572. }
  573. }, // 笔趣阁 2 - 手机版 模板的小说网站
  574. biquge2: {
  575. url: ()=> {if (isMobile() || getCSS('.chapter-page-btn') != null) {curSite = DBSite.biquge2_m;} else {curSite = DBSite.biquge2;}},
  576. style: 'img, .posterror, a[href*="posterror()"], [style*="background"][style*="url("]:not(html):not(body), #txt > *:not(br):not(p) {display: none !important;}',
  577. history: true,
  578. pager: {
  579. type: 6,
  580. nextL: '#pb_next, .url_next',
  581. pageE: '#txt, .txt',
  582. insertP: ['#txt, .txt', 6],
  583. replaceE: '.chapter-control, .chapter-page-btn',
  584. loadTime: 1500,
  585. scrollD: 3500
  586. }
  587. }, // 笔趣阁 3 模板的小说网站
  588. biquge2_m: {
  589. style: 'img, .posterror, a[href*="posterror()"], [style*="background"][style*="url("]:not(html):not(body), #txt > *:not(br):not(p) {display: none !important;}',
  590. history: true,
  591. pager: {
  592. nextL: '#pb_next, .url_next',
  593. pageE: '#txt, .txt',
  594. insertP: ['#txt, .txt', 6],
  595. replaceE: '.chapter-control, .chapter-page-btn'
  596. }
  597. }, // 笔趣阁 3 - 手机版 模板的小说网站
  598. biquge3: {
  599. style: 'img, .posterror, a[href*="posterror()"], [style*="background"][style*="url("]:not(html):not(body), script+div[style="padding:15px;"] {display: none !important;}',
  600. history: true,
  601. pager: {
  602. nextL: '//a[contains(text(), "下一章") or contains(text(), "下一页") or contains(text(), "下一节")]',
  603. pageE: '[id="content" i], [class~="content" i], [id="chaptercontent" i], [class~="chaptercontent" i], [id="booktext" i], [id="txtcontent" i], [class~="txtnav" i]',
  604. insertP: ['[id="content" i], [class~="content" i], [id="chaptercontent" i], [class~="chaptercontent" i], [id="booktext" i], [id="txtcontent" i], [class~="txtnav" i]', 6],
  605. insertP6Br: true,
  606. replaceE: '//a[contains(text(), "下一章") or contains(text(), "下一页") or contains(text(), "下一节")]/parent::*'
  607. },
  608. function: {
  609. bF: xs_bF,
  610. bFp: [/<br>.{0,10}秒记住.+$/, '']
  611. }
  612. }, // 笔趣阁 4 模板的小说网站
  613. yingshi: {
  614. style: 'div.stui-page__all, div.myui-page__all {display: none !important;}',
  615. blank: 3,
  616. pager: {
  617. nextL: '.stui-page li.active+li>a, .stui-page__item li.active+li>a, #long-page .active+li>a, .myui-page .visible-xs+li>a',
  618. pageE: '.stui-vodlist, .myui-vodlist>li, #content, #searchList',
  619. replaceE: '.stui-page, .stui-page__item, #long-page, .myui-page, .myui-page__item'
  620. },
  621. function: {
  622. bF: src_bF,
  623. bFp: [1, '[data-original]', 'data-original']
  624. }
  625. }, // 部分影视网站
  626. yingshi2: {
  627. blank: 3,
  628. pager: {
  629. nextL: '#page a[title="下一页"], a.page-number.page-next',
  630. pageE: '.module-items>*',
  631. replaceE: '#page'
  632. },
  633. function: {
  634. bF: src_bF
  635. }
  636. }, // 部分影视网站 2
  637. meinvtu_m: {
  638. history: true,
  639. blank: 3,
  640. pager: {
  641. type: 3,
  642. nextL: '//div[contains(@class,"article_page")]//a[text()="下一页"]',
  643. pageE: '.ArticleImageBox, .PictureList',
  644. replaceE: '.article_page',
  645. scrollD: 500
  646. }
  647. }, // 部分美女图站 - 手机版
  648. discuz_forum: {
  649. pager: {
  650. type: 2,
  651. nextL: '#autopbn',
  652. nextTextOf: '下一'
  653. }
  654. }, // Discuz! 论坛 - 帖子列表(自带无缝加载下一页按钮的)
  655. discuz_guide: {
  656. pager: {
  657. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  658. pageE: 'tbody[id^="normalthread_"]',
  659. replaceE: '.pg, .pages',
  660. forceHTTPS: true
  661. }
  662. }, // Discuz! 论坛 - 导读页 及 帖子列表(不带无缝加载下一页按钮的)
  663. discuz_waterfall: {
  664. pager: {
  665. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  666. pageE: '#waterfall > li',
  667. replaceE: '.pg, .pages',
  668. forceHTTPS: true
  669. }
  670. }, // Discuz! 论坛 - 图片模式的帖子列表(不带无缝加载下一页按钮的)
  671. discuz_thread: {
  672. thread: true,
  673. style: '.pgbtn, .viewthread:not(:first-of-type)>h1, .viewthread:not(:first-of-type)>ins, .viewthread:not(:first-of-type)>.headactions {display: none;}',
  674. pager: {
  675. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  676. pageE: '#postlist > div[id^="post_"], form>.viewthread',
  677. replaceE: '//div[contains(@class,"pg") or contains(@class,"pages")][./a[contains(@class,"nxt") or contains(@class,"next") or contains(@class,"prev")][not(contains(@href,"javascript") or contains(@href,"commentmore"))]]',
  678. forceHTTPS: true
  679. },
  680. function: {
  681. bF: src_bF,
  682. bFp: [0, 'img[file]', 'file']
  683. }
  684. }, // Discuz! 论坛 - 帖子内
  685. discuz_search: {
  686. pager: {
  687. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  688. pageE: '#threadlist > ul',
  689. replaceE: '.pg, .pages',
  690. forceHTTPS: true
  691. }
  692. }, // Discuz! 论坛 - 搜索页
  693. discuz_youspace: {
  694. pager: {
  695. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  696. pageE: 'form:not([action^="search.php?"]) tbody > tr:not(.th)',
  697. replaceE: '.pg, .pages',
  698. forceHTTPS: true
  699. }
  700. }, // Discuz! 论坛 - 回复页、主题页(别人的)
  701. discuz_collection: {
  702. pager: {
  703. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  704. pageE: '#ct .bm_c table > tbody',
  705. replaceE: '.pg, .pages',
  706. forceHTTPS: true
  707. }
  708. }, // Discuz! 论坛 - 淘帖页
  709. discuz_m: {
  710. thread: true,
  711. pager: {
  712. nextL: '//a[@class="nxt" or @class="next"] | //div[@class="page"]/a[text()="下一页" or contains(text(), ">")]',
  713. replaceE: '.pg, .page',
  714. forceHTTPS: true,
  715. scrollD: 1000
  716. }
  717. }, // Discuz! 论坛 - 触屏手机版 - 帖子内
  718. discuz_m_forum: {
  719. pager: {
  720. type: 2,
  721. nextL: 'a.loadmore',
  722. interval: 500,
  723. scrollD: 1000
  724. }
  725. }, // Discuz! 论坛 - 触屏手机版 - 帖子列表(自带无缝加载下一页按钮的)
  726. flarum: {
  727. url: ()=> {urlC = true;if (!indexOF('/d/')) {curSite = DBSite.flarum;}},
  728. pager: {
  729. type: 2,
  730. nextL: '.DiscussionList-loadMore > button',
  731. isHidden: true
  732. }
  733. }, // Flarum 论坛
  734. phpbb: {
  735. url: ()=> {if (indexOF('/viewforum.php')) {
  736. curSite = DBSite.phpbb;
  737. } else if (indexOF('/viewtopic.php')) {
  738. curSite = DBSite.phpbb_post;
  739. } else if (indexOF('/search.php')) {
  740. curSite = DBSite.phpbb_search;
  741. }},
  742. pager: {
  743. nextL: '.pagination li.next a[rel="next"], .topic-actions .pagination strong~a',
  744. pageE: '.forumbg:not(.announcement) ul.topiclist.topics > li',
  745. replaceE: '.action-bar .pagination, .topic-actions .pagination'
  746. }
  747. }, // phpBB 论坛 - 帖子列表
  748. phpbb_post: {
  749. thread: true,
  750. pager: {
  751. nextL: '.pagination li.next a[rel="next"], .topic-actions .pagination strong~a',
  752. pageE: 'div.post[id], div.post[id]+hr',
  753. replaceE: '.action-bar .pagination, .topic-actions .pagination'
  754. }
  755. }, // phpBB 论坛 - 帖子内
  756. phpbb_search: {
  757. pager: {
  758. nextL: '.pagination li.next a[rel="next"], .topic-actions .pagination strong~a',
  759. pageE: 'div.search.post',
  760. replaceE: '.action-bar .pagination, .pagination'
  761. }
  762. }, // phpBB 论坛 - 搜索页
  763. xenforo: {
  764. url: ()=> {if (indexOF(/\/(forums|f)\//)) {
  765. curSite = DBSite.xenforo;
  766. } else if (indexOF(/\/(threads|t)\//)) {
  767. curSite = DBSite.xenforo_post;
  768. } else if (indexOF('/search/')) {
  769. curSite = DBSite.xenforo_search;
  770. }},
  771. pager: {
  772. nextL: 'a.pageNav-jump--next',
  773. pageE: '.structItemContainer-group.js-threadList > div',
  774. replaceE: 'nav.pageNavWrapper',
  775. scrollD: 2500
  776. }
  777. }, // XenForo 论坛 - 帖子列表
  778. xenforo_post: {
  779. thread: true,
  780. pager: {
  781. nextL: 'a.pageNav-jump--next',
  782. pageE: '.block-body.js-replyNewMessageContainer > article',
  783. replaceE: 'nav.pageNavWrapper',
  784. scrollD: 2500
  785. }
  786. }, // XenForo 论坛 - 帖子内
  787. xenforo_search: {
  788. pager: {
  789. nextL: 'a.pageNav-jump--next',
  790. pageE: 'ol.block-body > li',
  791. replaceE: 'nav.pageNavWrapper',
  792. scrollD: 2500
  793. }
  794. }, // XenForo 论坛 - 搜索页
  795. xiuno: {
  796. url: ()=> {if (lp == '/' || indexOF(/\/(index|forum)/)) {curSite = DBSite.xiuno;} else if (indexOF('/thread')) {curSite = DBSite.xiuno_post;}},
  797. pager: {
  798. nextL: '//li[@class="page-item"]/a[text()="▶" or text()="»" or contains(text(),">") or contains(text(),"下一页")]',
  799. pageE: 'ul.threadlist > li',
  800. replaceE: 'ul.pagination'
  801. }
  802. }, // Xiuno 论坛 - 帖子列表
  803. xiuno_post: {
  804. thread: true,
  805. pager: {
  806. nextL: '//li[@class="page-item"]/a[text()="▶" or text()="»" or contains(text(),">") or contains(text(),"下一页")]',
  807. pageE: 'li.post[data-pid]:not(.newpost)',
  808. replaceE: 'ul.pagination'
  809. }
  810. }, // Xiuno 论坛 - 帖子内
  811. nexusphp: {
  812. url: ()=> {
  813. if (lp == '/torrents.php' || getCSS('table.torrents')) {
  814. curSite = DBSite.nexusphp;
  815. } else if (lp == '/subtitles.php') {
  816. curSite = DBSite.nexusphp;
  817. curSite.pager.pageE = '#outer > table.main~table > tbody > tr:not(:first-of-type)'
  818. } else if (lp == '/forums.php' && indexOF('action=viewforum', 's')) {
  819. curSite = DBSite.nexusphp;
  820. curSite.pager.pageE = '#outer > table.main+table > tbody > tr:not(:first-of-type):not(:last-of-type)'
  821. } else if (lp == '/forums.php' && indexOF('action=viewtopic', 's')) {
  822. curSite = DBSite.nexusphp;
  823. curSite.thread = true;
  824. curSite.pager.pageE = 'td.text > div, td.text > div+table.main';
  825. }},
  826. pager: {
  827. nextL: '//a[./b[contains(text(), "下一页") or contains(text(), ">>")]]',
  828. pageE: 'table.torrents > tbody > tr:not(:first-of-type)',
  829. replaceE: '//p[@align][./font[@class="gray"]]'
  830. }
  831. }, // NexusPHP 论坛
  832. nexusmods: {
  833. host: 'www.nexusmods.com',
  834. url: ()=> {urlC = true; if (!(lp == '/' || indexOF(/\/mods\/\d+/) || !getCSS('.pagination li.next'))) {curSite = DBSite.nexusmods;}},
  835. blank: 1,
  836. history: false,
  837. pager: {
  838. nextL: nexusmods_nextL,
  839. pageE: 'ul.tiles > li',
  840. replaceE: '.pagination',
  841. scrollD: 3500
  842. },
  843. function: {
  844. bF: nexusmods_bF
  845. }
  846. }, // NexusMods
  847. bilibili_search: {
  848. host: 'search.bilibili.com',
  849. url: ()=> {
  850. urlC = true;
  851. if ((lp == '/all' || lp == '/video') && getCSS('ul.video-list') != null) {
  852. curSite = DBSite.bilibili_search;
  853. } else if (lp == '/article' && getCSS('#article-list') != null) {
  854. curSite = DBSite.bilibili_search_article;
  855. }
  856. },
  857. retry: 100,
  858. pager: {
  859. nextL: bilibili_search_nextL,
  860. pageE: '//ul[contains(@class, "video-list")]/li | //script[contains(text(), "window.__INITIAL_STATE__")]',
  861. insertP: ['ul.video-list', 3],
  862. replaceE: 'ul.pages',
  863. scriptT: 2,
  864. scrollD: 1000
  865. },
  866. function: {
  867. bF: bilibili_search_bF,
  868. aF: bilibili_search_aF
  869. }
  870. }, // B 站(Bilibili) - 搜索页 - 视频
  871. bilibili_search_article: {
  872. retry: 100,
  873. pager: {
  874. nextL: bilibili_search_nextL,
  875. pageE: 'li.article-item',
  876. replaceE: 'ul.pages',
  877. //scriptT: 2,
  878. scrollD: 1000
  879. }
  880. }, // B 站(Bilibili) - 搜索页 - 专栏
  881. manhuacat: {
  882. host: ['www.manhuacat.com', 'www.maofly.com','www.manhuafei.com'],
  883. url: ()=> {if (indexOF(/\/(manga|manhua)\/\d+\/.+\.html/)) {
  884. if (getCookie('is_pull') == 'true') { // 强制关闭 [下拉] 模式
  885. document.cookie='is_pull=false; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; // 写入 Cookie 关闭 [下拉] 模式
  886. location.reload(); // 刷新网页
  887. }
  888. setTimeout(manhuacat_init, 100);
  889. curSite = DBSite.manhuacat;
  890. }},
  891. style: '#left, #right, #pull-load, .loading, .pagination, footer {display: none !important;} .img-content > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}', // 隐藏不需要的元素,调整图片
  892. pager: {
  893. type: 4,
  894. nextL: manhuacat_nextL,
  895. insertP: ['.img-content', 3],
  896. insertE: manhuacat_insertE,
  897. replaceE: '.comic-detail > .breadcrumb-bar, .comic-detail >h2.h4, .vg-r-data, body > script:not([src])',
  898. interval: 3000,
  899. scrollD: 4000
  900. }
  901. }, // 漫画猫 + 漫画飞
  902. imanhuaw: {
  903. host: ['www.imanhuaw.net', 'www.imanhuaw.com', 'www.ccshwy.com'],
  904. url: ()=> {
  905. if (getCSS('.mh-search-result')) {
  906. curSite = DBSite.imanhuaw_list;
  907. } else if (getCSS('a#zhankai')) {
  908. getCSS('a#zhankai').click();
  909. } else if (indexOF(/\/\d{3,}\.html/)) {
  910. curSite = DBSite.imanhuaw; imanhuaw_init();
  911. }
  912. },
  913. style: '#sider-left, #sider-right, .main-left, .main-right, .w996.tc, .title > span {display: none !important;} #qTcms_Pic_middle img {max-width: 110%;height: auto;}',
  914. pager: {
  915. type: 4,
  916. nextL: imanhuaw_nextL,
  917. insertP: ['#qTcms_Pic_middle img:last-of-type', 4],
  918. insertE: imanhuaw_insertE,
  919. replaceE: '.title h2',
  920. interval: 2000,
  921. scrollD: 3000
  922. }
  923. }, // 爱漫画 + 188漫画网
  924. imanhuaw_list: {
  925. blank: 1,
  926. pager: {
  927. nextL: '//div[@class="NewPages"]//a[text()="下一页"]',
  928. pageE: 'ul.mh-search-list > li',
  929. replaceE: '.NewPages'
  930. }
  931. }, // 爱漫画 - 分类页
  932. hicomic: {
  933. host: 'www.hicomic.net',
  934. url: ()=> {if (indexOF('/chapters/')) {
  935. setTimeout(hicomic_init, 100);
  936. curSite = DBSite.hicomic;
  937. }},
  938. style: '.content {height: auto !important;} .footer, .left_cursor, .right_cursor, .finish {display: none !important;} .content > img {display: block !important;margin: 0 auto !important;}',
  939. pager: {
  940. type: 4,
  941. nextL: hicomic_nextL,
  942. insertP: ['.content', 3],
  943. insertE: hicomic_insertE,
  944. interval: 5000,
  945. scrollD: 3000
  946. }
  947. }, // HiComic (嗨漫画)
  948. alimanhua: {
  949. host: ['www.alimanhua.com','www.iimanhua.cc'],
  950. url: ()=> {
  951. if (indexOF(/\/\d+\.html$/)) {
  952. curSite = DBSite.alimanhua;
  953. pausePage = false;
  954. setTimeout(()=>{pausePage = true;}, 5000)
  955. } else if (indexOF(/^\/(manhua|comic)\/\d+\/$/)) {
  956. setTimeout(()=>{getCSS('#openBook').click()}, 500)
  957. } else if (lp != '/'){
  958. curSite = DBSite.alimanhua_list;
  959. }
  960. },
  961. style: 'iframe {display: none !important;}',
  962. pager: {
  963. type: 4,
  964. nextL: alimanhua_nextL,
  965. pageE: 'head>script:not([src])',
  966. insertP: ['#viewimages', 3],
  967. insertE: alimanhua_insertE,
  968. interval: 3000,
  969. scrollD: 3000
  970. }
  971. }, // 阿狸漫画 + 爱漫画
  972. alimanhua_list: {
  973. blank: 3,
  974. pager: {
  975. nextL: '#pager>b+a',
  976. pageE: '#dmList>ul',
  977. replaceE: '#pager',
  978. scrollD: 800
  979. },
  980. function: {
  981. bF: "return fun.src_bF(pageE, [0, 'img[_src]', '_src'])"
  982. }
  983. }, // 阿狸漫画 - 分类/搜索页
  984. mangabz: {
  985. host: ['mangabz.com', 'www.mangabz.com'],
  986. url: ()=> {if (indexOF(/\/m\d+/)) {
  987. setTimeout(mangabz_init, 1500);
  988. curSite = DBSite.mangabz;
  989. } else if (indexOF(/\/\d+bz\//)) {
  990. if (getCSS('.detail-list-form-more')) getCSS('.detail-list-form-more').click();
  991. } else if (indexOF('/manga-list') || lp == '/search') {
  992. curSite = DBSite.mangabz_list;
  993. }},
  994. style: 'body > .container > div:not([id]) {display: none !important;} .top-bar {opacity: 0.3 !important;} #cp_img > img{display: block !important;margin: 0 auto !important; max-width: 99% !important; width: auto !important; height: auto !important;}',
  995. pager: {
  996. type: 4,
  997. nextL: mangabz_nextL,
  998. insertP: ['#cp_img', 3],
  999. insertE: mangabz_insertE,
  1000. replaceE: 'p.top-title, body > .container > div:not([id])',
  1001. interval: 500
  1002. }
  1003. }, // Mangabz 漫画
  1004. mangabz_list: {
  1005. blank: 1,
  1006. pager: {
  1007. nextL: '//div[contains(@class,"page-pagination")]//a[contains(text(), ">")]',
  1008. pageE: 'ul.mh-list > li',
  1009. replaceE: '.page-pagination',
  1010. scrollD: 800
  1011. }
  1012. }, // Mangabz 漫画 - 分类/搜索页
  1013. dm5: {
  1014. host: 'www.dm5.com',
  1015. url: ()=> {if (indexOF(/\/m\d+/)) {
  1016. setTimeout(mangabz_init, 1500);
  1017. curSite = DBSite.dm5;
  1018. } else if (indexOF('/manga-list') || lp == '/search' || getCSS('.box-body > ul.mh-list > li')) {
  1019. curSite = DBSite.mangabz_list;
  1020. } else if (getCSS('.detail-more')) {
  1021. getCSS('.detail-more').click();
  1022. }},
  1023. style: '.view-paging > .container, .view-comment {display: none !important;} .rightToolBar {opacity: 0.3 !important;} #cp_img > img, #barChapter > img{display: block !important;margin: 0 auto !important; max-width: 99% !important; width: auto !important; height: auto !important;} body {overflow: auto !important;}',
  1024. pager: {
  1025. type: 4,
  1026. nextL: dm5_nextL,
  1027. insertP: ['#barChapter,#cp_img', 3],
  1028. insertE: dm5_insertE,
  1029. replaceE: '.view-paging > .container, .rightToolBar',
  1030. interval: 500
  1031. }
  1032. }, // 动漫屋
  1033. xmanhua: {
  1034. host: ['xmanhua.com', 'www.xmanhua.com'],
  1035. url: ()=> {if (indexOF(/\/m\d+/)) {
  1036. setTimeout(mangabz_init, 1500);
  1037. curSite = DBSite.xmanhua;
  1038. } else if (indexOF(/\/\d+xm\//)) {
  1039. if (getCSS('.detail-list-form-more')) getCSS('.detail-list-form-more').click();
  1040. } else if (indexOF('/manga-list') || lp == '/search') {
  1041. curSite = DBSite.xmanhua_list;
  1042. }},
  1043. style: 'a.reader-bottom-page {display: none !important;} .header, .reader-bottom {opacity: 0.3 !important;} #cp_img > img{display: block !important;margin: 0 auto !important; max-width: 99% !important; width: auto !important; height: auto !important;}',
  1044. hiddenPN: true,
  1045. pager: {
  1046. type: 4,
  1047. nextL: xmanhua_nextL,
  1048. insertP: ['#cp_img', 3],
  1049. insertE: xmanhua_insertE,
  1050. replaceE: '.reader-title, body > .container > div:not([id])',
  1051. interval: 500,
  1052. scrollD: 2500
  1053. }
  1054. }, // Xmanhua 漫画
  1055. xmanhua_list: {
  1056. blank: 1,
  1057. pager: {
  1058. nextL: '//div[@class="page-pagination"]//a[contains(text(), ">")]',
  1059. pageE: 'ul.mh-list > li',
  1060. replaceE: '.page-pagination',
  1061. scrollD: 1000
  1062. }
  1063. }, // Xmanhua 漫画 - 分类/搜索页
  1064. coolkeyan: {
  1065. host: 'www.coolkeyan.com',
  1066. url: ()=> {if (location.hash.indexOf('/project/') > -1) curSite = DBSite.coolkeyan;},
  1067. style: '.q-img {height: auto !important;} .q-img__image {max-height: 1000px !important;} .row.q-my-sm.q-gutter-sm {display: none !important;}',
  1068. pager: {
  1069. type: 4,
  1070. nextL: coolkeyan_nextL,
  1071. insertP: ['//div[contains(@class, "q-img__image")][last()]', 4],
  1072. insertE: coolkeyan_insertE,
  1073. interval: 0
  1074. }
  1075. }, // 酷科研
  1076. nsfc: {
  1077. host: ['output.nsfc.gov.cn', 'kd.nsfc.gov.cn'],
  1078. url: ()=> {if (indexOF('/conclusionProject/')) curSite = DBSite.nsfc;},
  1079. style: '#pageNoUl {display: none !important;}',
  1080. pager: {
  1081. type: 4,
  1082. nextL: nsfc_nextL,
  1083. insertP: ['#pageNoUl', 1],
  1084. insertE: nsfc_insertE,
  1085. interval: 0
  1086. }
  1087. } // 国家自然科学基金
  1088. };
  1089. // 合并 自定义规则、外置规则、内置规则
  1090. if (Object.keys(GM_getValue('menu_customRules', {})).length === 0) {
  1091. DBSite = Object.assign(GM_getValue('menu_customRules', {}), GM_getValue('menu_rules', {}), DBSite);
  1092. DBSite2 = GM_getValue('menu_rules', {})
  1093. } else { // 自定义规则 覆盖 同名的外置规则
  1094. let a = GM_getValue('menu_customRules', {}), a1 = Object.keys(a),
  1095. b = GM_getValue('menu_rules', {}), b1 = Object.keys(b)
  1096. for (let i = 0; i < a1.length; i++) {if(b1.indexOf(a1[i]) != -1) {delete b[a1[i]]};}
  1097. DBSite = Object.assign(a, b, DBSite);
  1098. DBSite2 = Object.assign(a, b);
  1099. }
  1100.  
  1101. // 生成 SiteTypeID
  1102. setSiteTypeID();
  1103. //console.log(DBSite)
  1104. }
  1105. // 外置翻页规则
  1106. function getRulesUrl(update = false) {
  1107. // 如果是原来的时间格式 或 刚安装脚本,则需要立即更新
  1108. if (typeof(GM_getValue('menu_ruleUpdateTime', '')) == 'string') {update = true; if (scriptHandler != 'AdGuard') {alert('请点击【确定】开始首次获取【外置翻页规则】(大概几秒\n\n在此期间请不要 操作/跳转/关闭 当前网页~\n\n如果不小心没获取成功也没事,可以去脚本菜单中手动【更新外置翻页规则】即可(浏览器右上角 Tampermonkey 扩展图标内的脚本菜单\n\n\n另外,想要【临时暂停翻页】请点击左下角悬浮的【页码】按钮\n\n如果每次打开网页都会看到该提示,说明你的 油猴脚本管理器 存在兼容性问题,请更换其他试试!');} else {urlArr2 = urlArr}}
  1109.  
  1110. if (update) { // 手动更新(或安装后首次更新)
  1111. GM_notification({text: '🔄 更新外置翻页规则中,请勿操作网页...', timeout: 5000});
  1112. getRulesUrl_(true);
  1113. } else if (parseInt(+new Date()/1000) - GM_getValue('menu_ruleUpdateTime', 0) > 864000) {
  1114. getRulesUrl_();
  1115. }
  1116.  
  1117. function getRulesUrl_(n = false, url) {
  1118. if (n) {url = urlArr2[Math.floor(Math.random()*urlArr2.length)];} else {url = urlArr[Math.floor(Math.random()*urlArr.length)];}
  1119. if (url === undefined) {GM_notification({text: '❌ 所有更新地址均以试过,已无可用地址,请联系作者解决...', timeout: 5000}); return}
  1120. //console.log(url); return
  1121. GM_xmlhttpRequest({
  1122. url: url,
  1123. method: 'GET',
  1124. responseType: 'json',
  1125. overrideMimeType: 'application/json; charset=utf-8',
  1126. timeout: 5000,
  1127. onload: function (response) {
  1128. try {
  1129. //console.log('最终 URL:' + response.finalUrl, '返回内容:',response.response, response.responseHeaders)
  1130. if (response.response) {
  1131. GM_setValue('menu_rules', response.response); // 写入最新规则
  1132. GM_setValue('menu_ruleUpdateTime', parseInt(+new Date()/1000)); // 写入当前时间戳
  1133.  
  1134. curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1135. registerMenuCommand(); // 重新判断规则
  1136.  
  1137. webTypeIf(); // 判断网站类型
  1138. if (!GM_getValue('menu_thread')) {if (curSite.thread) {curSite = {SiteTypeID: 0}; pageNum.now = 1;}} // 帖子内自动翻页判断
  1139. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1140. if (curSite.blank != undefined) setTimeout(forceTarget, 1000); // 强制新标签页打开链接
  1141. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1142. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1143. pageLoading(); // 自动无缝翻页
  1144.  
  1145. if (n) GM_notification({text: '✅ 已更新外置翻页规则!\n如果依然无法翻页,说明还不支持当前网页,点击此处提交申请~', timeout: 5000, onclick: function(){window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://gf.qytechs.cn/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});}});
  1146. } else {
  1147. console.log('URL:' + url);
  1148. GM_notification({text: '❌ 为空!更新失败,请再试几次...\n如果依然更新失败,请联系作者解决...', timeout: 5000});
  1149. if (n) {urlArr2.splice(urlArr2.indexOf(url), 1)} else {urlArr.splice(urlArr.indexOf(url), 1)}
  1150. }
  1151. } catch (e) {
  1152. console.log('URL:' + url, e);
  1153. GM_notification({text: '❌ 报错!更新失败,请再试几次...\n如果依然更新失败,请联系作者解决...', timeout: 5000});
  1154. if (n) {urlArr2.splice(urlArr2.indexOf(url), 1)} else {urlArr.splice(urlArr.indexOf(url), 1)}
  1155. }
  1156. },
  1157. onerror: function (response) {
  1158. console.log('URL:' + url, response)
  1159. GM_notification({text: '❌ 错误!更新失败,请再试几次...\n如果依然更新失败,请联系作者解决...', timeout: 5000});
  1160. if (n) {urlArr2.splice(urlArr2.indexOf(url), 1)} else {urlArr.splice(urlArr.indexOf(url), 1)}
  1161. },
  1162. ontimeout: function (response) {
  1163. console.log('URL:' + url, response)
  1164. GM_notification({text: '❌ 超时!更新失败,请再试几次...\n如果依然更新失败,请联系作者解决...', timeout: 5000});
  1165. if (n) {urlArr2.splice(urlArr2.indexOf(url), 1)} else {urlArr.splice(urlArr.indexOf(url), 1)}
  1166. }
  1167. })
  1168. }
  1169. }
  1170.  
  1171.  
  1172. // --------------------------------------------------------
  1173.  
  1174.  
  1175. // 判断网站类型
  1176. webTypeIf();
  1177.  
  1178. // 帖子内自动翻页判断
  1179. if (!GM_getValue('menu_thread')) {if (curSite.thread) {curSite = {SiteTypeID: 0}; pageNum.now = 1;}}
  1180.  
  1181. //console.log(curSite)
  1182. // 显示页码
  1183. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');}
  1184. // 左键双击网页空白处暂停翻页
  1185. pausePageEvent();
  1186. // 强制新标签页打开链接
  1187. if (curSite.blank != undefined) setTimeout(forceTarget, 1000);
  1188. // 初始化事件
  1189. //if (curSite.initE != undefined) initEvent();
  1190.  
  1191. // 对于使用 pjax 技术的网站,需要监听 URL 变化来重新判断翻页规则
  1192. if (urlC) {
  1193. nowLocation = location.href
  1194. if (window.onurlchange === undefined) {addUrlChangeEvent();} // Tampermonkey v4.11 版本添加的 onurlchange 事件 grant,可以监控 pjax 等网页的 URL 变化
  1195. if (webType === 1) {
  1196. window.addEventListener('urlchange', function(){
  1197. lp = location.pathname;
  1198. //console.log(nowLocation, location.href)
  1199. if (curSite.history !== false && window.top.document.Autopage_nowUrl === location.href) {nowLocation = location.href; return}
  1200. if (nowLocation == location.href) return
  1201. if (curSite.pager && curSite.pager.type == 5) {
  1202. if (self != top) {window.top.location.href = location.href;} else {if (getCSS('iframe#Autopage_iframe')) {getCSS('iframe#Autopage_iframe').remove();}}
  1203. pausePage = true;
  1204. } // 对于翻页模式 5,如果是 iframe 框架内 URL 变动,则升级为顶级页面,如果是顶级页面的 URL 变动,则清理 iframe 框架
  1205. nowLocation = location.href; curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1206. registerMenuCommand(); // 重新判断规则
  1207.  
  1208. //console.log(curSite);
  1209. if (curSite.blank != undefined) setTimeout(forceTarget, 1000); // 强制新标签页打开链接
  1210. //if (curSite.initE != undefined) initEvent(); // 初始化事件
  1211. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1212. if (!GM_getValue('menu_thread')) {if (curSite.thread) {curSite = {SiteTypeID: 0}; pageNum.now = 1;}} // 帖子内自动翻页判断
  1213. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1214. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1215.  
  1216. pageLoading();
  1217. })
  1218. } else if (webType === 2) {
  1219. window.addEventListener('urlchange', function(){
  1220. lp = location.pathname;
  1221. //console.log(nowLocation, location.href)
  1222. if (nowLocation == location.href) return
  1223. setTimeout(function(){
  1224. nowLocation = location.href; curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1225. discuz_(); // 重新判断规则
  1226.  
  1227. if (!GM_getValue('menu_thread')) {if (curSite.thread) {curSite = {SiteTypeID: 0}; pageNum.now = 1;}} // 帖子内自动翻页判断
  1228. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1229. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1230. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1231.  
  1232. pageLoading();
  1233. }, 500)
  1234. })
  1235. } else if (webType === 3) {
  1236. window.addEventListener('urlchange', function(){
  1237. lp = location.pathname;
  1238. if (nowLocation == location.href) return
  1239. nowLocation = location.href; curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1240. DBSite.flarum.url(); // 重新判断规则
  1241.  
  1242. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1243. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1244. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1245.  
  1246. pageLoading();
  1247. })
  1248. }
  1249. }
  1250. // 插入 Style CSS 样式
  1251. if (curSite.style) insStyle(curSite.style)
  1252.  
  1253. // 自动无缝翻页
  1254. pageLoading();
  1255.  
  1256.  
  1257. // --------------------------------------------------------
  1258.  
  1259.  
  1260. // [Discuz! 论坛] 判断各版块帖子列表类型
  1261. function discuzForum(m) {
  1262. if (m == 'm') { // 手机版页面
  1263. if (getCSS('a.loadmore')) {
  1264. curSite = DBSite.discuz_m_forum;
  1265. } else if (getCSS('.threadlist')) {
  1266. curSite = DBSite.discuz_m; curSite.pager.pageE = '.threadlist > ul > li';
  1267. } else if (getCSS('[id^="normalthread_"]')) {
  1268. curSite = DBSite.discuz_m; curSite.pager.pageE = '[id^="normalthread_"]:not(.ZDlist)';
  1269. }
  1270. if (curSite.SiteTypeID !== 0 && location.hostname === 'keylol.com') {curSite.history = false; urlC = true;}
  1271. } else {
  1272. if (getCSS('#autopbn')) { // 判断是否有 [下一页] 按钮
  1273. curSite = DBSite.discuz_forum;
  1274. } else if (getCSS('#waterfall')) { // 判断是否为图片模式
  1275. if (!getCSS('#pgbtn, .pgbtn')) { // 如果各版块帖子列表已存在这个元素,说明自带了无缝翻页
  1276. curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理
  1277. }
  1278. } else {
  1279. curSite = DBSite.discuz_guide;
  1280. }
  1281. }
  1282. }
  1283. // [Discuz! 论坛] 判断手机版帖子内
  1284. function discuzThreadM() {
  1285. if (getCSS('[id^="pid"]')) {
  1286. curSite = DBSite.discuz_m; curSite.pager.pageE = '[id^="pid"], [id^="pid"]+div:not([id="post_new"])'
  1287. } else if (getCSS('[id^="post_"]')) {
  1288. curSite = DBSite.discuz_m; curSite.pager.pageE = '[id^="post_"]';
  1289. }
  1290. if (curSite.SiteTypeID !== 0 && location.hostname === 'keylol.com') {curSite.history = false; urlC = true;}
  1291. }
  1292. function discuz_() {
  1293. if (getCSS('body[id="nv_forum"][class^="pg_"][onkeydown*="27"]')) {
  1294. switch (getCSS('body[id="nv_forum"][class^="pg_"][onkeydown*="27"]').className) {
  1295. case 'pg_forumdisplay': // < 各版块帖子列表 >
  1296. discuzForum(); break;
  1297. case 'pg_viewthread': // < 帖子内 >
  1298. curSite = DBSite.discuz_thread; break;
  1299. case 'pg_guide': // < 导读帖子列表等 >
  1300. curSite = DBSite.discuz_guide; break;
  1301. case 'pg_collection': // < 淘贴列表 >
  1302. curSite = DBSite.discuz_collection; break;
  1303. }
  1304. }
  1305. // 如果上面没有匹配的则继续 < 搜索结果 >
  1306. if (curSite.SiteTypeID === 0) {
  1307. if (indexOF('search') || getCSS('body[id="nv_search"][onkeydown*="27"]')) {
  1308. if (indexOF('mobile=2', 's')) { // 手机版页面
  1309. curSite = DBSite.discuz_m; curSite.pager.pageE = '.threadlist > ul > li'; urlC = true;
  1310. } else {
  1311. curSite = DBSite.discuz_search;
  1312. }
  1313. }
  1314. }
  1315. // 如果上面没有匹配的则继续
  1316. if (curSite.SiteTypeID === 0) {
  1317. if (indexOF('.html')) { // 判断是不是静态网页(.html 结尾)
  1318. if (indexOF('/forum-')) { // < 各版块帖子列表 >
  1319. if (getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
  1320. discuzForum('m');
  1321. } else {
  1322. discuzForum();
  1323. }
  1324. } else if (indexOF('/thread-')) { // < 帖子内 >
  1325. if (getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
  1326. discuzThreadM();
  1327. } else {
  1328. curSite = DBSite.discuz_thread;
  1329. }
  1330. }
  1331. }
  1332. }
  1333. // 如果上面没有匹配的则继续
  1334. if (curSite.SiteTypeID === 0) {
  1335. if (indexOF('mod=forumdisplay', 's') || indexOF('forumdisplay.php')) { // < 各版块帖子列表 >
  1336. if (indexOF('mobile=2', 's') || indexOF('mobile=yes', 's') || getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
  1337. discuzForum('m');
  1338. } else {
  1339. discuzForum();
  1340. }
  1341. } else if (indexOF('mod=viewthread', 's') || indexOF('viewthread.php')) { // < 帖子内 >
  1342. if (indexOF('mobile=2', 's') || getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
  1343. discuzThreadM();
  1344. } else {
  1345. curSite = DBSite.discuz_thread;
  1346. }
  1347. } else if (indexOF('mod=guide', 's')) { // < 导读帖子列表 >
  1348. curSite = DBSite.discuz_guide;
  1349. } else if(indexOF('mod=space', 's') && indexOF('do=thread', 's')) { // 别人的主题/回复
  1350. curSite = DBSite.discuz_youspace;
  1351. } else if (indexOF('mod=collection', 's')) { // < 淘贴列表 >
  1352. curSite = DBSite.discuz_collection;
  1353. } else if (getCSS('#threadlist, tbody[id^="normalthread_"]')) { // < 部分论坛的各板块 URL 是自定义的 >
  1354. discuzForum();
  1355. } else if (getCSS('#postlist, form>.viewthread')) { // < 部分论坛的帖子内 URL 是自定义的 >
  1356. curSite = DBSite.discuz_thread;
  1357. } else if (isMobile()) { // 手机版判断
  1358. discuzForum('m');
  1359. if (curSite.SiteTypeID === 0) discuzThreadM();
  1360. }
  1361. }
  1362. }
  1363. // [Discuz! 论坛] 图片模式列表样式预处理
  1364. function waterfallStyle() {
  1365. let width = getCSS('#waterfall > li:first-child').style.width;
  1366. if (width) insStyle(`#waterfall {height: auto !important; width: 100% !important;} #waterfall > li {width: ${width} !important; float: left !important; position: inherit !important; left: auto !important; top: auto !important;}`);
  1367. }
  1368.  
  1369.  
  1370. // [NexusMods] 获取下一页地址
  1371. function nexusmods_nextL() {
  1372. if (getCSS('.nexus-ui-blocker') || !getCSS('.pagination li.next')) return
  1373. let modList;
  1374. if (indexOF('/news')) {modList = RH_NewsTabContent;} else if (indexOF('/users/') && indexOF('tab=user+files','s')) {modList = RH_UserModsTab;} else {modList = RH_ModList;}
  1375. if (!modList) return
  1376. let out_items = JSON.stringify(modList.out_items).replace(/{|}|"/g,''),
  1377. nextNum = getXpath('//div[contains(@class, "pagenav")][1]//a[contains(@class, "page-selected")]/parent::li/following-sibling::li/a'),
  1378. categories = modList.out_items.categories, categoriesUrl = '',
  1379. tags_yes = modList.out_items.tags_yes, tags_yesUrl = '',
  1380. search = modList.out_items.search, searchUrl = '';
  1381. var url = '';
  1382. if (nextNum && nextNum.innerText) {
  1383. nextNum = nextNum.innerText;
  1384. if (out_items.indexOf('page:') > -1) {
  1385. out_items = out_items.replace(/page:\d+/, `page:${nextNum}`)
  1386. } else {
  1387. out_items += `,page:${nextNum}`;
  1388. }
  1389. if (categories && categories != []) {
  1390. for (let i = 0; i < categories.length; i++) {categoriesUrl += `,categories[]:${categories[i]}`;}
  1391. if (out_items.indexOf('categories:') > -1) out_items = out_items.replace(/categories:\[.*\]/, categoriesUrl.replace(/,/,''))
  1392. }
  1393. if (tags_yes && tags_yes != []) {
  1394. for (let i = 0; i < tags_yes.length; i++) {tags_yesUrl += `,tags_yes[]:${tags_yes[i]}`;}
  1395. if (out_items.indexOf('tags_yes:') > -1) out_items = out_items.replace(/tags_yes:\[.*\]/, tags_yesUrl.replace(/,/,''))
  1396. }
  1397. if (search && search.length != 0) {
  1398. for (let key in modList.out_items.search) {searchUrl += `search[${key}]:${modList.out_items.search[key]},`;}
  1399. if (out_items.indexOf('search:') > -1) out_items = out_items.replace('search:',searchUrl)
  1400. }
  1401. //console.log(`https://www.nexusmods.com${modList.uri}?RH_${modList.id}=${out_items}`)
  1402. return `https://www.nexusmods.com${modList.uri}?RH_${modList.id}=${out_items}`
  1403. }
  1404. return ''
  1405. }
  1406. // [NexusMods] 的插入前函数(隐藏底部元素)
  1407. function nexusmods_bF(pageE) {
  1408. pageE.forEach(function (one) {
  1409. let now = one.querySelector('.mod-tile-left');
  1410. if (now) {
  1411. let downloadCount = now.querySelector('.downloadcount > span.flex-label');
  1412. if (downloadCount) {
  1413. if (GlobalModStats[now.dataset.gameId] && GlobalModStats[now.dataset.gameId][now.dataset.modId]) {
  1414. downloadCount.textContent = shortFormat(parseInt(GlobalModStats[now.dataset.gameId][now.dataset.modId].total));
  1415. }
  1416. }
  1417. }
  1418. });
  1419. return pageE
  1420. }
  1421.  
  1422.  
  1423. // [bilibili_search] 获取下一页地址
  1424. function bilibili_search_nextL() {
  1425. if (!location.search) return
  1426. let pageActive = 1, pageLast = parseInt(getXpath('//ul[@class="pages"]/li[contains(@class, "page-item")][not(contains(@class, "next") or contains(@class, "prev"))][last()]').innerText);
  1427. if (!pageLast) return
  1428. if (indexOF(/page=\d+/, 's')) {
  1429. pageActive = parseInt(/page=\d+/.exec(location.search)[0].replace('page=',''))
  1430. }
  1431. if (pageActive < pageLast) {
  1432. if (indexOF(/page=\d+/, 's')) {
  1433. return (location.origin + location.pathname + location.search.replace(/page=\d+/,`page=${pageActive+1}`))
  1434. } else {
  1435. return (location.origin + location.pathname + location.search + `&page=${pageActive+1}`)
  1436. }
  1437. }
  1438. }
  1439. // [bilibili_search] 插入前函数(加载图片)
  1440. function bilibili_search_bF(pageE) {
  1441. pageE.forEach(function (one) {
  1442. let img = getCSS('.img > .lazy-img > img[src=""]', one)
  1443. if (img) {
  1444. img.setAttribute('data-srclz', 'lazy')
  1445. }
  1446. });
  1447. return pageE
  1448. }
  1449. // [bilibili_search] 插入后函数(加载图片)
  1450. function bilibili_search_aF() {
  1451. let result = __INITIAL_STATE__.flow[__INITIAL_STATE__.flow.fields[0]].result;
  1452. if (result.length > 0) {
  1453. let imgArr = getAllCSS('.img > .lazy-img > img[data-srclz]');
  1454. if (imgArr.length > 0) {
  1455. for (let i = 0; i < imgArr.length; i++) {
  1456. imgArr[i].src = result[i].pic;
  1457. imgArr[i].removeAttribute('data-srclz');
  1458. }
  1459. }
  1460. }
  1461. }
  1462.  
  1463.  
  1464. // [漫画猫] 初始化(显示本话所以图片)
  1465. function manhuacat_init() {
  1466. let _img = '';
  1467. for (let now of img_data_arr) {_img += `<img src="${asset_domain}${img_pre}${now}">`;}
  1468. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  1469.  
  1470. }
  1471. // [漫画猫] 获取下一页地址
  1472. function manhuacat_nextL(pageE, type) {
  1473. if (type === 'url') {
  1474. if(pageE.code == '0000') {
  1475. if (pageE.url === curSite.pageUrl) return
  1476. curSite.pageUrl = pageE.url;
  1477. getPageE_(curSite.pageUrl); // 真正的下一页链接
  1478. }
  1479. } else {
  1480. let vg_r_data = getCSS('.vg-r-data');
  1481. if (vg_r_data) {
  1482. getPageE_(`${location.origin}/chapter_num?chapter_id=${vg_r_data.dataset.chapter_num}&ctype=1&type=${vg_r_data.dataset.chapterType};`, 'json', 'GET', '', 'url');
  1483. }
  1484. }
  1485. }
  1486. // [漫画猫] 插入数据
  1487. function manhuacat_insertE(pageE, type) {
  1488. if (!pageE) return
  1489. if (type === 'url') { // 获取下一页链接
  1490. manhuacat_nextL(pageE, type); return
  1491. }
  1492. addHistory(pageE);
  1493. replaceElems(pageE);
  1494.  
  1495. // 插入图片
  1496. let _img = '', _img_arr = LZString.decompressFromBase64(getXpath('//body/script[not(@src)][contains(text(), "img_data")]').textContent.split('"')[1]).split(','), vg_r_data = getCSS('.vg-r-data');;
  1497. for (let now of _img_arr) {_img += `<img src="${vg_r_data.dataset.chapterDomain}${img_pre}${now}">`;}
  1498. if (_img) {
  1499. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  1500. pageNum.now = pageNum._now + 1
  1501. }
  1502. }
  1503.  
  1504.  
  1505. // [爱漫画] 获取全部图片
  1506. function imanhuaw_getIMG() {
  1507. let _img = '', _imgUrl;
  1508. for (let one of base64_decode(qTcms_S_m_murl_e).split("$qingtiandy$")) {
  1509. _imgUrl = one;
  1510. if (one.substring(0,1) == '/') {
  1511. _imgUrl = qTcms_m_weburl + _imgUrl;
  1512. } else {
  1513. if (qTcms_Pic_m_if != '2') {
  1514. one = one.replace(/\?/gi, 'a1a1');
  1515. one = one.replace(/&/gi, 'b1b1');
  1516. one = one.replace(/%/gi, 'c1c1');
  1517. let m_httpurl = '';
  1518. if (typeof(qTcms_S_m_mhttpurl) != 'undefined') m_httpurl = base64_decode(qTcms_S_m_mhttpurl);
  1519. if (location.hostname == 'www.ccshwy.com') qTcms_m_indexurl = 'http://h.ccshwy.com/';
  1520. _imgUrl = qTcms_m_indexurl + 'statics/pic/?p=' + escape(one) + '&picid=' + qTcms_S_m_id + '&m_httpurl=' + escape(m_httpurl);
  1521. } else {
  1522. _imgUrl = _imgUrl.replace('http:', '') ;
  1523. _imgUrl = _imgUrl.replace('https:', '');
  1524. }
  1525. }
  1526. _img += `<img src="${_imgUrl}">`;
  1527. }
  1528. return _img;
  1529. }
  1530. // [爱漫画] 初始化(调整本话其余图片)
  1531. function imanhuaw_init() {
  1532. getOne(curSite.pager.insertP[0]).outerHTML = imanhuaw_getIMG();
  1533. document.oncontextmenu = function(){}
  1534. }
  1535. // [爱漫画] 获取下一页地址
  1536. function imanhuaw_nextL() {
  1537. let next = location.origin + qTcms_Pic_nextArr
  1538. if (next && next != location.origin && next != curSite.pageUrl) {
  1539. curSite.pageUrl = next;
  1540. getPageE_(curSite.pageUrl);
  1541. }
  1542. }
  1543. // [爱漫画] 插入数据
  1544. function imanhuaw_insertE(pageE, type) {
  1545. if (!pageE) return
  1546. // 插入并运行 <script>
  1547. insScript('//head/script[not(@src)][contains(text(), "qTcms_S_m_murl_e")]', pageE);
  1548. // 将 img 标签插入到网页中
  1549. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), imanhuaw_getIMG());
  1550. addHistory(pageE);
  1551. pageNum.now = pageNum._now + 1
  1552. }
  1553.  
  1554.  
  1555. // [HiComic(嗨漫画)] 初始化(将本话其余图片插入网页中)
  1556. function hicomic_init() {
  1557. let _img = '';
  1558. getAllCSS('.chapter > section:not(:first-child) > section[val]').forEach(function (one) {
  1559. let src = one.getAttribute('val');
  1560. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h'
  1561. _img += `<img src="${src}">`
  1562. })
  1563. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  1564. window.document.title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${getCSS('.chapter_name').textContent}) - HiComic`); // 修改网页标题(加上 第 X 话)
  1565. }
  1566. // [HiComic(嗨漫画)] 获取下一页地址
  1567. function hicomic_nextL() {
  1568. let nextId;
  1569. nextId = getCSS('.next_chapter:not(.end)')
  1570. if (nextId && nextId.id && nextId.id != 'None') {
  1571. curSite.pageUrl = location.href;
  1572. getPageE_(`https://www.hicomic.net/api/web/chapter/${nextId.id}/contents`, 'json');
  1573. }
  1574. }
  1575. // [HiComic(嗨漫画)] 插入数据
  1576. function hicomic_insertE(pageE, type) {
  1577. if (!pageE || pageE.code != 200) return
  1578. if (pageE.results.chapter.next) { // 写入下一页的 UUID
  1579. getCSS('.next_chapter').id = pageE.results.chapter.next;
  1580. } else {
  1581. getCSS('.next_chapter').id = 'None';
  1582. getCSS('.next_chapter').classList.add('end');
  1583. }
  1584. curSite.pageUrl =`https://www.hicomic.net/chapters/${pageE.results.chapter.uuid}/contents`
  1585. getCSS('.chapter_name').textContent = pageE.results.chapter.name; // 修改漫画标题
  1586. addHistory(pageE, window.document.title.replace(/(\(第.+\))? - HiComic/, `(${pageE.results.chapter.name}) - HiComic`));
  1587. let _img = '';
  1588. for (let i = 0; i < pageE.results.chapter.contents.length; i++) { // 遍历图片文件名数组,组合为 img 标签
  1589. let src = pageE.results.chapter.contents[i].url;
  1590. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h';
  1591. _img += `<img src="${src}">`
  1592. }
  1593. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  1594. pageNum.now = pageNum._now + 1
  1595. }
  1596.  
  1597.  
  1598. // [阿狸漫画] 获取下一页地址
  1599. function alimanhua_nextL(pageE, type) {
  1600. if (type === 'url') {
  1601. if(pageE.status == 1){
  1602. if (pageE.url === curSite.pageUrl) return
  1603. curSite.pageUrl = pageE.url;
  1604. getPageE_(curSite.pageUrl); // 真正的下一页链接
  1605. } else {
  1606. curSite = {SiteTypeID: 0}
  1607. alert("已经是最后一章!");
  1608. }
  1609. } else {
  1610. getPageE_(`${location.origin}/e/extend/ret_page/mindex.php?bid=${window.location.href.split("/")[4]}&id=${window.location.href.split("/")[5]}&u=1`, 'json', 'GET', '', 'url');
  1611. }
  1612. }
  1613. // [阿狸漫画] 插入数据
  1614. function alimanhua_insertE(pageE, type) {
  1615. if (!pageE) return
  1616. if (type === 'url') { // 获取下一页链接
  1617. alimanhua_nextL(pageE, type); return
  1618. }
  1619. insScript('head>script:not([src])', pageE);
  1620.  
  1621. // 插入图片
  1622. let _img = '', _host='http://res.img.tueqi.com/';
  1623. if (location.hostname == '') _host = 'https://res.img.96youhuiquan.com/'
  1624. for (let i=1;i<photosr.length;i++){_img += `<img src="${_host}${photosr[i]}">`;}
  1625. getCSS(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
  1626. addHistory(pageE);
  1627. pageNum.now = pageNum._now + 1
  1628. }
  1629.  
  1630.  
  1631. // [Mangabz 漫画] 初始化(调整本话图片)
  1632. function mangabz_init() {
  1633. if (getCSS('#showimage')) getCSS('#showimage').removeAttribute('oncontextmenu');
  1634. if (getCSS('#cp_img')) getCSS('#cp_img').removeAttribute('oncontextmenu');
  1635. if (getCSS('#barChapter')) getCSS('#barChapter').removeAttribute('oncontextmenu');
  1636. if (getCSS('#cp_image')) {
  1637. getCSS('#cp_image').removeAttribute('oncontextmenu');
  1638. getCSS('#cp_image').removeAttribute('id');
  1639. getCSS('#cp_image').removeAttribute('style');
  1640. }
  1641. }
  1642. // [Mangabz 漫画] 获取下一页地址
  1643. function mangabz_nextL() {
  1644. var url = '';
  1645. if (MANGABZ_PAGE === MANGABZ_IMAGE_COUNT) { // 下一话
  1646. if (getNextE('//a[./img[contains(@src, "icon_xiayizhang")]]')) getPageE_(curSite.pageUrl); // 访问下一话 URL 获取
  1647. } else { // 下一页
  1648. if (!mkey) var mkey = '';
  1649. url = location.origin + location.pathname + 'chapterimage.ashx' + `?cid=${MANGABZ_CID}&page=${MANGABZ_PAGE + 1}&key=${(mkey)}&_cid=${MANGABZ_CID}&_mid=${MANGABZ_MID}&_dt=${MANGABZ_VIEWSIGN_DT}&_sign=${MANGABZ_VIEWSIGN}`
  1650. if (url === curSite.pageUrl) return
  1651. curSite.pageUrl = url
  1652. //console.log(curSite.pageUrl)
  1653. getPageE_(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取
  1654. }
  1655. }
  1656. // [Mangabz 漫画] 插入数据
  1657. function mangabz_insertE(pageE, type) {
  1658. if (pageE) {
  1659. if (type === 'Next') { // 下一页
  1660. let imgArr = eval(pageE),
  1661. _img = '';
  1662. for (let now of imgArr) {_img += `<img src="${now}">`;}
  1663. if (_img) {
  1664. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  1665. MANGABZ_PAGE += imgArr.length;
  1666. addHistory(pageE, document.title, location.origin + MANGABZ_CURL.substring(0, MANGABZ_CURL.length - 1) + '-p' + MANGABZ_PAGE + '/');
  1667. }
  1668. } else { // 下一话
  1669. // 插入 <script> 标签
  1670. insScript('html:not([dir]) > head > script:not([src])', pageE);
  1671. addHistory(pageE);
  1672. pageNum.now = pageNum._now + 1
  1673. replaceElems(pageE)
  1674. MANGABZ_PAGE = 0;
  1675. mangabz_nextL();
  1676. }
  1677. }
  1678. }
  1679.  
  1680.  
  1681. // [动漫屋] 获取下一页地址
  1682. function dm5_nextL() {
  1683. var url = '';
  1684. if (DM5_PAGE === DM5_IMAGE_COUNT) { // 下一话
  1685. if (getNextE('//div[@class="view-paging"]//a[text()="下一章"]')) getPageE_(curSite.pageUrl); // 访问下一话 URL 获取
  1686. } else { // 下一页
  1687. if (!mkey) var mkey = '';
  1688. url = location.origin + location.pathname + 'chapterfun.ashx' + `?cid=${DM5_CID}&page=${DM5_PAGE + 1}&key=${(mkey)}&language=1&gtk=6&_cid=${DM5_CID}&_mid=${DM5_MID}&_dt=${DM5_VIEWSIGN_DT}&_sign=${DM5_VIEWSIGN}`
  1689. if (url === curSite.pageUrl) return
  1690. curSite.pageUrl = url
  1691. //console.log(curSite.pageUrl)
  1692. getPageE_(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取
  1693. }
  1694. }
  1695. // [动漫屋] 插入数据
  1696. function dm5_insertE(pageE, type) {
  1697. if (pageE) {
  1698. if (type === 'Next') { // 下一页
  1699. let imgArr = eval(pageE),
  1700. _img = '';
  1701. for (let now of imgArr) {_img += `<img src="${now}">`;}
  1702. if (_img) {
  1703. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  1704. DM5_PAGE += imgArr.length;
  1705. addHistory(pageE, document.title, location.origin + DM5_CURL.substring(0, DM5_CURL.length - 1) + '-p' + DM5_PAGE + '/');
  1706. }
  1707. } else { // 下一话
  1708. // 插入 <script> 标签
  1709. insScript('html:not([dir])>head>script:not([src])', pageE);
  1710. addHistory(pageE);
  1711. pageNum.now = pageNum._now + 1
  1712. replaceElems(pageE)
  1713. DM5_PAGE = 0;
  1714. dm5_nextL();
  1715. }
  1716. }
  1717. }
  1718.  
  1719.  
  1720. // [Xmanhua 漫画] 获取下一页地址
  1721. function xmanhua_nextL() {
  1722. var url = '';
  1723. if (XMANHUA_PAGE === XMANHUA_IMAGE_COUNT) { // 下一话
  1724. if (getNextE('//a[./img[contains(@src, "reader-bottom-right-2.png")]]')) getPageE_(curSite.pageUrl); // 访问下一话 URL 获取
  1725. } else { // 下一页
  1726. if (!mkey) var mkey = '';
  1727. url = location.origin + location.pathname + 'chapterimage.ashx' + `?cid=${XMANHUA_CID}&page=${XMANHUA_PAGE + 1}&key=${(mkey)}&_cid=${XMANHUA_CID}&_mid=${XMANHUA_MID}&_dt=${XMANHUA_VIEWSIGN_DT}&_sign=${XMANHUA_VIEWSIGN}`
  1728. if (url === curSite.pageUrl) return
  1729. curSite.pageUrl = url
  1730. //console.log(curSite.pageUrl)
  1731. getPageE_(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取
  1732. }
  1733. }
  1734. // [Xmanhua 漫画] 插入数据
  1735. function xmanhua_insertE(pageE, type) {
  1736. if (pageE) {
  1737. if (type === 'Next') { // 下一页
  1738. let imgArr = eval(pageE),
  1739. _img = '';
  1740. for (let now of imgArr) {_img += `<img src="${now}">`;}
  1741. if (_img) {
  1742. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  1743. XMANHUA_PAGE += imgArr.length;
  1744. addHistory(pageE, document.title, location.origin + XMANHUA_CURL.substring(0, XMANHUA_CURL.length - 1) + '-p' + XMANHUA_PAGE + '/');
  1745. }
  1746. } else { // 下一话
  1747. // 插入 <script> 标签
  1748. insScript('html:not([dir]) > head > script:not([src])', pageE);
  1749. addHistory(pageE);
  1750. pageNum.now = pageNum._now + 1
  1751. replaceElems(pageE)
  1752. XMANHUA_PAGE = 0;
  1753. xmanhua_nextL();
  1754. }
  1755. }
  1756. }
  1757.  
  1758.  
  1759. // [国家自然科学基金] 获取下一页地址
  1760. function nsfc_nextL() {
  1761. let id = decodeURIComponent(document.location.href.split('/')[document.location.href.split('/').length - 1]), data
  1762. if (!document.nowPageNum) document.nowPageNum = 2
  1763. data = `id=${id}&index=${document.nowPageNum}`
  1764. if (data === curSite.pageUrl) return
  1765. curSite.pageUrl = data
  1766. getPageE_(location.origin + '/baseQuery/data/completeProjectReport', 'json', 'POST', data); // 访问下一页 URL 获取
  1767. }
  1768. // [国家自然科学基金] 插入数据
  1769. function nsfc_insertE(pageE, type) {
  1770. if (!pageE || pageE.code != 200) {curSite.SiteTypeID = 0; return}
  1771. if (!pageE.data.hasnext) {curSite.SiteTypeID = 0} else {document.nowPageNum++}
  1772. pageNum.now = pageNum._now + 1
  1773. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), `<img style="width: 100%;" data-magnify="gallery" data-src="${pageE.data.url}" src="${pageE.data.url}">`);
  1774. }
  1775.  
  1776.  
  1777.  
  1778. // [酷科研] 获取下一页地址
  1779. function coolkeyan_nextL() {
  1780. if (!getCSS('.q-img__image')) return
  1781. let id = getCSS('.q-breadcrumbs--last > span.q-breadcrumbs__el'), data
  1782. if (id && id.textContent) {id=parseInt(id.textContent)} else {return}
  1783. if (!document.nowPageNum) document.nowPageNum = 2
  1784. data = `ratify_no=${id}&index=${document.nowPageNum}`
  1785. if (data === curSite.pageUrl) return
  1786. curSite.pageUrl = data
  1787. getPageE_(location.origin + '/api/funds/nsfc/creport?' + data, 'json', 'GET'); // 访问下一页 URL 获取
  1788. }
  1789. // [酷科研] 插入数据
  1790. function coolkeyan_insertE(pageE, type) {
  1791. if (!pageE || pageE == {}) {curSite.SiteTypeID = 0; return}
  1792. if (!pageE.url) {curSite.SiteTypeID = 0; return} else {document.nowPageNum++}
  1793. pageNum.now = pageNum._now + 1
  1794. getCSS('.q-img>div[style*="padding-bottom"]').style.paddingBottom = `${(document.nowPageNum * 1000) - 1000}px`
  1795. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), `<div class="q-img__image absolute-full" style="background-size: contain; background-position: 50% 50%; background-image: url('${pageE.url}'); top: ${(document.nowPageNum * 1000) - 2000}px"></div>`);
  1796. }
  1797.  
  1798.  
  1799. // --------------------------------------------------------
  1800.  
  1801.  
  1802. // 自动无缝翻页
  1803. function pageLoading() {
  1804. if (curSite.SiteTypeID === 0 || !curSite.pager) return
  1805. if (curSite.pager.type === undefined) curSite.pager.type = 1; // 默认翻页模式 1
  1806. if (curSite.pager.scrollD === undefined) curSite.pager.scrollD = 2000; // 默认翻页触发线 2000
  1807. if (curSite.pager.interval === undefined) curSite.pager.interval = 500; // 默认间隔时间 500ms
  1808. //console.log(curSite)
  1809. curSite.pageUrl = ''; // 下一页URL
  1810. windowScroll(function (direction, e) {
  1811. // 下滑 且 未暂停翻页 且 SiteTypeID > 0 时,才准备翻页
  1812. if (direction != 'down' || !pausePage || curSite.SiteTypeID == 0) return
  1813.  
  1814. // 翻页模式 5 且为框架内时,要判断顶层是否通过页码暂停翻页了
  1815. if (curSite.pager.type == 5 && self != top && window.top.document.xiu_pausePage == false) return
  1816.  
  1817. let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
  1818. scrollHeight = window.innerHeight || document.documentElement.clientHeight,
  1819. scrollD = curSite.pager.scrollD;
  1820. // <<<<< 翻页类型 3(依靠 [基准元素] 与 [浏览器可视区域底部] 之间的距离缩小来触发翻页)>>>>>
  1821. if (curSite.pager.type === 3) {
  1822. if (!curSite.pager.scrollE) curSite.pager.scrollE = curSite.pager.replaceE; // 默认基准元素是页码
  1823. let scrollE = getOne(curSite.pager.scrollE);
  1824. //console.log(scrollE.offsetTop, scrollE.offsetTop - (scrollTop + scrollHeight), scrollD, scrollTop + scrollHeight, curSite.SiteTypeID)
  1825. if (scrollE.offsetTop - (scrollTop + scrollHeight) <= scrollD) {intervalPause(); checkURL(getPageE);}
  1826.  
  1827. } else if (document.documentElement.scrollHeight <= scrollHeight + scrollTop + scrollD) {
  1828. // <<<<< 翻页类型 1(由脚本实现自动无缝翻页)>>>>>
  1829. if (curSite.pager.type === 1) {
  1830. intervalPause(); checkURL(getPageE);
  1831.  
  1832. // <<<<< 翻页类型 2(网站自带了自动无缝翻页功能,只需要点击下一页按钮即可)>>>>>
  1833. } else if (curSite.pager.type === 2) {
  1834. let autopbn = getOne(curSite.pager.nextL);
  1835. if (!autopbn) return
  1836. if (curSite.pager.isHidden && isHidden(autopbn)) return // 如果 isHidden = true,那么需要判断元素是否隐藏
  1837. if (curSite.pager.nextText) {
  1838. //console.log(curSite.pager.nextText, autopbn.innerText, autopbn)
  1839. // 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页
  1840. if (autopbn.innerText === curSite.pager.nextText) {autopbn.click(); pageNum.now = pageNum._now + 1;}
  1841. } else if (curSite.pager.nextTextOf) {
  1842. // 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页
  1843. if (autopbn.innerText.indexOf(curSite.pager.nextTextOf) > -1) {autopbn.click(); pageNum.now = pageNum._now + 1;}
  1844. } else if (curSite.pager.nextHTML) {
  1845. // 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页
  1846. if (autopbn.innerHTML === curSite.pager.nextHTML) {autopbn.click(); pageNum.now = pageNum._now + 1;}
  1847. } else {
  1848. intervalPause();
  1849. // 如果没有指定按钮文字就直接点击
  1850. autopbn.click(); pageNum.now = pageNum._now + 1;
  1851. }
  1852.  
  1853. // <<<<< 翻页类型 4(部分简单的动态加载类网站)>>>>>
  1854. } else if (curSite.pager.type === 4) {
  1855. intervalPause(); if (typeof curSite.pager.nextL == 'function') {curSite.pager.nextL();} else if (getNextE(curSite.pager.nextL)) {getPageE_(curSite.pageUrl);}
  1856.  
  1857. // <<<<< 翻页类型 5(插入 iframe 方式来加载下一页)>>>>>
  1858. } else if (curSite.pager.type === 5) {
  1859. checkURL(insIframe);
  1860.  
  1861. // <<<<< 翻页类型 6(通过 iframe 获取下一页动态加载内容)>>>>>
  1862. } else if (curSite.pager.type === 6) {checkURL(insIframe_);}
  1863. }
  1864. });
  1865.  
  1866. function intervalPause() {
  1867. if (curSite.pager.interval) {
  1868. pausePage = false
  1869. setTimeout(function(){pausePage = true;}, curSite.pager.interval)
  1870. }
  1871. }
  1872. }
  1873.  
  1874. // 翻页类型 1/3
  1875. function getPageE(url) {
  1876. GM_xmlhttpRequest({
  1877. url: url,
  1878. method: 'GET',
  1879. overrideMimeType: 'text/html; charset=' + (document.characterSet||document.charset||document.inputEncoding),
  1880. headers: {
  1881. 'Referer': (curSite.noReferer === true) ? '':location.href,
  1882. 'User-Agent': navigator.userAgent,
  1883. 'Accept': 'text/html,application/xhtml+xml,application/xml'
  1884. },
  1885. timeout: 10000,
  1886. onload: function (response) {
  1887. try {
  1888. //console.log('URL:' + url, '最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  1889. processElems(createDocumentByString(response.responseText));
  1890. } catch (e) {
  1891. console.error('[自动无缝翻页] - 处理获取到的下一页内容时出现问题,请检查!', e, response.responseText);
  1892. }
  1893. },
  1894. onerror: function (response) {
  1895. console.log('URL:' + url, response)
  1896. GM_notification({text: '❌ 获取下一页失败...', timeout: 5000});
  1897. },
  1898. ontimeout: function (response) {
  1899. setTimeout(function(){curSite.pageUrl = '';}, 3000)
  1900. console.log('URL:' + url, response)
  1901. GM_notification({text: '❌ 获取下一页超时,可 3 秒后再次滚动网页重试(或尝试刷新网页)...', timeout: 5000});
  1902. }
  1903. });
  1904. }
  1905. // 翻页类型 4
  1906. function getPageE_(url, type = '', method = 'GET', data = '', type2) {
  1907. let mimeType,accept;
  1908. switch (type) {
  1909. case 'json':
  1910. accept = 'application/json'; mimeType = 'application/json; charset=' + (document.characterSet||document.charset||document.inputEncoding); break;
  1911. case 'text':
  1912. accept = 'text/plain'; mimeType = 'text/plain; charset=' + (document.characterSet||document.charset||document.inputEncoding); break;
  1913. default:
  1914. accept = 'text/html,application/xhtml+xml,application/xml'; mimeType = 'text/html; charset=' + (document.characterSet||document.charset||document.inputEncoding);
  1915. }
  1916.  
  1917. GM_xmlhttpRequest({
  1918. url: url,
  1919. method: method,
  1920. data: data,
  1921. responseType: type,
  1922. overrideMimeType: mimeType,
  1923. headers: {
  1924. 'Referer': (curSite.noReferer === true) ? '':location.href,
  1925. 'Content-Type': (method === 'POST') ? 'application/x-www-form-urlencoded':'',
  1926. 'User-Agent': navigator.userAgent,
  1927. 'Accept': accept
  1928. },
  1929. timeout: 10000,
  1930. onload: function (response) {
  1931. try {
  1932. //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  1933. switch (type) {
  1934. case 'json':
  1935. curSite.pager.insertE(response.response, type2);
  1936. break;
  1937. case 'text':
  1938. curSite.pager.insertE(response.responseText, type2)
  1939. break;
  1940. default:
  1941. curSite.pager.insertE(createDocumentByString(response.responseText), type2)
  1942. }
  1943. } catch (e) {
  1944. console.log(e);
  1945. }
  1946. },
  1947. onerror: function (response) {
  1948. console.log('URL:' + url, response)
  1949. GM_notification({text: '❌ 获取下一页失败...', timeout: 5000});
  1950. },
  1951. ontimeout: function (response) {
  1952. setTimeout(function(){curSite.pageUrl = '';}, 3000)
  1953. console.log('URL:' + url, response)
  1954. GM_notification({text: '❌ 获取下一页超时,可 3 秒后再次滚动网页重试(或尝试刷新网页)...', timeout: 5000});
  1955. }
  1956. });
  1957. }
  1958. // 翻页类型 5(插入 iframe 方式加载下一页,无限套娃)
  1959. function insIframe(src) {
  1960. // 停用当前页面翻页
  1961. if (curSite.SiteTypeID == 0) return
  1962. curSite.SiteTypeID = 0;
  1963.  
  1964. // 创建 iframe
  1965. let iframe = document.createElement('iframe');
  1966. iframe.id = 'Autopage_iframe';
  1967. iframe.src = src.replace(/#.+$/,'');
  1968.  
  1969. document.documentElement.appendChild(document.createElement('style')).textContent = 'iframe#Autopage_iframe {position: absolute !important; width: 100% !important; height: 100% !important; border: none !important;}';
  1970.  
  1971. var beforeScrollTop = document.documentElement.scrollTop || document.body.scrollTop
  1972. // 当滚动条到底部时(即完全显示 iframe 框架),隐藏当前页面的滚动条
  1973. window.addEventListener('scroll', function () {
  1974. let scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  1975. clientHeight = document.documentElement.clientHeight || document.body.clientHeight,
  1976. scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight,
  1977. afterScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  1978. delta = afterScrollTop - beforeScrollTop;
  1979. if (delta == 0) return false;
  1980. beforeScrollTop = afterScrollTop;
  1981.  
  1982. //console.log(delta, (scrollTop + clientHeight + 10), scrollHeight, '1111')
  1983. if (delta > 0 && scrollTop + clientHeight + 10 >= scrollHeight && !getCSS('#Autopage_iframe-scroll')) {
  1984. let newStyle = document.createElement('style'); newStyle.id = 'Autopage_iframe-scroll';
  1985. newStyle.textContent = 'html::-webkit-scrollbar, body::-webkit-scrollbar {width: 0 !important;height: 0 !important;} html, body {scrollbar-width: none !important;}';
  1986. if (curSite.pager.style) newStyle.textContent += curSite.pager.style;
  1987. document.documentElement.appendChild(newStyle);
  1988.  
  1989. // 恢复 iframe 的滚动条
  1990. if (iframe.contentWindow.document.querySelectorAll('#Autopage_iframe-scroll-hidden')) iframe.contentWindow.document.querySelectorAll('#Autopage_iframe-scroll-hidden').forEach((o)=>{o.remove();});
  1991.  
  1992. // 给予 iframe 焦点
  1993. iframe.focus();
  1994. if (iframe.contentWindow.document.body) {iframe.contentWindow.document.body.focus(); iframe.contentWindow.document.body.click();}
  1995. } else if (delta < 0 && scrollTop + clientHeight + 10 <= scrollHeight && getCSS('#Autopage_iframe-scroll')) {
  1996. getCSS('#Autopage_iframe-scroll').remove();
  1997. // 再次禁用 iframe 的滚动条
  1998. if (!iframe.contentWindow.document.getElementById('Autopage_iframe-scroll-hidden')) {
  1999. let newStyle = document.createElement('style'); newStyle.id = 'Autopage_iframe-scroll-hidden';
  2000. newStyle.textContent = 'html, body {overflow: hidden !important;}';
  2001. iframe.contentWindow.document.documentElement.appendChild(newStyle);
  2002. }
  2003. }
  2004. }, false);
  2005.  
  2006. // 加载完成后才继续
  2007. iframe.onload = function() {
  2008. // 暂时禁用 iframe 的滚动条
  2009. if (!getCSS('#Autopage_iframe-scroll') && !iframe.contentWindow.document.getElementById('Autopage_iframe-scroll-hidden')) {
  2010.  
  2011. let newStyle = document.createElement('style'); newStyle.id = 'Autopage_iframe-scroll-hidden';
  2012. newStyle.textContent = 'html, body {overflow: hidden !important;}';
  2013. iframe.contentWindow.document.documentElement.appendChild(newStyle);
  2014. }
  2015.  
  2016. // 添加历史记录
  2017. if (curSite.history === undefined) {
  2018. if (GM_getValue('menu_history', true)) addHistory(iframe.contentWindow.document, iframe.contentWindow.document.title);
  2019. } else {
  2020. if (curSite.history) addHistory(iframe.contentWindow.document, iframe.contentWindow.document.title);
  2021. }
  2022. // 当前页码 + 1
  2023. if (!curSite.hiddenPN) {
  2024. let autopageNumber = getCSS('#Autopage_number', window.top.document)
  2025. if (autopageNumber) {autopageNumber.textContent = parseInt(autopageNumber.textContent) + 1;}
  2026. }
  2027. }
  2028.  
  2029. // 插入 iframe
  2030. if (location.hostname == 'www.cocomanga.com') {
  2031. document.body.appendChild(iframe);
  2032. } else {
  2033. document.documentElement.appendChild(iframe);
  2034. }
  2035. }
  2036. // 翻页类型 6(通过 iframe 获取下一页动态加载内容,只有一个娃)
  2037. function insIframe_(src) {
  2038. // 暂停翻页
  2039. if (!pausePage) return
  2040. pausePage = false
  2041.  
  2042. //console.log('000',src)
  2043. // 如果不存在,则创建一个 iframe
  2044. let iframe = document.getElementById('Autopage_iframe');
  2045. if (!iframe) {
  2046. iframe = document.createElement('iframe');
  2047. //iframe.sandbox = 'allow-same-origin allow-scripts allow-popups allow-forms';
  2048. iframe.id = 'Autopage_iframe';
  2049. iframe.src = src.replace(/#.+$/,'');
  2050.  
  2051. document.documentElement.appendChild(document.createElement('style')).textContent = 'iframe#Autopage_iframe {position: absolute !important; top: -9999px !important; left: -9999px !important; width: 100% !important; height: 100% !important; border: none !important; z-index: -999 !important;}';
  2052. }
  2053.  
  2054. // 加载完成后才继续
  2055. iframe.onload = function() {
  2056. if (!curSite.pager.loadTime) curSite.pager.loadTime = 300; // 默认 300ms
  2057. let time1 = 0 ,time2 = setInterval(function(){
  2058. let scrollHeight = (iframe.contentWindow.document.documentElement.scrollHeight || iframe.contentWindow.document.body.scrollHeight)/10
  2059. iframe.contentWindow.scrollTo(0, 999999);
  2060. iframe.contentWindow.scrollTo(0, scrollHeight*time1);
  2061. if (++time1 == 10) {
  2062. clearInterval(time2);
  2063. processElems(iframe.contentWindow.document); // 插入/替换元素等
  2064. pausePage = true; // 恢复翻页
  2065. }
  2066. }, curSite.pager.loadTime/10)
  2067. }
  2068.  
  2069. // 插入 iframe(如果已存在则直接改 src)
  2070. if (document.getElementById('Autopage_iframe')) {
  2071. iframe.src = src.replace(/#.+$/,'');
  2072. } else {
  2073. document.documentElement.appendChild(iframe);
  2074. }
  2075. }
  2076.  
  2077.  
  2078. // XHR 后处理结果,插入、替换元素等(适用于翻页类型 1/3/6)
  2079. function processElems(response) {
  2080. if (!curSite.pager.insertP) {curSite.pager.insertP = [curSite.pager.pageE, 5]}
  2081. let pageE = getAll(curSite.pager.pageE, response, response), toE;
  2082. if (curSite.pager.insertP[1] === 5) { // 插入 pageE 列表最后一个元素的后面
  2083. toE = toE5pop(getAll(curSite.pager.insertP[0]));
  2084. } else {
  2085. toE = getOne(curSite.pager.insertP[0]);
  2086. }
  2087. //console.log(curSite.pager.pageE, pageE, curSite.pager.insertP, toE)
  2088.  
  2089. if (pageE.length > 0 && toE) {
  2090. // 如果有插入前函数就执行函数
  2091. if (curSite.function && curSite.function.bF) {
  2092. if (curSite.function.bFp) { // 如果指定了参数
  2093. if (typeof(curSite.function.bF) == 'string') { // 如果是字符串,说明是自定义规则
  2094. pageE = new Function('pageE', 'bFp', 'fun', curSite.function.bF)(pageE, curSite.function.bFp, window.autoPage)
  2095. } else {
  2096. pageE = curSite.function.bF(pageE, curSite.function.bFp);
  2097. }
  2098. } else {
  2099. if (typeof(curSite.function.bF) == 'string') { // 如果是字符串,说明是自定义规则
  2100. pageE = new Function('pageE', 'fun', curSite.function.bF)(pageE, window.autoPage)
  2101. } else {
  2102. pageE = curSite.function.bF(pageE);
  2103. }
  2104. }
  2105. }
  2106.  
  2107. // 强制新标签页打开链接
  2108. if (curSite.blank === 4) {pageE = forceTarget(pageE);}
  2109.  
  2110. // 插入位置
  2111. let addTo = getAddTo(curSite.pager.insertP[1]);
  2112.  
  2113. // 插入新页面元素
  2114. if (curSite.pager.insertP[1] === 6) { // 插入到目标内部末尾(针对文本,比如小说网页)
  2115. let afterend = '';
  2116. if (curSite.pager.insertP6Br) afterend += '<br/><br/>'
  2117. pageE.forEach(function (one) {afterend += one.innerHTML;});
  2118. toE.insertAdjacentHTML(addTo, afterend);
  2119. } else {
  2120. if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 插入到 [元素内头部]、[目标本身后面] 时,需要反转顺序
  2121. pageE.forEach(function (one) {toE.insertAdjacentElement(addTo, one);});
  2122. }
  2123.  
  2124. // 当前页码 + 1
  2125. pageNum.now = pageNum._now + 1
  2126.  
  2127. // 添加历史记录
  2128. if (curSite.history === undefined) {
  2129. if (GM_getValue('menu_history', true)) addHistory(response);
  2130. } else {
  2131. if (curSite.history) addHistory(response);
  2132. }
  2133.  
  2134. // 替换待替换元素
  2135. if (curSite.pager.replaceE) replaceElems(response);
  2136.  
  2137. // 插入 <script> 标签
  2138. if (curSite.pager.scriptT || curSite.pager.scriptT == 0) {
  2139. switch (curSite.pager.scriptT) {
  2140. case 0: // 下一页的所有 <script> 标签
  2141. insScript('script', response); break;
  2142. case 1: // 下一页的所有 <script> 标签(不包括 src 链接)
  2143. insScript('script:not([src])', response); break;
  2144. case 2: // 下一页主体元素 (pageE) 的同级 <script> 标签
  2145. if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 为了避免 JS 执行顺序反了,还需要再给反转回去
  2146. insScript(null, pageE); break;
  2147. case 3: // 下一页主体元素 (pageE) 的子元素 <script> 标签
  2148. if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 为了避免 JS 执行顺序反了,还需要再给反转回去
  2149. insScript('script:not([src])', pageE); break;
  2150. }
  2151. }
  2152.  
  2153. // 如果有插入后函数就执行函数
  2154. if (curSite.function && curSite.function.aF) {
  2155. if (curSite.function.aFp) { // 如果指定了参数
  2156. if (typeof(curSite.function.aF) == 'string') { // 如果是字符串,说明是自定义规则
  2157. new Function('aFp', 'fun', curSite.function.aF)(curSite.function.aFp, window.autoPage)
  2158. } else {
  2159. curSite.function.aF(curSite.function.aFp);
  2160. }
  2161. } else {
  2162. if (typeof(curSite.function.aF) == 'string') { // 如果是字符串,说明是自定义规则
  2163. new Function('fun', curSite.function.aF)(window.autoPage);
  2164. } else {
  2165. curSite.function.aF();
  2166. }
  2167. }
  2168. }
  2169. } else { // 获取主体元素失败后,尝试重新获取
  2170. console.log(curSite.pager.pageE, pageE, curSite.pager.insertP, toE, response)
  2171. if (curSite.retry) {
  2172. console.warn('[自动无缝翻页] 获取主体元素失败,尝试重新获取...')
  2173. setTimeout(function(){curSite.pageUrl = '';}, curSite.retry)
  2174. } else {
  2175. console.error('[自动无缝翻页] 获取主体元素失败...')
  2176. // 尝试替换元素看能不能继续翻页下去
  2177. /*if (curSite.pager.replaceE) {
  2178. if (replaceElems(response)) { // 如果替换成功
  2179. console.log('[自动无缝翻页] 获取主体元素失败,尝试替换元素成功!')
  2180. // 当前页码 + 1
  2181. pageNum.now = pageNum._now + 1;
  2182. // 添加历史记录
  2183. if (curSite.history === undefined) {
  2184. if (GM_getValue('menu_history', true)) addHistory(response);
  2185. } else {
  2186. if (curSite.history) addHistory(response);
  2187. }
  2188. } else {console.error('[自动无缝翻页] 获取主体元素失败,尝试替换元素失败...')}
  2189. }*/
  2190. }
  2191. }
  2192. }
  2193. // 通用型插入前函数(加载图片)
  2194. function src_bF(pageE, css = [0, 'img[data-original], img[data-src]', 'data-original']) {
  2195. if (css[2] === undefined) css[2] = 'data-original'
  2196. pageE.forEach(function (one) {
  2197. if (css[0] == 0) { // src 图片
  2198. if (one.tagName === 'IMG') {
  2199. if (one.getAttribute(css[2])){one.src = one.getAttribute(css[2]);}else if (one.dataset.src){one.src = one.dataset.src;}
  2200. } else {
  2201. one.querySelectorAll(css[1]).forEach(function (now) {if (now.getAttribute(css[2])){now.src = now.getAttribute(css[2]);}else if (now.dataset.src){now.src = now.dataset.src;};});
  2202. }
  2203. } else if (css[0] == 1) { // 背景图片
  2204. if (one.tagName === 'IMG') {
  2205. if (one.getAttribute(css[2])){one.style.backgroundImage = 'url("' + one.getAttribute(css[2]) + '")';}else if (one.dataset.src){one.style.backgroundImage = 'url("' + one.dataset.src + '")';}
  2206. } else {
  2207. one.querySelectorAll(css[1]).forEach(function (now) {if (now.getAttribute(css[2])){now.style.backgroundImage = 'url("' + now.getAttribute(css[2]) + '")';}else if (now.dataset.src){now.style.backgroundImage = 'url("' + now.dataset.src + '")';};});
  2208. }
  2209. }
  2210. });
  2211. return pageE
  2212. }
  2213. // 文字型插入前函数(正则过滤)
  2214. function xs_bF(pageE, reg) {
  2215. pageE.forEach(function (one) {one.innerHTML = one.innerHTML.replace(reg[0], reg[1])});
  2216. return pageE
  2217. }
  2218.  
  2219. // 通用型获取下一页地址(从 元素 中获取页码)
  2220. function getNextE(css) {
  2221. if (!css) css = curSite.pager.nextL;
  2222. let next = getOne(css);
  2223. if (next && next.nodeType === 1 && next.href && next.href.slice(0,4) === 'http' && next.getAttribute('href').slice(0,1) !== '#') {
  2224. if (next.href != curSite.pageUrl) {
  2225. if (curSite.pager.forceHTTPS && location.protocol === 'https:') {
  2226. if (next.href.replace(/^http:/,'https:') === curSite.pageUrl) {
  2227. return false
  2228. }
  2229. curSite.pageUrl = next.href.replace(/^http:/,'https:');
  2230. } else {
  2231. curSite.pageUrl = next.href;
  2232. }
  2233. } else {
  2234. return false
  2235. }
  2236. //console.log(curSite.pageUrl)
  2237. return true
  2238. }
  2239. return false
  2240. }
  2241. // 通用型获取下一页地址(从 元素 中获取页码,URL 替换 page= 参数)
  2242. function getNextEP(css, pf, reg) {
  2243. let nextNum = getOne(css), url = '';
  2244. if (nextNum && nextNum.textContent) {
  2245. nextNum = nextNum.textContent.replaceAll(' ','');
  2246. if (location.search) {
  2247. if (indexOF(pf, 's')) {
  2248. url = location.search.replace(reg, pf + nextNum);
  2249. } else {
  2250. url = location.search + '&' + pf + nextNum;
  2251. }
  2252. } else {
  2253. url = '?' + pf + nextNum;
  2254. }
  2255. url = location.origin + location.pathname + url;
  2256. }
  2257. //console.log('111', url)
  2258. return url
  2259. }
  2260. // 通用型获取下一页地址(直接给定页码,URL 替换 page= 参数)
  2261. function getNextSP(page, pf, reg) {
  2262. let url = '';
  2263. if (!page) return url
  2264. if (typeof page === 'number') page = page.toString()
  2265. if (location.search) {
  2266. if (indexOF(pf, 's')) {
  2267. url = location.search.replace(reg, pf + page);
  2268. } else {
  2269. url = location.search + '&' + pf + page;
  2270. }
  2271. } else {
  2272. url = '?' + pf + page;
  2273. }
  2274. return (location.origin + location.pathname + url)
  2275. }
  2276. // 通用型获取下一页地址(从 元素 中获取页码,URL 替换 pathname 路径)
  2277. function getNextEPN(css, reg, a, b = '') {
  2278. let nextNum = getOne(css), url = '';
  2279. if (nextNum && nextNum.textContent) {
  2280. nextNum = nextNum.textContent.replaceAll(' ','');
  2281. if (location.pathname) {
  2282. if (indexOF(reg)) {
  2283. url = location.pathname.replace(reg, a + nextNum + b);
  2284. } else {
  2285. url = location.pathname + a + nextNum + b;
  2286. }
  2287. } else {
  2288. url = location.pathname + a + nextNum + b;
  2289. }
  2290. url = location.origin + url + location.search;
  2291. }
  2292. return url
  2293. }
  2294. // 通用型获取下一页地址(从 URL 中获取页码,URL 替换 pathname 路径)
  2295. function getNextUPN(urlReg, reg, a, b = '', initP = '2', endP) {
  2296. let nextNum = urlReg.exec(location.pathname);
  2297. if (nextNum) {
  2298. nextNum = String(parseInt(nextNum[0])+1);
  2299. if (endP && (parseInt(nextNum) > parseInt(endP))) return ''
  2300. } else {
  2301. nextNum = initP;
  2302. if (endP && (parseInt(nextNum) >= parseInt(endP))) return ''
  2303. }
  2304. let url = '';
  2305. if (location.pathname) {
  2306. if (indexOF(reg)) {
  2307. url = location.pathname.replace(reg, a + nextNum + b);
  2308. } else {
  2309. url = location.pathname + a + nextNum + b;
  2310. }
  2311. } else {
  2312. url = location.pathname + a + nextNum + b;
  2313. }
  2314. url = location.origin + url + location.search;
  2315. return url
  2316. }
  2317. // 通用型获取下一页地址(从 URL 中获取页码,URL 替换 page= 参数)
  2318. function getNextUP(pf, reg, lp = location.pathname, initP = '2', endP) {
  2319. let nextNum = getSearch(pf.replace('=',''));
  2320. if (nextNum) {
  2321. nextNum = String(parseInt(nextNum)+1);
  2322. if (endP && (parseInt(nextNum) > parseInt(endP))) return ''
  2323. } else {
  2324. nextNum = initP;
  2325. if (endP && (parseInt(nextNum) >= parseInt(endP))) return ''
  2326. }
  2327. let url = '';
  2328. if (location.search) {
  2329. if (indexOF(pf, 's')) {
  2330. url = location.search.replace(reg, pf + nextNum);
  2331. } else {
  2332. url = location.search + '&' + pf + nextNum;
  2333. }
  2334. } else {
  2335. url = '?' + pf + nextNum;
  2336. }
  2337. url = location.origin + lp + url;
  2338. return url
  2339. }
  2340. // 通用型获取下一页地址(从 form input 中获取,返回 GET URL)
  2341. function getNextF(css) {
  2342. let form = getOne(css), value = '';
  2343. if (form) {
  2344. form.querySelectorAll('input[name]').forEach(function(input) {value += input.name + '=' + input.value + '&';}) // 生成表单参数
  2345. value = encodeURI(value.replace(/&$/,'')); // 清理最后一个 & 符号
  2346. if (form.action && value) return (form.action + '?' + value)
  2347. }
  2348. return '';
  2349. }
  2350.  
  2351.  
  2352. // 检查 URL
  2353. function checkURL(func) {
  2354. if (!curSite.pager.nextL) return
  2355. if (typeof curSite.pager.nextL == 'function') {
  2356. let tempUrl = curSite.pager.nextL();
  2357. if (!tempUrl || tempUrl === curSite.pageUrl || tempUrl.slice(0,4) !== 'http') return
  2358. curSite.pageUrl = tempUrl;
  2359. func(curSite.pageUrl);
  2360. } else if (curSite.pager.nextL.search(/^js;/i) === 0) { // 自定义翻页规则中执行 JavaScript 代码的
  2361. try {
  2362. let tempUrl = new Function('fun', curSite.pager.nextL.slice(3))(window.autoPage);
  2363. if (!tempUrl || tempUrl === curSite.pageUrl || tempUrl.slice(0,4) !== 'http') return
  2364. curSite.pageUrl = tempUrl;
  2365. func(curSite.pageUrl);
  2366. } catch (e) {
  2367. console.error('[自动无缝翻页] - 当前网页规则 "nextL" 内 JS 代码有误,请检查!', e, curSite.pager.nextL);
  2368. }
  2369. } else if (getNextE()) {
  2370. func(curSite.pageUrl);
  2371. }
  2372. //console.log(curSite.pageUrl);
  2373. }
  2374. // 替换元素
  2375. function replaceElems(pageE, o = curSite.pager.replaceE, r = curSite.pager.replaceE) {
  2376. let oE = getAll(o),
  2377. rE = getAll(r, pageE, pageE);
  2378. if (oE.length != 0 && rE.length != 0 && oE.length === rE.length) {
  2379. for (let i = 0; i < oE.length; i++) {
  2380. oE[i].outerHTML = rE[i].outerHTML;
  2381. }
  2382. return true
  2383. } else {console.log(pageE,oE,rE)}
  2384. return false
  2385. }
  2386. // 添加历史记录
  2387. function addHistory(pageE, title, url) {
  2388. if (!curSite.pageUrl) return
  2389. // 对于自带类似功能 或者 覆盖了 history 原生函数的网站,则跳过不再添加历史记录
  2390. if (window.top.history.toString() !== '[object History]') return
  2391. title = title || ((pageE.querySelector('title')) ? pageE.querySelector('title').textContent : window.top.document.title);
  2392. url = url || curSite.pageUrl;
  2393. window.top.document.Autopage_nowUrl = curSite.pageUrl;
  2394. // 对于下一页 URL 和当前网页 URL 的协议不同时,以当前网页 URL 协议为准
  2395. if (url.indexOf(window.top.location.protocol) === -1) url = url.replace(/^https?:/,window.top.location.protocol)
  2396. window.top.history.pushState('Autopage_history', title, url);
  2397. window.top.document.title = title;
  2398. }
  2399. // 插入 <Script>
  2400. function insScript(selector, contextNode = document, toE = document.body) {
  2401. let scriptElems = contextNode;
  2402. if (selector) {
  2403. if (contextNode instanceof Array) {
  2404. scriptElems = []; contextNode.forEach(function (one) {scriptElems = scriptElems.concat(getAll(selector, one, one));})
  2405. } else {
  2406. scriptElems = getAll(selector, contextNode, contextNode);
  2407. }
  2408. }
  2409.  
  2410. scriptElems.forEach(function (one) {
  2411. if (one.tagName === 'SCRIPT') {
  2412. if (one.src) {
  2413. toE.appendChild(document.createElement('script')).src = one.src;
  2414. } else {
  2415. toE.appendChild(document.createElement('script')).textContent = one.textContent;//.replaceAll('document.write', '');
  2416. }
  2417. }
  2418. });
  2419. }
  2420. // 插入 <Style>
  2421. function insStyle(style) {
  2422. document.documentElement.appendChild(document.createElement('style')).textContent = style;
  2423. }
  2424.  
  2425.  
  2426. // 获取元素(CSS/Xpath)来自:https://github.com/machsix/Super-preloader
  2427. function getCSS(css, contextNode = document) {
  2428. return contextNode.querySelector(css);
  2429. }
  2430. function getAllCSS(css, contextNode = document) {
  2431. return [].slice.call(contextNode.querySelectorAll(css));
  2432. }
  2433. function getXpath(xpath, contextNode, doc = document) {
  2434. contextNode = contextNode || doc;
  2435. try {
  2436. const result = doc.evaluate(xpath, contextNode, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  2437. // 应该总是返回一个元素节点
  2438. return result.singleNodeValue && result.singleNodeValue.nodeType === 1 && result.singleNodeValue;
  2439. } catch (err) {
  2440. throw new Error(`无效 Xpath: ${xpath}`);
  2441. }
  2442. }
  2443. function getAllXpath(xpath, contextNode, doc = document) {
  2444. contextNode = contextNode || doc;
  2445. const result = [];
  2446. try {
  2447. const query = doc.evaluate(xpath, contextNode, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  2448. for (let i = 0; i < query.snapshotLength; i++) {
  2449. const node = query.snapshotItem(i);
  2450. // 如果是 Element 节点
  2451. if (node.nodeType === 1) result.push(node);
  2452. }
  2453. } catch (err) {
  2454. throw new Error(`无效 Xpath: ${xpath}`);
  2455. }
  2456. return result;
  2457. }
  2458. function getOne(selector, contextNode = undefined, doc = document) {
  2459. if (!selector) return;
  2460. contextNode = contextNode || doc;
  2461. if (selector.slice(0,1) === '/' || selector.slice(0,2) === './' || selector.slice(0,3) === 'id(') {
  2462. return getXpath(selector, contextNode, doc);
  2463. } else {
  2464. return getCSS(selector, contextNode);
  2465. }
  2466. }
  2467. function getAll(selector, contextNode = undefined, doc = document) {
  2468. if (!selector) return [];
  2469. contextNode = contextNode || doc;
  2470. if (selector.slice(0,1) === '/' || selector.slice(0,2) === './' || selector.slice(0,3) === 'id(') {
  2471. return getAllXpath(selector, contextNode, doc);
  2472. } else {
  2473. return getAllCSS(selector, contextNode);
  2474. }
  2475. }
  2476. function createDocumentByString(e) {
  2477. if (e) {
  2478. if ('HTML' !== document.documentElement.nodeName) return (new DOMParser).parseFromString(e, 'application/xhtml+xml');
  2479. var t;
  2480. try { t = (new DOMParser).parseFromString(e, 'text/html');} catch (e) {}
  2481. if (t) return t;
  2482. if (document.implementation.createHTMLDocument) {
  2483. t = document.implementation.createHTMLDocument('ADocument');
  2484. } else {
  2485. try {((t = document.cloneNode(!1)).appendChild(t.importNode(document.documentElement, !1)), t.documentElement.appendChild(t.createElement('head')), t.documentElement.appendChild(t.createElement('body')));} catch (e) {}
  2486. }
  2487. if (t) {
  2488. var r = document.createRange(),
  2489. n = r.createContextualFragment(e);
  2490. r.selectNodeContents(document.body);
  2491. t.body.appendChild(n);
  2492. for (var a, o = { TITLE: !0, META: !0, LINK: !0, STYLE: !0, BASE: !0}, i = t.body, s = i.childNodes, c = s.length - 1; c >= 0; c--) o[(a = s[c]).nodeName] && i.removeChild(a);
  2493. return t;
  2494. }
  2495. } else console.error('没有找到要转成 DOM 的字符串', e);
  2496. }
  2497.  
  2498.  
  2499. // 强制新标签页打开链接
  2500. function forceTarget(pageE) {
  2501. if (curSite.blank === 1) {
  2502. document.head.appendChild(document.createElement('base')).target = '_blank';
  2503.  
  2504. } else if (curSite.blank === 4) {
  2505. if (pageE) {
  2506. pageE.forEach(function (dd) {getAllCSS('a[href]:not([target="_blank"]):not([onclick]):not([href^="#"]):not([href^="javascript:"])',dd).forEach(function (a) {a.target = '_blank';});});
  2507. return pageE
  2508. }
  2509.  
  2510. let dd = toE5pop(getAll(curSite.pager.pageE));
  2511. if (dd && dd.parentElement != null) dd = dd.parentElement
  2512. getAllCSS('a[href]:not([target="_blank"]):not([onclick]):not([href^="#"]):not([href^="javascript:"])',dd).forEach(function (a) {a.target = '_blank';})
  2513.  
  2514. } else {
  2515. let d;
  2516. if (curSite.blank === 2) {
  2517. d = document.body
  2518. } else if (curSite.blank === 3) {
  2519. let dd = toE5pop(getAll(curSite.pager.pageE));
  2520. if (dd && dd.parentElement != null) d = dd.parentElement
  2521. }
  2522. if (!d) return
  2523.  
  2524. function forceTarget_(target, e){
  2525. if (target.href && target.target != '_blank' && !(target.getAttribute('onclick')) && target.href.slice(0,4) == 'http' && target.getAttribute('href').slice(0,1) != '#') {
  2526. e.preventDefault(); // 阻止默认打开链接事件
  2527. window.GM_openInTab(target.href, {active: true,insert: true,setParent: true});
  2528. }
  2529. }
  2530. d.addEventListener('click', function(e) {
  2531. //console.log(e.target.tagName, e.path)
  2532. if (e.target.tagName === 'A') {
  2533. forceTarget_(e.target, e);
  2534. } else {
  2535. let path = e.path || e.composedPath();
  2536. for (let i = 1; i < path.length - 4; i++) {if (path[i].tagName === 'A') {forceTarget_(path[i], e); break;}}
  2537. }
  2538. });
  2539. }
  2540. }
  2541. // 初始化事件
  2542. /*function initEvent() {
  2543. if (curSite.initE[1] == undefined) curSite.initE[1] = 500;
  2544. setTimeout(function(){getAllCSS(curSite.initE[0]).forEach(function (o) {o.innerHTML = o.innerHTML;});}, curSite.initE[1])
  2545. }*/
  2546. // 判断元素是否隐藏(隐藏返回 true)
  2547. function isHidden(el){
  2548. return (el.offsetParent === null);
  2549. }
  2550. // 判断是否为手机版(是则返回 true)
  2551. function isMobile(){
  2552. return (/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|MicroMessenger|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent) || (window.screen.width < 500 && window.screen.height < 800));
  2553. }
  2554. // 用以自定义规则中设置 urlC = true
  2555. function isUrlC(){
  2556. urlC = true;
  2557. }
  2558. // 判断 URL 是否存在指定文本
  2559. function indexOF(e, l = 'p', low = true){
  2560. switch (l) {
  2561. case 'h':
  2562. l = location.href; break;
  2563. case 'p':
  2564. l = location.pathname; break;
  2565. case 's':
  2566. l = location.search; break;
  2567. }
  2568. //console.log(l,e,l.indexOf(e))
  2569. if (e instanceof RegExp) {
  2570. if (e.test(l)) return true
  2571. } else {
  2572. if (low) {e = e.toLowerCase(); l = l.toLowerCase();} // 全部转为小写(即不区分大小写)
  2573. if (l.indexOf(e) != -1) return true
  2574. }
  2575. return false
  2576. }
  2577. // 获取 Search 指定参数
  2578. function getSearch(variable) {
  2579. let query = window.location.search.substring(1),
  2580. vars = query.split('&');
  2581. for (var i=0;i<vars.length;i++) {
  2582. var pair = vars[i].split('=');
  2583. if(pair[0] == variable){return pair[1];}
  2584. }
  2585. return '';
  2586. }
  2587. // 启用/禁用 (当前网站)
  2588. function menu_disable(type) {
  2589. switch(type) {
  2590. case 'check':
  2591. return check(); break;
  2592. case 'add':
  2593. add(); break;
  2594. case 'del':
  2595. del(); break;
  2596. }
  2597.  
  2598. function check() { // 存在返回真,不存在返回假
  2599. if (GM_getValue('menu_disable').indexOf(location.hostname) == -1) return false // 不存在返回假
  2600. return true
  2601. }
  2602.  
  2603. function add() {
  2604. if (check()) return
  2605. let list = GM_getValue('menu_disable'); // 读取网站列表
  2606. list.push(location.hostname); // 追加网站域名
  2607. GM_setValue('menu_disable', list); // 写入配置
  2608. location.reload(); // 刷新网页
  2609. }
  2610.  
  2611. function del() {
  2612. if (!check()) return
  2613. let list = GM_getValue('menu_disable'), // 读取网站列表
  2614. index = list.indexOf(location.hostname);
  2615. list.splice(index, 1); // 删除网站域名
  2616. GM_setValue('menu_disable', list); // 写入配置
  2617. location.reload(); // 刷新网页
  2618. }
  2619. }
  2620. // 左键双击网页空白处暂停翻页
  2621. function pausePageEvent() {
  2622. if (!GM_getValue('menu_pause_page')) return
  2623. if (curSite.SiteTypeID === 0) return
  2624. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  2625. document.body.addEventListener('dblclick', function () {
  2626. if (pausePage) {GM_notification({text: `❌ 已暂停本页 [自动无缝翻页]\n (再次双击可恢复)`, timeout: 2000});} else {GM_notification({text: `✅ 已恢复本页 [自动无缝翻页]\n (再次双击可暂停)`, timeout: 2000});}
  2627. pausePage = !pausePage;
  2628. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  2629. });
  2630. }
  2631. // 自定义翻页规则
  2632. function customRules() {
  2633. if (getCSS('#Autopage_customRules')) return
  2634.  
  2635. let customRules = JSON.stringify(GM_getValue('menu_customRules', {}), null, '\t');
  2636. if (customRules == '{}') customRules = '{\n\t\n}'; // 引导用户插入规则的位置
  2637. let _html = `<div id="Autopage_customRules" style="left: 0 !important; right: 0 !important; top: 0 !important; bottom: 0 !important; width: 100% !important; height: 100% !important; margin: auto !important; padding: 25px 10px 10px 10px !important; position: fixed !important; opacity: 0.95 !important; z-index: 99999 !important; background-color: #eee !important; color: #222 !important; font-size: 14px !important; overflow: scroll !important; text-align: left !important;">
  2638. <h3 style="font-size: 22px !important;overflow: hidden !important;text-overflow: ellipsis !important;white-space: nowrap !important;"><strong># 自定义翻页规则(优先级最高,会覆盖同名的外置翻页规则)-【将规则插入默认的 <code>{ }</code> 中间】</strong></h3>
  2639. <details><summary style="cursor: pointer;overflow: hidden !important;text-overflow: ellipsis !important;white-space: nowrap !important;"><kbd><strong>「 点击展开 查看规则示例 」(为了避免需要的时候还要找,我干脆把常用规则都一股脑塞进去了)</strong></kbd></summary>
  2640. <ul style="list-style: disc !important; margin-left: 35px !important;">
  2641. <li>翻页规则为 JSON 格式,因此大家需要多少<strong>了解一点 JSON 的基本格式</strong>(主要就是逗号、转义、双引号等)。</li>
  2642. <li>具体的翻页规则说明、示例,为了方便更新及补充,我都写到 <strong><a href="https://github.com/XIU2/UserScript/issues/176" target="_blank">Github</a></strong> 里面了。</li>
  2643. <li>脚本会自动格式化规则,因此<strong>无需手动缩进、换行</strong>,只需把规则<strong>插入默认的 { } 中间</strong>即可。</li>
  2644. </ul>
  2645. <pre style="white-space: pre-wrap !important;user-select: auto !important;">
  2646. // 下面示例是把所有规则都塞进去了,但实际上大都用不上,大多数网站只需要像第一个 "aaa" 这样的规则
  2647. // "aaa" 是规则名,唯一!不能重复!否则会被 外置/内置规则 覆盖,支持中文等各种字符
  2648. // "url" 是用来控制哪些网站中页面适用该规则,省略后代表该规则应用于全站
  2649. // "scrollD" 是用来控制翻页敏感度的(越大就越早触发翻页,访问速度慢的网站需要调大,可省略(注意逗号),默认 2000)
  2650. {
  2651. "aaa": {
  2652. "host": "aaaa",
  2653. "url": "xxxx",
  2654. "pager": {
  2655. "nextL": "xxxx",
  2656. "pageE": "xxxx",
  2657. "replaceE": "xxxx",
  2658. "scrollD": 2000
  2659. }
  2660. },
  2661. "bbb": {
  2662. "host": ["bbb1.com", "bbb2.com"],
  2663. "url": "/^\\/s$/",
  2664. "style": ".aaaa {display: none !important;}",
  2665. "blank": 3,
  2666. "hiddenPN": true,
  2667. "history": false,
  2668. "thread": true,
  2669. "iframe": true,
  2670. "pager": {
  2671. "type": 1,
  2672. "nextL": "id('page')//a[contains(text(),'下一页')] || id('page2')//a[text()='下一页']",
  2673. "pageE": "aaa",
  2674. "insertP": [".bbb",3],
  2675. "replaceE": ".page",
  2676. "scriptT": 1,
  2677. "forceHTTPS": true,
  2678. "interval": 500,
  2679. "scrollD": 2000
  2680. },
  2681. "function": {
  2682. "bF": "return fun.src_bF(pageE, [0,'img[data-src]','data-src'])",
  2683. "aF": "document.body.appendChild(document.createElement('script')).textContent = 'xxx'"
  2684. }
  2685. },
  2686. "这里也可以用中文": {
  2687. "host": "/\\.ccc\\.com/",
  2688. "url": "fun.isUrlC(); return (fun.lp() == '/' || fun.indexOF('/s') || fun.isMobile())",
  2689. "pager": {
  2690. "type": 2,
  2691. "nextL": "#autopbn",
  2692. "nextText": "下一页",
  2693. "nextTextOf": "下一页",
  2694. "isHidden": true,
  2695. "interval": 1000,
  2696. "scrollD": 2000
  2697. }
  2698. }
  2699. }
  2700. </pre></details>
  2701. <details><summary style="cursor: pointer;overflow: hidden !important;text-overflow: ellipsis !important;white-space: nowrap !important;"><kbd><strong>「 点击展开 查看所有规则 」(可按 Ctrl+F 搜索规则,脚本内置的通用规则因格式限制无法列出)</strong></kbd></summary>
  2702. <pre id="Autopage_customRules_all" style="overflow-y: scroll !important; overflow-x: hidden !important; height: 500px !important; word-break: break-word !important; white-space: pre-wrap !important;user-select: auto !important;"> </pre></details>
  2703.  
  2704. <textarea id="Autopage_customRules_textarea" style="min-width:95% !important; min-height:70% !important; display: block !important; margin: 10px 0 10px 0; white-space:nowrap !important; overflow:scroll !important; resize: auto !important; text-transform: initial !important;" placeholder="留空等于默认的 {},请把规则插入 {} 之间">${customRules}</textarea>
  2705. <button id="Autopage_customRules_save" style="margin-right: 20px !important;">保存并刷新</button><button id="Autopage_customRules_cancel">取消修改</button>
  2706. </div>`
  2707. document.documentElement.insertAdjacentHTML('beforeend', _html); // 插入元素
  2708. document.documentElement.style.overflow = document.body.style.overflow = 'hidden'; // 避免网页本身滚动
  2709. getCSS('#Autopage_customRules_all').textContent = JSON.stringify(DBSite2, null, '\t'); // 单独插入全部规则列表,避免被 insertAdjacentHTML 语义化 HTML 标签
  2710. //let b=Object.entries(DBSite2)
  2711. //for (var i = 0; i < b.length; i++) {console.log(b[i][0], b[i][1].host);}
  2712. // 点击事件
  2713. getCSS('#Autopage_customRules_save').onclick = function () {
  2714. customRules = getCSS('#Autopage_customRules_textarea').value;
  2715. //console.log(customRules)
  2716. if (!customRules) customRules = '{}'
  2717. try {
  2718. customRules = JSON.parse(customRules)
  2719. //console.log(customRules)
  2720. GM_setValue('menu_customRules', customRules)
  2721. location.reload();
  2722. } catch (e) {
  2723. console.error('自定义规则存在格式错误:\n' + e + '\n\n格式错误一般为:\n· 逗号:每组 {} 中的最后一个值末尾不能加逗号\n\n· 转义:如果正则表达式中含有转义符 \\ 那就要对其再次转义为 \\\\\n\n· 双引号:规则中冒号左右的内容都需要加上双引号,如果内容中含有双引号则需要对双引号转义(即 \\" 这样),或改为单引号')
  2724. window.alert('自定义规则存在格式错误:\n' + e + '\n\n格式错误一般为:\n· 逗号:每组 {} 中的最后一个值末尾不能加逗号\n\n· 转义:如果正则表达式中含有转义符 \\ 那就要对其再次转义为 \\\\\n\n· 双引号:规则中冒号左右的内容都需要加上双引号,如果内容中含有双引号则需要对双引号转义(即 \\" 这样),或改为单引号');
  2725. }
  2726. }
  2727. getCSS('#Autopage_customRules_cancel').onclick = function () {document.documentElement.style.overflow = document.body.style.overflow = ''; getCSS('#Autopage_customRules').remove();}
  2728. }
  2729. // 显示页码
  2730. function pageNumber(type) {
  2731. if (curSite.SiteTypeID === 0 || curSite.hiddenPN || (curSite.pager && curSite.pager.type == 5 && self != top)) {if (getCSS('#Autopage_number')) {getCSS('#Autopage_number').style.display = 'none';}; return}
  2732. let status = getCSS('#Autopage_number');
  2733. switch (type) {
  2734. case 'add':
  2735. add(); break;
  2736. case 'del':
  2737. del(); break;
  2738. case 'set':
  2739. set(); break;
  2740. }
  2741.  
  2742. function add(){
  2743. if (status) {
  2744. if (status.style.display === 'none') {status.style.display = 'flex';}
  2745. return
  2746. }
  2747. // 插入网页
  2748. let _style = `<style>#Autopage_number {top: calc(75vh) !important;left: 0 !important;width: 32px;height: 32px;padding: 6px !important;display: flex;position: fixed !important;opacity: 0.3;transition: .2s;z-index: 9999 !important;cursor: pointer;user-select: none !important;flex-direction: column;align-items: center;justify-content: center;box-sizing: content-box;border-radius: 0 50% 50% 0;transform-origin: center !important;transform: translateX(-8px);background-color: #eee;-webkit-tap-highlight-color: transparent;box-shadow: 1px 1px 3px 0px #aaa !important;color: #000 !important;font-size: medium;} #Autopage_number:hover {opacity: 0.8;transform: translateX(0);}</style>`,
  2749. _html = `<div id="Autopage_number" title="1. 此为【当前页码】(仅指脚本翻了多少页,并非实际页码,该页码可在脚本菜单中关闭)&#10;&#10;2. 鼠标【左键】点击此处可【临时暂停翻页】(再次点击可恢复)&#10;&#10;3. 鼠标【右键】点击此处可【回到顶部】">${pageNum._now}</div>`
  2750. document.documentElement.insertAdjacentHTML('beforeend', _style + _html);
  2751. // 解决 远景论坛 会清理掉前面插入的 CSS 样式的问题
  2752. if (location.hostname === 'bbs.pcbeta.com') {setTimeout(function(){document.documentElement.insertAdjacentHTML('beforeend', _style);}, 500);}
  2753. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  2754. // 左键点击事件(临时暂停翻页)
  2755. getCSS('#Autopage_number').onclick = function(e) {
  2756. if (pausePage) {this.style = 'color: #FF5722 !important; font-style: italic !important;';} else {this.style = '';}
  2757. pausePage = !pausePage;
  2758. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  2759. e.preventDefault();
  2760. e.stopPropagation();
  2761. return false
  2762. };
  2763. // 右键点击事件(回到顶部)
  2764. getCSS('#Autopage_number').oncontextmenu = function(e) {
  2765. window.scrollTo(0,0);
  2766. e.preventDefault();
  2767. e.stopPropagation();
  2768. return false
  2769. };
  2770. status = getCSS('#Autopage_number');
  2771. set();
  2772. }
  2773. // 监听储存当前页码的对象值的变化
  2774. function set(){
  2775. Object.defineProperty(pageNum, 'now', {
  2776. set: function(value) {
  2777. this._now = value;
  2778. if (status) status.textContent = value;
  2779. }
  2780. });
  2781. }
  2782. function del(){
  2783. if (!status) return
  2784. status.style.display = 'none';
  2785. }
  2786. }
  2787. // 菜单开关
  2788. function menu_switch(menu_status, Name, Tips) {
  2789. if (menu_status === true){
  2790. GM_setValue(Name, false);
  2791. } else {
  2792. GM_setValue(Name, true);
  2793. }
  2794. if (Name === 'menu_page_number') {
  2795. if (menu_status === true){pageNumber('del');} else {pageNumber('add');}
  2796. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  2797. } else {
  2798. location.reload();}
  2799. };
  2800. // 生成 SiteTypeID
  2801. function setSiteTypeID() {
  2802. let num = 0
  2803. for (let val in DBSite) {
  2804. DBSite[val].SiteTypeID = num = num + 1;
  2805. }
  2806. }
  2807. // 遍历 loadMoreExclude 数组,判断是否包含域名
  2808. function loadMoreExclude(l) {
  2809. for (let i=0; i<l.length; i++) {
  2810. if (location.hostname.indexOf(l[i]) != -1) return false
  2811. }
  2812. return true
  2813. }
  2814. // 获取 Cookie
  2815. function getCookie(name) {
  2816. if (!name) return ''
  2817. let arr = document.cookie.split(';');
  2818. name += '='
  2819. for (let i=0; i<arr.length; i++) {
  2820. let now = arr[i].trim();
  2821. if (now.indexOf(name) == 0) return now.substring(name.length, now.length);
  2822. }
  2823. return '';
  2824. }
  2825. // 插入位置
  2826. function getAddTo(num) {
  2827. switch (num) {
  2828. case 1:
  2829. return 'beforebegin'; break;
  2830. case 2:
  2831. return 'afterbegin'; break;
  2832. case 3:
  2833. case 6:
  2834. return 'beforeend'; break;
  2835. case 4:
  2836. case 5:
  2837. return 'afterend'; break;
  2838. }
  2839. }
  2840. // 插入位置 5 时,排除 <script> <style> <link> 标签
  2841. function toE5pop(a) {
  2842. if (a.length === 0) return
  2843. let b = a.pop();
  2844. if (b.tagName === 'SCRIPT' || b.tagName === 'STYLE' || b.tagName === 'LINK') {
  2845. return toE5pop(a);
  2846. }
  2847. return b
  2848. }
  2849. // 滚动条事件
  2850. function windowScroll(fn1) {
  2851. var beforeScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  2852. fn = fn1 || function () {};
  2853. setTimeout(function () { // 延时 1 秒执行,避免刚载入到页面就触发翻页事件
  2854.  
  2855. // 避免网页内容太少,高度撑不起来,不显示滚动条而无法触发翻页事件
  2856. let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
  2857. scrollHeight = window.innerHeight || document.documentElement.clientHeight
  2858. if (scrollTop === 0 && document.documentElement.scrollHeight === scrollHeight) {
  2859. insStyle(`html, body {min-height: ${document.documentElement.scrollHeight+10}px;}`)
  2860. }
  2861.  
  2862. window.addEventListener('scroll', function (e) {
  2863. var afterScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  2864. delta = afterScrollTop - beforeScrollTop;
  2865. if (delta == 0) return false;
  2866. fn(delta > 0 ? 'down' : 'up', e);
  2867. beforeScrollTop = afterScrollTop;
  2868. }, false);
  2869. }, 1000)
  2870. }
  2871. // 自定义 urlchange 事件(用来监听 URL 变化)
  2872. function addUrlChangeEvent() {
  2873. history.pushState = ( f => function pushState(){
  2874. var ret = f.apply(this, arguments);
  2875. window.dispatchEvent(new Event('pushstate'));
  2876. window.dispatchEvent(new Event('urlchange'));
  2877. return ret;
  2878. })(history.pushState);
  2879.  
  2880. history.replaceState = ( f => function replaceState(){
  2881. var ret = f.apply(this, arguments);
  2882. window.dispatchEvent(new Event('replacestate'));
  2883. window.dispatchEvent(new Event('urlchange'));
  2884. return ret;
  2885. })(history.replaceState);
  2886.  
  2887. window.addEventListener('popstate',()=>{
  2888. window.dispatchEvent(new Event('urlchange'))
  2889. });
  2890. }
  2891. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址