自动无缝翻页

⭐无缝衔接下一页内容到网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、微博、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-04-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 自动无缝翻页
  3. // @name:zh-CN 自动无缝翻页
  4. // @name:zh-TW 自動無縫翻頁
  5. // @name:en AutoPager
  6. // @version 5.5.8
  7. // @author X.I.U
  8. // @description ⭐无缝衔接下一页内容到网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、微博、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 raw.iqiq.io
  15. // @connect hk1.monika.love
  16. // @connect raw.fastgit.org
  17. // @connect cdn.staticaly.com
  18. // @connect ghproxy.fsofso.com
  19. // @connect raw-gh.gcdn.mirr.one
  20. // @connect cdn.jsdelivr.net
  21. // @connect gcore.jsdelivr.net
  22. // @connect fastly.jsdelivr.net
  23. // @connect www.xuexiniu.com
  24. // @connect bbs.xuexiniu.com
  25. // @connect weili.ooopic.com
  26. // @connect www.ykmh.com
  27. // @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
  28. // @grant GM_xmlhttpRequest
  29. // @grant GM_registerMenuCommand
  30. // @grant GM_unregisterMenuCommand
  31. // @grant GM_openInTab
  32. // @grant GM_getValue
  33. // @grant GM_setValue
  34. // @grant GM_notification
  35. // @grant window.onurlchange
  36. // @grant unsafeWindow
  37. // @license GPL-3.0 License
  38. // @run-at document-end
  39. // @namespace https://github.com/XIU2/UserScript
  40. // @supportURL https://github.com/XIU2/UserScript
  41. // @homepageURL https://github.com/XIU2/UserScript
  42. // @exclude https://*.taobao.com/*
  43. // @exclude https://*.tmall.com/*
  44. // @exclude https://*.1688.com/*
  45. // @exclude https://*.jd.com/*
  46. // @exclude https://*.vip.com/*
  47. // @exclude https://*.suning.com/*
  48. // @exclude https://*.aliexpress.com/*
  49. // @exclude https://*.amazon.com/*
  50. // @exclude https://*.amazon.cn/*
  51. // @exclude https://*.ebay.com/*
  52. // @exclude https://*.paypal.com/*
  53. // @exclude https://*.iqiyi.com/*
  54. // @exclude https://*.youku.com/*
  55. // @exclude https://m.v.qq.com/*
  56. // @exclude https://v.qq.com/*
  57. // @exclude https://*.acfun.cn/*
  58. // @exclude https://t.bilibili.com/*
  59. // @exclude https://www.bilibili.com/*
  60. // @exclude https://live.bilibili.com/*
  61. // @exclude https://space.bilibili.com/*
  62. // @exclude https://manga.bilibili.com/*
  63. // @exclude https://member.bilibili.com/*
  64. // @exclude https://message.bilibili.com/*
  65. // @exclude https://*.youtube.com/*
  66. // @exclude https://*.youtube-nocookie.com/*
  67. // @exclude https://*.cnki.net/*
  68. // @exclude https://mail.qq.com/*
  69. // @exclude https://weread.qq.com/*
  70. // @exclude https://*.weread.qq.com/*
  71. // @exclude https://bz.zzzmh.cn/*
  72. // @exclude https://wallhaven.cc/*
  73. // @exclude https://chrome.zzzmh.cn/*
  74. // @exclude https://*.guazi.com/*
  75. // @exclude https://*.liepin.com/*
  76. // @exclude https://*.58.com/*
  77. // ==/UserScript==
  78.  
  79. (function() {
  80. 'use strict';
  81. var menuAll = [
  82. ['menu_disable', '✅ 已启用 (点击对当前网站禁用)', '❌ 已禁用 (点击对当前网站启用)', []],
  83. ['menu_thread', '帖子内自动翻页 (社区类网站)', '帖子内自动翻页 (社区类网站)', true],
  84. ['menu_page_number', '显示当前页码及点击暂停翻页', '显示当前页码及点击暂停翻页', true],
  85. ['menu_pause_page', '左键双击网页空白处暂停翻页', '左键双击网页空白处暂停翻页', false],
  86. ['menu_history', '添加历史记录+修改地址/标题', '添加历史记录+修改地址/标题', true],
  87. ['menu_rules', '更新外置翻页规则 (每天自动)', '更新外置翻页规则 (每天自动)', {}],
  88. ['menu_customRules', '自定义翻页规则', '自定义翻页规则', {}]
  89. ], menuId = [], webType = 0, curSite = {SiteTypeID: 0}, DBSite, SiteType, pausePage = true, pageNum = {now: 1, _now: 1}, urlC = false, nowLocation = '', lp = location.pathname;
  90. 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, getNextEPN: getNextEPN, getNextUPN: getNextUPN, getNextUP: getNextUP, getNextF: getNextF, getCookie: getCookie, insStyle: insStyle, insScript: insScript, src_bF: src_bF, xs_bF: xs_bF}
  91.  
  92. for (let i=0;i<menuAll.length;i++){ // 如果读取到的值为 null 就写入默认值
  93. if (GM_getValue(menuAll[i][0]) == null){GM_setValue(menuAll[i][0], menuAll[i][3])};
  94. }
  95.  
  96. getRulesUrl();
  97. registerMenuCommand();
  98. if (menuId.length < 4) {return}
  99. // 注册(不可用)脚本菜单
  100. function registerMenuCommand() {
  101. if (menuId.length != []){
  102. for (let i=0;i<menuId.length;i++){
  103. GM_unregisterMenuCommand(menuId[i]);
  104. }
  105. }
  106. for (let i=0;i<menuAll.length;i++) { // 循环注册(不可用)脚本菜单
  107. menuAll[i][3] = GM_getValue(menuAll[i][0]);
  108.  
  109. if (menuAll[i][0] === 'menu_disable') { // 启用/禁用
  110.  
  111. if (menu_disable('check')) { // 当前网站在禁用列表中
  112. menuId[i] = GM_registerMenuCommand(`${menuAll[i][2]}`, function(){menu_disable('del')});
  113. return
  114. } else { // 不在禁用列表中
  115. webType = doesItSupport(); // 判断网站类型(即是否支持),顺便直接赋值
  116. if (webType === 0) {
  117. 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});});
  118. menuId[1] = GM_registerMenuCommand('🔄 更新外置翻页规则 (每天自动)', function(){getRulesUrl(true)});
  119. menuId[2] = GM_registerMenuCommand('#️⃣ 自定义翻页规则', function(){customRules()});
  120. console.info('[自动无缝翻页] - 暂不支持当前网页 [ ' + location.href + ' ],欢迎申请支持: https://github.com/XIU2/UserScript / https://gf.qytechs.cn/zh-CN/scripts/96880/feedback');
  121. return
  122. } else if (webType === -1) {
  123. return
  124. }
  125. menuId[i] = GM_registerMenuCommand(`${menuAll[i][1]}`, function(){menu_disable('add')});
  126. }
  127.  
  128. } else if (menuAll[i][0] === 'menu_rules') {
  129. menuId[i] = GM_registerMenuCommand(`🔄 ${menuAll[i][1]}`, function(){getRulesUrl(true)});
  130.  
  131. } else if (menuAll[i][0] === 'menu_customRules') {
  132. menuId[i] = GM_registerMenuCommand(`#️⃣ ${menuAll[i][1]}`, function(){customRules()});
  133.  
  134. } else {
  135. menuId[i] = GM_registerMenuCommand(`${menuAll[i][3]?'✅':'❌'} ${menuAll[i][1]}`, function(){menu_switch(menuAll[i][3], menuAll[i][0], menuAll[i][2])});
  136. }
  137. }
  138. 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});});
  139. }
  140.  
  141.  
  142. // --------------------------------------------------------
  143.  
  144.  
  145. // 判断是支持
  146. function doesItSupport() {
  147. setDBSite(); // 配置 DBSite 变量对象
  148.  
  149. // 遍历判断是否是某个已支持的网站,顺便直接赋值
  150. let support = false;
  151. end:
  152. for (let now in DBSite) { // 遍历 对象
  153. if (!DBSite[now].host) continue; // 如果不存在则继续下一个循环
  154. //console.log(DBSite[now].host)
  155. // 如果是 数组
  156. if (Array.isArray(DBSite[now].host)) {
  157.  
  158. for (let i of DBSite[now].host) { // 遍历 数组
  159. // 针对自定义翻页规则中的正则
  160. if (typeof i === 'string' && i.slice(0,1) === '/') i = new RegExp(i.slice(1,i.length-1))
  161. if ((i instanceof RegExp && i.test(location.hostname)) || (typeof i === 'string' && i === location.hostname)) {
  162.  
  163. if (self != top) {if (!DBSite[now].iframe) break end;} // 如果当前位于 iframe 框架下,就需要判断是否需要继续执行
  164. if (DBSite[now].url) {
  165. if (typeof DBSite[now].url == 'function') {
  166. DBSite[now].url();
  167. } else { // 自定义翻页规则时,因为同域名不同页面 url 分开写,所以如果没找到就需要跳出当前数组循环,继续规则循环
  168. try {
  169. if (DBSite[now].url.slice(0,1) === '/') { // 如果是正则,则对 URL 路径进行匹配
  170. 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;}
  171. } else { // 如果是函数,那就执行代码
  172. if (new Function('fun', DBSite[now].url)(window.autoPage) === true) {curSite = DBSite[now];} else {if (urlC === true) {support = true;}; break;}
  173. }
  174. } catch (e) {
  175. console.error('[自动无缝翻页] - 当前网页规则 "url" 有误,请检查!', e);
  176. }
  177. }
  178. } else {
  179. curSite = DBSite[now];
  180. }
  181. support = true; break end; // 如果找到了就退出所有循环
  182. }
  183. }
  184.  
  185. // 如果是 正则/字符串
  186. } else {
  187. // 针对自定义翻页规则中的正则
  188. 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))
  189. if ((DBSite[now].host instanceof RegExp && DBSite[now].host.test(location.hostname)) || (typeof DBSite[now].host === 'string' && DBSite[now].host === location.hostname)) {
  190.  
  191. if (self != top) {if (!DBSite[now].iframe) break;} // 如果当前位于 iframe 框架下,就需要判断是否需要继续执行
  192. if (DBSite[now].url) {
  193. if (typeof DBSite[now].url == 'function') {
  194. DBSite[now].url();
  195. } else { // 自定义翻页规则时,因为同域名不同页面 url 分开写,所以如果没找到就需要继续规则循环
  196. try {
  197. if (DBSite[now].url.slice(0,1) === '/') { // 如果是正则,则对 URL 路径进行匹配
  198. 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;}
  199. } else { // 如果是函数,那就执行代码
  200.  
  201. if (new Function('fun', DBSite[now].url)(window.autoPage) === true) {curSite = DBSite[now];} else {if (urlC === true) {support = true;}; continue;}
  202.  
  203. }
  204. } catch (e) {
  205. console.error('[自动无缝翻页] - 当前网页规则 "url" 有误,请检查!', e);
  206. }
  207. }
  208. } else {
  209. curSite = DBSite[now];
  210. }
  211. support = true; break; // 如果找到了就退出循环
  212. }
  213. }
  214. }
  215.  
  216. if (support) {
  217. console.info('[自动无缝翻页] - 独立规则 网站'); return 1;
  218. } else if (self != top) {
  219. return -1;
  220. } 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!")]')) {
  221. console.info(`[自动无缝翻页] - <Discuz!> 论坛`); return 2;
  222.  
  223. } else if (typeof flarum != 'undefined' || getCSS('#flarum-loading')) {
  224. console.info(`[自动无缝翻页] - <Flarum> 论坛`); return 3;
  225.  
  226. } else if (typeof phpbb != 'undefined' || getCSS('body#phpbb')) {
  227. console.info(`[自动无缝翻页] - <phpBB> 论坛`); return 4;
  228.  
  229. } else if (typeof xn != 'undefined' && getXpath('//footer//a[contains(string(), "Xiuno")] | //link[contains(@href, "xiuno")] | //script[contains(@src, "xiuno")]')) {
  230. console.info(`[自动无缝翻页] - <Xiuno> 论坛`); return 5;
  231.  
  232. } else if (typeof XF != 'undefined') {
  233. console.info(`[自动无缝翻页] - <XenForo> 论坛`); return 6;
  234.  
  235. } else if (getCSS('head meta[name="generator" i][content="nexusphp" i]') || getXpath('id("footer")[contains(string(), "NexusPHP")]')) {
  236. console.info(`[自动无缝翻页] - <NexusPHP> 论坛`); return 7;
  237.  
  238. } else if (getAllCSS('.load-more, .loadmore, #load-more, #loadmore, .show_more').length === 1) {
  239. console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 1`); return 8;
  240.  
  241. } else if (getAllXpath('//*[@onclick][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]').length === 1) {
  242. console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 2`); return 9;
  243.  
  244. } else if (getCSS('link[href*="/wp-content/" i], script[src*="/wp-content/" i]')) {
  245. if (getAllCSS('article[class], div[id^="post-"], ul[class*="post"] > li.item').length > 2 && getCSS('#nav-below, nav.navigation, nav.paging-navigation, .pagination, .wp-pagenavi, .pagenavi')) {
  246. if (getCSS('a.next, a.next-page')) {
  247. console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (a.next)`); return 100;
  248. } else if (getCSS('a[rel="next" i], a[aria-label="Next Page" i], a[aria-label="下一页"]')) {
  249. console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (a[rel="next"])`); return 101;
  250. } else if (getCSS('li.next-page > a, li.next > a')) {
  251. console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (li.next-page > a)`); return 102;
  252. } else if (getCSS('.nav-previous a, a.nav-previous')) {
  253. console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (旧文章)`); return 103;
  254. } else if (getXpath('//a[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, .wp-pagenavi, .pagenavi'))) {
  255. console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (下一页)`); return 104;
  256. }
  257. }
  258. } else if (getCSS('meta[name="generator" i][content*="Typecho" i]')) {
  259. if (getCSS('li.next > a') && getCSS('.blog-post, .post-list') && getCSS('.page-navigator')) {
  260. console.info(`[自动无缝翻页] - 部分使用 Typecho 的网站 (handsome)`); return 150;
  261. }
  262. } else if (getCSS('.stui-page, .stui-page__item') && getCSS('li.active.hidden-xs+li.hidden-xs>a') && getCSS('.stui-vodlist')) {
  263. console.info(`[自动无缝翻页] - 部分影视网站`); return 300;
  264.  
  265. } else if (getCSS('.content > #content') && getCSS('.page_chapter') && getXpath('//div[@class="page_chapter"]//a[text()="下一章"]')) {
  266. console.info(`[自动无缝翻页] - <笔趣阁 1> 模板的小说网站`); return 200;
  267. } else if (getCSS('#txt, .txt') && getCSS('#pb_next, .url_next') && getCSS('.chapter-control, .chapter-page-btn')) {
  268. console.info(`[自动无缝翻页] - <笔趣阁 2> 模板的小说网站`); return 201;
  269. } 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.indexOf('笔趣阁') > -1 || document.title.indexOf('小说') > -1) && (getCSS('[id="content" i], [class~="content" i], [id="chaptercontent" i], [class~="chaptercontent" i], [id="booktext" i], [id="txtcontent" i]') && getXpath('//a[contains(text(), "下一章") or contains(text(), "下一页")]'))) {
  270. console.info(`[自动无缝翻页] - <笔趣阁 3> 模板的小说网站`); return 202;
  271. }
  272. return 0;
  273. }
  274. // 判断网站类型
  275. function webTypeIf() {
  276. if (webType != 1) {
  277. switch (webType) {
  278. case 2: // < 所有 Discuz!论坛 >
  279. discuz_(); break;
  280. case 3: // < 所有 Flarum 论坛 >
  281. DBSite.flarum.url(); break;
  282. case 4: // < 所有 phpBB 论坛 >
  283. DBSite.phpbb.url(); break;
  284. case 5: // < 所有 Xiuno 论坛 >
  285. DBSite.xiuno.url(); break;
  286. case 6: // < 所有 XenForo 论坛 >
  287. DBSite.xenforo.url(); break;
  288. case 7: // < 所有 NexusPHP 论坛 >
  289. DBSite.nexusphp.url(); break;
  290. case 8: // < 部分自带 自动无缝翻页 的网站 1 >
  291. DBSite.loadmore.url('.load-more, .loadmore, #load-more, #loadmore, .show_more'); break;
  292. case 9: // < 部分自带 自动无缝翻页 的网站 2 >
  293. DBSite.loadmore.url('//*[@onclick][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]'); break;
  294. case 100: // < 部分使用 WordPress 的网站 (a.next) >
  295. DBSite.wp_article.url('a.next, a.next-page'); break;
  296. case 101: // < 部分使用 WordPress 的网站 (a[rel="next"]) >
  297. DBSite.wp_article.url('a[rel="next" i], a[aria-label="Next Page" i], a[aria-label="下一页"]'); break;
  298. case 102: // < 部分使用 WordPress 的网站 (li.next-page > a) >
  299. DBSite.wp_article.url('li.next-page > a, li.next > a'); break;
  300. case 103: // < 部分使用 WordPress 的网站 (旧文章) >
  301. DBSite.wp_article.url('.nav-previous a, a.nav-previous'); break;
  302. case 104: // < 部分使用 WordPress 的网站 (下一页) >
  303. DBSite.wp_article.url('//*[self::ul or self::nav or self::div][@id="nav-below" or contains(@class, "navigation") or contains(@class, "pagination") or contains(@class, "pagenavi")]//a[contains(text(), "下一页") or contains(text(), ">") or contains(text(), "next") or contains(text(), "Next") or contains(text(), "NEXT")]'); break;
  304. case 150: // < 部分使用 Typecho 的网站 (handsome) >
  305. curSite = DBSite.typecho_handsome; break;
  306. case 200: // < 所有使用 笔趣阁 1 模板的小说网站 >
  307. DBSite.biquge1.url(); break;
  308. case 201: // < 所有使用 笔趣阁 2 模板的小说网站 >
  309. DBSite.biquge2.url(); break;
  310. case 202: // < 所有使用 笔趣阁 3 模板的小说网站 >
  311. curSite = DBSite.biquge3; break;
  312. case 300: // < 部分影视网站 >
  313. curSite = DBSite.yingshi; break;
  314. }
  315. }
  316. }
  317. // 网站规则
  318. function setDBSite() {
  319. /*
  320. url: 匹配到该域名后要执行的函数/正则(一般用于根据 URL 分配相应翻页规则)
  321. urlC: 对于使用 pjax 技术的网站,需要监听 URL 变化来重新判断翻页规则(需要放在 url: 中,自定义规则的话需要使用 fun.isUrlC())
  322.  
  323. noReferer: 获取下一页内容时,不携带 Referer(部分网站携带与不携带可能不一样)
  324. hiddenPN: 不显示脚本左下角的页码
  325. history: 添加历史记录 并 修改当前 URL(默认开启,对于不支持的网站要设置为 false)
  326. thread: 对于社区类网站,要在 帖子内 的规则中加入这个,用于脚本的 [帖子内自动翻页] 功能(即用户可以选择开启/关闭所有社区类网站帖子内的自动翻页)
  327. style: 要插入网页的 CSS Style 样式
  328. retry: 允许获取失败后重试
  329. blank: 强制新标签页打开链接(1 = <base>,2 = 对 body 点击事件委托,3 = 仅对 pageE 的父元素点击事件委托)
  330.  
  331. pager: {
  332. type: 翻页模式
  333. 1 = 由脚本实现自动无缝翻页,可省略(适用于:静态加载内容网站,常规模式)
  334.  
  335. 2 = 只需要点击下一页按钮(适用于:网站自带了 自动无缝翻页 功能)
  336. nextText: 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页,下同)
  337. nextTextOf: 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页
  338. nextHTML: 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页
  339. interval: 点击间隔时间,对于没有按钮文字变化的按钮,可以手动指定间隔时间(单位 ms,默认 500,当指定上面三个时,会忽略 interval)
  340. isHidden: 只有下一页按钮可见时(没有被隐藏),才会点击
  341.  
  342. 3 = 依靠 [基准元素] 与 [浏览器可视区域底部] 之间的距离缩小来触发翻页(适用于:主体元素下方内容太多 且 高度不固定时)
  343. scrollE: 作为基准线的元素(一般为底部页码元素),和 replaceE 一样的话可以省略
  344. scrollD: 基准元素 - 可视区域底部
  345.  
  346. 4 = 动态加载类网站(适用于:简单的动态加载内容网站)
  347. insertE: 用来插入元素的函数
  348.  
  349. 5 = 插入 iframe 方式来加载下一页,无限套娃(适用于:部分动态加载内容的网站,需要允许 iframe 且支持通过 GET/POST 直接打开下一页)
  350. style: 加载 iframe 前要插入的 CSS Style 样式(比如为了悬浮的样式与下一页的重叠,隐藏网页底部间距提高阅读连续性)
  351. iframe: 这个必须加到 pager{} 外面(这样才会在该域名的 iframe 框架下运行脚本)
  352.  
  353. 6 = 通过 iframe 获取下一页动态加载内容插入本页,只有一个娃(适用于:部分动态加载内容的网站,与上面不同的是,该模式适合简单的网页,没有复杂事件什么的)
  354. loadTime: 预留的网页加载时间,确保网页内容加载完成
  355.  
  356. nextL: 下一页链接所在元素
  357. pageE: 要从下一页获取的元素
  358. insertP: 下一页元素插入本页的位置(数组第一个是基准元素,第二个是基准元素的前后具体位置)
  359. 1 = 插入基准元素自身的前面
  360. 2 = 插入基准元素内,第一个子元素前面
  361. 3 = 插入基准元素内,最后一个子元素后面
  362. 4 = 插入基准元素自身的后面
  363. 5 = 插入 pageE 列表最后一个元素的后面(该 insertP 可以直接省略不写,等同于 ['pageE', 5] )
  364. 6 = 插入该元素自身内部末尾(针对小说网站等文本类的),附带参数 insertP6Br: true, 用来中间插入换行
  365. // 小技巧:当基准元素是下一页主体元素的父元素时(或者说要将下一页元素插入到本页同元素最后一个后面时)是可以省略不写 insertP
  366. 例如:当 pageE: 'ul>li' 且 insertP: ['ul', 3] 时,实际等同于 ['ul>li', 5]
  367. 当 pageE: '.item' 且 insertP: ['.item', 4] 时,实际等同于 ['.item', 5]
  368. 当 pageE: '.item' 且 insertP: ['.page', 1] 时,实际等同于 ['.item', 5]
  369. 注意:如 pageE 中选择了多类元素,则不能省略 insertP(比如包含 `,` 与 `|` 符号),除非另外的选择器是 <script> <style> <link> 标签
  370.  
  371. replaceE: 要替换为下一页内容的元素(比如页码)
  372. scrollD: 翻页动作触发点([滚动条] 与 [网页底部] 之间的距离),数值越大,越早开始翻页,一般是访问网页速度越慢,该值就需要越大,省略后默认 1500
  373.  
  374. scriptT: 单独插入 <script> 标签
  375. 0 = 下一页的所有 <script> 标签
  376. 1 = 下一页的所有 <script> 标签(不包括 src 链接)
  377. 2 = 下一页主体元素 (pageE) 的同级 <script> 标签
  378. 3 = 下一页主体元素 (pageE) 的子元素 <script> 标签
  379.  
  380. interval: 翻页后间隔时间(单位 ms)
  381. forceHTTPS: 下一页链接强制 HTTPS
  382. },
  383. function: {
  384. bF = 插入前执行函数
  385. bFp = 参数
  386. aF = 插入后执行函数
  387. aFp = 参数
  388. }
  389. */ //<<< 规则简单说明 >>>
  390. DBSite = {
  391. loadmore: {
  392. url: function(nextL) {curSite = DBSite.loadmore; curSite.pager.nextL = nextL;},
  393. pager: {
  394. type: 2,
  395. isHidden: true,
  396. interval: 1000,
  397. scrollD: 2000
  398. }
  399. }, // 部分自带 自动无缝翻页 的网站
  400. wp_article: {
  401. url: function(nextL) {if (!indexOF('/post/') && !getCSS('#comments, .comments-area, #disqus_thread')) {curSite = DBSite.wp_article; curSite.pager.nextL = nextL; if (getCSS('img[data-src]')) {curSite.function = {bF: "return fun.src_bF(pageE, [0, 'img[data-src]', 'data-src'])"};} else if (getCSS('img[data-original]')) {curSite.function = {bF: "return fun.src_bF(pageE, [0, 'img[data-original]', 'data-original'])"};}}},
  402. blank: 1,
  403. pager: {
  404. pageE: 'article[class], div[id^="post-"], ul[class*="post"] > li.item',
  405. replaceE: '#nav-below, nav.navigation, nav.paging-navigation, .pagination, .wp-pagenavi, .pagenavi',
  406. scrollD: 2000
  407. }
  408. }, // 部分使用 WordPress 的网站
  409. typecho_handsome: {
  410. blank: 1,
  411. pager: {
  412. nextL: 'li.next > a',
  413. pageE: '.blog-post, .post-list',
  414. replaceE: '.page-navigator',
  415. scrollD: 2000
  416. }
  417. }, // 部分使用 Typecho 的网站 (handsome)
  418. biquge1: {
  419. url: ()=> {curSite = DBSite.biquge1;xs_bF(getAllCSS('.content > #content'),[/<br>.{0,10}秒记住.+$/, '']);},
  420. style: 'img, .posterror, a[href*="posterror()"], [style*="url("], #content > *:not(br) {display: none !important;}',
  421. history: true,
  422. pager: {
  423. nextL: '//div[@class="page_chapter"]//a[text()="下一章"]',
  424. pageE: '.content > #content',
  425. insertP: ['.content > #content', 6],
  426. replaceE: '.page_chapter'
  427. },
  428. function: {
  429. bF: xs_bF,
  430. bFp: [/<br>.{0,10}秒记住.+$/, '']
  431. }
  432. }, // 笔趣阁 模板的小说网站
  433. biquge2: {
  434. url: ()=> {if (isMobile() || getCSS('.chapter-page-btn') != null) {curSite = DBSite.biquge2_m;} else {curSite = DBSite.biquge2;}},
  435. style: 'img, .posterror, a[href*="posterror()"], [style*="url("], #txt > *:not(br) {display: none !important;}',
  436. history: true,
  437. pager: {
  438. type: 6,
  439. nextL: '#pb_next, .url_next',
  440. pageE: '#txt, .txt',
  441. insertP: ['#txt, .txt', 6],
  442. replaceE: '.chapter-control, .chapter-page-btn',
  443. loadTime: 1500,
  444. scrollD: 3500
  445. }
  446. }, // 笔趣阁 2 模板的小说网站
  447. biquge2_m: {
  448. style: 'img, .posterror, a[href*="posterror()"], [style*="url("], #txt > *:not(br) {display: none !important;}',
  449. history: true,
  450. pager: {
  451. nextL: '#pb_next, .url_next',
  452. pageE: '#txt, .txt',
  453. insertP: ['#txt, .txt', 6],
  454. replaceE: '.chapter-control, .chapter-page-btn',
  455. scrollD: 2000
  456. }
  457. }, // 笔趣阁 2 模板的小说网站
  458. biquge3: {
  459. style: 'img, .posterror, a[href*="posterror()"], [style*="url("], script+div[style="padding:15px;"] {display: none !important;}',
  460. history: true,
  461. pager: {
  462. nextL: '//a[contains(text(), "下一章") or contains(text(), "下一页")]',
  463. pageE: '[id="content" i], [class~="content" i], [id="chaptercontent" i], [class~="chaptercontent" i], [id="booktext" i], [id="txtcontent" i]',
  464. insertP: ['[id="content" i], [class~="content" i], [id="chaptercontent" i], [class~="chaptercontent" i], [id="booktext" i], [id="txtcontent" i]', 6],
  465. insertP6Br: true,
  466. replaceE: '//a[contains(text(), "下一章") or contains(text(), "下一页")]/parent::*'
  467. },
  468. function: {
  469. bF: xs_bF,
  470. bFp: [/<br>.{0,10}秒记住.+$/, '']
  471. }
  472. }, // 笔趣阁 模板的小说网站
  473. yingshi: {
  474. style: 'div.stui-page__all {display: none !important;}',
  475. blank: 3,
  476. pager: {
  477. nextL: 'li.active.hidden-xs+li.hidden-xs>a',
  478. pageE: '.stui-vodlist',
  479. replaceE: '.stui-page, .stui-page__item',
  480. scrollD: 1000
  481. },
  482. function: {
  483. bF: src_bF,
  484. bFp: [1, '[data-original]', 'data-original']
  485. }
  486. },
  487. discuz_forum: {
  488. pager: {
  489. type: 2,
  490. nextL: '#autopbn',
  491. nextTextOf: '下一'
  492. }
  493. }, // Discuz! 论坛 - 帖子列表(自带无缝加载下一页按钮的)
  494. discuz_guide: {
  495. pager: {
  496. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  497. pageE: 'id("threadlist")//table[./tbody[contains(@id, "normalthread_")]]/tbody[not(@id="separatorline")]',
  498. replaceE: '.pg, .pages',
  499. forceHTTPS: true
  500. }
  501. }, // Discuz! 论坛 - 导读页 及 帖子列表(不带无缝加载下一页按钮的)
  502. discuz_waterfall: {
  503. pager: {
  504. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  505. pageE: '#waterfall > li',
  506. replaceE: '.pg, .pages',
  507. forceHTTPS: true
  508. }
  509. }, // Discuz! 论坛 - 图片模式的帖子列表(不带无缝加载下一页按钮的)
  510. discuz_thread: {
  511. thread: true,
  512. style: '.pgbtn {display: none;}',
  513. pager: {
  514. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  515. pageE: '#postlist > div[id^="post_"]',
  516. 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"))]]',
  517. forceHTTPS: true
  518. },
  519. function: {
  520. bF: src_bF,
  521. bFp: [0, 'img[file]', 'file']
  522. }
  523. }, // Discuz! 论坛 - 帖子内
  524. discuz_search: {
  525. pager: {
  526. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  527. pageE: '#threadlist > ul',
  528. replaceE: '.pg, .pages',
  529. forceHTTPS: true
  530. }
  531. }, // Discuz! 论坛 - 搜索页
  532. discuz_youspace: {
  533. pager: {
  534. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  535. pageE: 'form:not([action^="search.php?"]) tbody > tr:not(.th)',
  536. replaceE: '.pg, .pages',
  537. forceHTTPS: true
  538. }
  539. }, // Discuz! 论坛 - 回复页、主题页(别人的)
  540. discuz_collection: {
  541. pager: {
  542. nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
  543. pageE: '#ct .bm_c table > tbody',
  544. replaceE: '.pg, .pages',
  545. forceHTTPS: true
  546. }
  547. }, // Discuz! 论坛 - 淘帖页
  548. discuz_m: {
  549. thread: true,
  550. pager: {
  551. nextL: '//a[@class="nxt" or @class="next"] | //div[@class="page"]/a[text()="下一页" or contains(text(), ">")]',
  552. replaceE: '.pg, .page',
  553. forceHTTPS: true,
  554. scrollD: 1000
  555. }
  556. }, // Discuz! 论坛 - 触屏手机版 - 帖子内
  557. discuz_m_forum: {
  558. pager: {
  559. type: 2,
  560. nextL: 'a.loadmore',
  561. interval: 500,
  562. scrollD: 1000
  563. }
  564. }, // Discuz! 论坛 - 触屏手机版 - 帖子列表(自带无缝加载下一页按钮的)
  565. flarum: {
  566. url: ()=> {urlC = true;if (!indexOF('/d/')) {curSite = DBSite.flarum;}},
  567. pager: {
  568. type: 2,
  569. nextL: '.DiscussionList-loadMore > button',
  570. isHidden: true
  571. }
  572. }, // Flarum 论坛
  573. phpbb: {
  574. url: ()=> {if (indexOF('/viewforum.php')) {
  575. curSite = DBSite.phpbb;
  576. } else if (indexOF('/viewtopic.php')) {
  577. curSite = DBSite.phpbb_post;
  578. } else if (indexOF('/search.php')) {
  579. curSite = DBSite.phpbb_search;
  580. }},
  581. pager: {
  582. nextL: '.pagination li.next a[rel="next"], .topic-actions .pagination strong~a',
  583. pageE: '.forumbg:not(.announcement) ul.topiclist.topics > li',
  584. replaceE: '.action-bar .pagination, .topic-actions .pagination',
  585. scrollD: 2000
  586. }
  587. }, // phpBB 论坛 - 帖子列表
  588. phpbb_post: {
  589. thread: true,
  590. pager: {
  591. nextL: '.pagination li.next a[rel="next"], .topic-actions .pagination strong~a',
  592. pageE: 'div.post[id], div.post[id]+hr',
  593. replaceE: '.action-bar .pagination, .topic-actions .pagination',
  594. scrollD: 2000
  595. }
  596. }, // phpBB 论坛 - 帖子内
  597. phpbb_search: {
  598. pager: {
  599. nextL: '.pagination li.next a[rel="next"], .topic-actions .pagination strong~a',
  600. pageE: 'div.search.post',
  601. replaceE: '.action-bar .pagination, .pagination',
  602. scrollD: 2000
  603. }
  604. }, // phpBB 论坛 - 搜索页
  605. xenforo: {
  606. url: ()=> {if (indexOF(/\/(forums|f)\//)) {
  607. curSite = DBSite.xenforo;
  608. } else if (indexOF(/\/(threads|t)\//)) {
  609. curSite = DBSite.xenforo_post;
  610. } else if (indexOF('/search/')) {
  611. curSite = DBSite.xenforo_search;
  612. }},
  613. pager: {
  614. nextL: 'a.pageNav-jump--next',
  615. pageE: '.structItemContainer-group.js-threadList > div',
  616. replaceE: 'nav.pageNavWrapper',
  617. scrollD: 2500
  618. }
  619. }, // XenForo 论坛 - 帖子列表
  620. xenforo_post: {
  621. thread: true,
  622. pager: {
  623. nextL: 'a.pageNav-jump--next',
  624. pageE: '.block-body.js-replyNewMessageContainer > article',
  625. replaceE: 'nav.pageNavWrapper',
  626. scrollD: 2500
  627. }
  628. }, // XenForo 论坛 - 帖子内
  629. xenforo_search: {
  630. pager: {
  631. nextL: 'a.pageNav-jump--next',
  632. pageE: 'ol.block-body > li',
  633. replaceE: 'nav.pageNavWrapper',
  634. scrollD: 2500
  635. }
  636. }, // XenForo 论坛 - 搜索页
  637. xiuno: {
  638. url: ()=> {if (lp == '/' || indexOF(/\/(index|forum)/)) {curSite = DBSite.xiuno;} else if (indexOF('/thread')) {curSite = DBSite.xiuno_post;}},
  639. pager: {
  640. nextL: '//li[@class="page-item"]/a[text()="▶" or text()="»" or contains(text(),">") or contains(text(),"下一页")]',
  641. pageE: 'ul.threadlist > li',
  642. replaceE: 'ul.pagination'
  643. }
  644. }, // Xiuno 论坛 - 帖子列表
  645. xiuno_post: {
  646. thread: true,
  647. pager: {
  648. nextL: '//li[@class="page-item"]/a[text()="▶" or text()="»" or contains(text(),">") or contains(text(),"下一页")]',
  649. pageE: 'li.post[data-pid]:not(.newpost)',
  650. replaceE: 'ul.pagination'
  651. }
  652. }, // Xiuno 论坛 - 帖子内
  653. nexusphp: {
  654. url: ()=> {
  655. if (lp == '/torrents.php' || getCSS('table.torrents')) {
  656. curSite = DBSite.nexusphp;
  657. } else if (lp == '/subtitles.php') {
  658. curSite = DBSite.nexusphp;
  659. curSite.pager.pageE = '#outer > table.main~table > tbody > tr:not(:first-of-type)'
  660. } else if (lp == '/forums.php' && indexOF('action=viewforum', 's')) {
  661. curSite = DBSite.nexusphp;
  662. curSite.pager.pageE = '#outer > table.main+table > tbody > tr:not(:first-of-type):not(:last-of-type)'
  663. } else if (lp == '/forums.php' && indexOF('action=viewtopic', 's')) {
  664. curSite = DBSite.nexusphp;
  665. curSite.thread = true;
  666. curSite.pager.pageE = 'td.text > div, td.text > div+table.main';
  667. }},
  668. pager: {
  669. nextL: '//a[./b[contains(text(), "下一页") or contains(text(), ">>")]]',
  670. pageE: 'table.torrents > tbody > tr:not(:first-of-type)',
  671. replaceE: '//p[@align][./font[@class="gray"]]'
  672. }
  673. }, // NexusPHP 论坛
  674. baidu_tieba: {
  675. host: ['tieba.baidu.com', 'jump2.bdimg.com'],
  676. url: ()=> {if (location.hostname == 'jump2.bdimg.com') location.hostname = 'tieba.baidu.com';
  677. if (lp == '/f') {
  678. baidu_tieba_1(); // 右侧悬浮发帖按钮点击事件(解决自动翻页导致无法发帖的问题)
  679. curSite = DBSite.baidu_tieba;
  680. } else if (indexOF('/p/')) {
  681. curSite = DBSite.baidu_tieba_post;
  682. } else if (lp == '/f/search/res') {
  683. curSite = DBSite.baidu_tieba_search;
  684. }},
  685. style: 'img.j_retract {margin-top: 0 !important;margin-bottom: 0 !important;}', // 修复帖子列表中预览图片,在切换下一个/上一个图片时,多出来的图片上下边距
  686. history: false,
  687. iframe: true,
  688. pager: {
  689. type: 4,
  690. nextL: ()=> {if (getNextE('a.next.pagination-item')) getPageE_(curSite.pageUrl + '&pagelets=frs-list%2Fpagelet%2Fthread&pagelets_stamp=' + new Date().getTime());},
  691. pageE: '#thread_list > li',
  692. insertP: ['#thread_list', 3],
  693. insertE: baidu_tieba_insertE,
  694. replaceE: '#frs_list_pager',
  695. interval: 2000,
  696. scrollD: 2500
  697. },
  698. function: {
  699. bF: src_bF,
  700. bFp: [0, 'img[data-original]', 'data-original']
  701. }
  702. }, // 百度贴吧 - 帖子列表
  703. baidu_tieba_post: {
  704. blank: true,
  705. thread: true,
  706. style: '.d_sign_split, img.j_user_sign, .d_author .d_pb_icons, .save_face_bg, .save_face_bg_2, li.d_name a.icon_tbworld, .lzl_cnt a.icon_tbworld, .topic_list_box.topic-fixed {display: none !important;} a.p_author_face.j_frame_guide {background: none repeat scroll 0 0 #FFF !important;border: 1px solid #CCC !important;padding: inherit !important;} .red_text, .red-text, .vip_red, .vip-red, .vip_red:hover, .vip-red:hover, .vip_red:visited, .vip-red:visited {color: #2d64b3 !important;}', // 签名、印记、头像边框、VIP 元素
  707. pager: {
  708. type: 5,
  709. nextL: '//li[contains(@class,"pb_list_pager")]/a[text()="下一页"]',
  710. style: 'ul.tbui_aside_float_bar, .core_title_wrap_bright.tbui_follow_fixed.core_title_absolute_bright {display: none !important;}'
  711. }
  712. }, // 百度贴吧 - 帖子内
  713. baidu_tieba_search: {
  714. pager: {
  715. nextL: 'a.next',
  716. pageE: '.s_post_list > div',
  717. replaceE: '.pager',
  718. scrollD: 1000
  719. }
  720. }, // 百度贴吧 - 搜索页
  721. nexusmods: {
  722. host: 'www.nexusmods.com',
  723. url: ()=> {urlC = true; if (!(lp == '/' || indexOF(/\/mods\/\d+/))) {curSite = DBSite.nexusmods;}},
  724. blank: 1,
  725. history: false,
  726. pager: {
  727. nextL: nexusmods_nextL,
  728. pageE: 'ul.tiles > li',
  729. replaceE: '.pagination',
  730. scrollD: 4000
  731. },
  732. function: {
  733. bF: nexusmods_bF
  734. }
  735. }, // NexusMods
  736. bilibili_search: {
  737. host: 'search.bilibili.com',
  738. url: ()=> {
  739. urlC = true;
  740. if ((lp == '/all' || lp == '/video') && getCSS('ul.video-list') != null) {
  741. curSite = DBSite.bilibili_search;
  742. } else if (lp == '/article' && getCSS('#article-list') != null) {
  743. curSite = DBSite.bilibili_search_article;
  744. }
  745. },
  746. retry: 100,
  747. pager: {
  748. nextL: bilibili_search_nextL,
  749. pageE: '//ul[contains(@class, "video-list")]/li | //script[contains(text(), "window.__INITIAL_STATE__")]',
  750. insertP: ['ul.video-list', 3],
  751. replaceE: 'ul.pages',
  752. scriptT: 2,
  753. scrollD: 1000
  754. },
  755. function: {
  756. bF: bilibili_search_bF,
  757. aF: bilibili_search_aF
  758. }
  759. }, // B 站(Bilibili) - 搜索页 - 视频
  760. bilibili_search_article: {
  761. retry: 100,
  762. pager: {
  763. nextL: bilibili_search_nextL,
  764. pageE: 'li.article-item',
  765. replaceE: 'ul.pages',
  766. //scriptT: 2,
  767. scrollD: 1000
  768. }
  769. }, // B 站(Bilibili) - 搜索页 - 专栏
  770. anime1: {
  771. host: 'anime1.me',
  772. url: ()=> {if (indexOF('s=', 's')) {curSite = DBSite.wp_article;} else if (lp == '/') {curSite = DBSite.anime1;}},
  773. history: false,
  774. pager: {
  775. type: 4,
  776. nextL: ()=> { // 获取下一页内容(叠加)
  777. let next = getCSS('a.paginate_button.next');
  778. if (next && next.className.indexOf('disabled') === -1) {
  779. let oldList = getCSS('#table-list > tbody').innerHTML;
  780. if (oldList) {next.click(); pageNum.now = pageNum._now + 1; getCSS('#table-list > tbody').insertAdjacentHTML('afterbegin', oldList);}
  781. }
  782. },
  783. interval: 500,
  784. scrollD: 800
  785. }
  786. }, // Anime1
  787. manben: {
  788. host: 'www.manben.com',
  789. url: ()=> {if (indexOF(/\/m\d+/)) {
  790. if (getCookie('showtype') != '2') {
  791. document.cookie='showtype=2; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; // 写入 Cookie 开启 [垂直阅读] 模式
  792. location.reload(); // 刷新网页
  793. }
  794. curSite = DBSite.mhxqiu;
  795. }}
  796. }, // 漫本
  797. cartoonmad: {
  798. host: ['www.cartoonmad.com','www.cartoonmad.cc'],
  799. url: ()=> {if (indexOF('/comic/')) {
  800. getCSS('body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child > a').href = 'javascript:void(0);'; // 清理图片上的链接
  801. curSite = DBSite.cartoonmad;
  802. } else if (lp != '/') {
  803. curSite = DBSite.cartoonmad_list;
  804. }},
  805. style: 'body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:not(:first-child) {display: none !important;} body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child img {max-width: 100%;height: auto;display: block !important;margin: 0 auto !important;}',
  806. pager: {
  807. nextL: cartoonmad_nextL,
  808. pageE: 'body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child img',
  809. replaceE: 'body > table > tbody > tr:nth-child(2), body > table > tbody > tr:nth-child(5)',
  810. scrollD: 2000
  811. }
  812. }, // 动漫狂
  813. cartoonmad_list: {
  814. blank: 1,
  815. pager: {
  816. nextL: '//a[@class="pages"][contains(text(), "下一頁")]',
  817. pageE: 'td[background="/image/content_box4.gif"]+td > table > tbody > tr',
  818. replaceE: '//a[@class="pages"]/parent::td/parent::tr | //font[contains(text(), "目前在第")]',
  819. scrollD: 1000
  820. }
  821. }, // 动漫狂 - 分类/搜索页
  822. manhuacat: {
  823. host: ['www.manhuacat.com', 'www.maofly.com'],
  824. url: ()=> {if (indexOF(/\/manga\/\d+\/.+\.html/)) {
  825. if (getCookie('is_pull') == 'true') { // 强制关闭 [下拉] 模式
  826. document.cookie='is_pull=false; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; // 写入 Cookie 关闭 [下拉] 模式
  827. location.reload(); // 刷新网页
  828. }
  829. setTimeout(manhuacat_init, 100);
  830. curSite = DBSite.manhuacat;
  831. } else if (indexOF('/list')) {
  832. curSite = DBSite.manhuacat_list;
  833. } else if (indexOF('/search') || indexOF('/update')) {
  834. curSite = DBSite.manhuacat_search;
  835. }},
  836. 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;}', // 隐藏不需要的元素,调整图片
  837. pager: {
  838. type: 4,
  839. nextL: manhuacat_nextL,
  840. insertP: ['.img-content', 3],
  841. insertE: manhuacat_insertE,
  842. replaceE: '.comic-detail > .breadcrumb-bar, .comic-detail >h2.h4, .vg-r-data, body > script:not([src])',
  843. interval: 2000,
  844. scrollD: 3000
  845. }
  846. }, // 漫画猫
  847. manhuacat_list: {
  848. blank: 1,
  849. pager: {
  850. nextL: '//div[contains(@class, "pagination")]//a[contains(text(), "下一页") or contains(text(), "下页")]',
  851. pageE: '.comic-main-section > *',
  852. replaceE: '.pagination',
  853. scrollD: 1000
  854. },
  855. function: {
  856. bF: src_bF,
  857. bFp: [0, 'img[data-original]', 'data-original']
  858. }
  859. }, // 漫画猫 - 分类页
  860. manhuacat_search: {
  861. pager: {
  862. nextL: '//div[contains(@class, "pagination")]//a[contains(text(), "下一页") or contains(text(), "下页")]',
  863. pageE: '.comic-main-section .row > div',
  864. replaceE: '.pagination',
  865. scrollD: 1000
  866. }
  867. }, // 漫画猫 - 搜索页
  868. imanhuaw: {
  869. host: ['www.imanhuaw.net', 'www.imanhuaw.com', 'www.ccshwy.com'],
  870. url: ()=> {
  871. if (getCSS('.mh-search-result')) {
  872. curSite = DBSite.imanhuaw_list;
  873. } else if (getCSS('a#zhankai')) {
  874. getCSS('a#zhankai').click();
  875. } else if (indexOF(/\/\d{3,}\.html/)) {
  876. curSite = DBSite.imanhuaw; imanhuaw_init();
  877. }
  878. },
  879. 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;}',
  880. pager: {
  881. type: 4,
  882. nextL: imanhuaw_nextL,
  883. insertP: ['#qTcms_Pic_middle img:last-of-type', 4],
  884. insertE: imanhuaw_insertE,
  885. replaceE: '.title h2',
  886. interval: 2000,
  887. scrollD: 3000
  888. }
  889. }, // 爱漫画 + 188漫画网
  890. imanhuaw_list: {
  891. blank: 1,
  892. pager: {
  893. nextL: '//div[@class="NewPages"]//a[text()="下一页"]',
  894. pageE: 'ul.mh-search-list > li',
  895. replaceE: '.NewPages'
  896. }
  897. }, // 爱漫画 - 分类页
  898. manhuagui: {
  899. host: ['www.mhgui.com', 'tw.mhgui.com', 'www.manhuagui.com', 'tw.manhuagui.com'],
  900. url: ()=> {if (indexOF(/\/comic\/\d+\/\d+\.html/)) {
  901. if (!getXpath('//li[@class="pfunc"]/a[@class="current"][text()="双击" or text()="雙擊"]')) getXpath('//li[@class="pfunc"]/a[text()="双击" or text()="雙擊"]').click();
  902. pausePage = false;
  903. setTimeout(manhuagui_init, 100);
  904. curSite = DBSite.manhuagui;
  905. } else if (indexOF('list/') || indexOF('/s/')) {
  906. curSite = DBSite.manhuagui_list;
  907. }},
  908. style: '.sub-btn, .tc {display: none !important;} #mangaBox > img {width: auto !important;height: auto !important;display: block !important;margin: 0 auto !important;max-width: 100% !important;}',
  909. pager: {
  910. type: 4,
  911. nextL: manhuagui_nextL,
  912. pageE: 'body > script:not([src])',
  913. insertP: ['#mangaBox', 3],
  914. insertE: manhuagui_insertE,
  915. replaceE: 'title',
  916. interval: 4000,
  917. scrollD: 2500
  918. }
  919. }, // 漫画柜
  920. manhuagui_list: {
  921. blank: 1,
  922. pager: {
  923. nextL: '//div[@class="pager"]/a[text()="下一页" or text()="下一頁"]',
  924. pageE: '.book-result > ul > li, .book-list > ul > li',
  925. insertP: ['.book-result > ul, .book-list > ul', 3],
  926. replaceE: '.pager'
  927. },
  928. function: {
  929. bF: src_bF,
  930. bFp: [0, 'img[data-src]', 'data-src']
  931. }
  932. }, // 漫画台 - 分类/搜索页
  933. _36manga: {
  934. host: ['36manga.com', 'www.36manga.com', '36manhua.com', 'www.36manhua.com'],
  935. url: ()=> {if (indexOF(/\/manhua\/.+\/\d+\.html/)) {
  936. if (localStorage.getItem('chapterScroll') != '"pagination"') {
  937. localStorage.setItem('chapterScroll', '"pagination"'); location.reload()
  938. } else {
  939. pausePage = false;
  940. setTimeout(_36manga_init, 100);
  941. curSite = DBSite._36manga;
  942. }
  943. } else if (indexOF('list/') || indexOF('/search/')) {
  944. curSite = DBSite._36manga_list;
  945. }},
  946. style: '#sider-left, #sider-right, p.img_info, .tc, .chapter-view + .w996 {display: none !important;} #images > img {width: auto !important;height: auto !important;display: block !important;margin: 0 auto !important;max-width: 100% !important;}',
  947. pager: {
  948. type: 4,
  949. nextL: _36manga_nextL,
  950. pageE: '//body/script[contains(text(), "chapterImages")]',
  951. insertP: ['#images', 3],
  952. insertE: _36manga_insertE,
  953. replaceE: '.title',
  954. interval: 4000,
  955. scrollD: 2500
  956. }
  957. }, // 36漫画
  958. _36manga_list: {
  959. blank: 1,
  960. pager: {
  961. nextL: 'ul.pagination li.next a',
  962. pageE: '#contList',
  963. replaceE: 'ul.pagination'
  964. }
  965. }, // 36漫画 - 分类/搜索页
  966. manhuadb: {
  967. host: 'www.manhuadb.com',
  968. url: ()=> {if (indexOF(/\/manhua\/\d+\/.+\.html/)) {
  969. if (getCSS('img.img-fluid.show-pic')) getCSS('img.img-fluid.show-pic').style.display = 'none'; // 隐藏第一个图片(避免重复)
  970. setTimeout(manhuadb_init, 100);
  971. curSite = DBSite.manhuadb;
  972. } else if (indexOF('/list')) {
  973. curSite = DBSite.manhuacat_list;
  974. } else if (indexOF('/search') || indexOF('/update')) {
  975. curSite = DBSite.manhuacat_search;
  976. }},
  977. style: '.row.m-0.pt-3.ad_2_wrap, .row.m-0.ad_1_wrap, .pagination.justify-content-center, #left, #right {display: none !important;}',
  978. pager: {
  979. type: 4,
  980. nextL: manhuadb_nextL,
  981. pageE: 'body > script:not([type]):not([src]), .vg-r-data, ol.links-of-books.num_div',
  982. insertP: ['.pjax-container', 3],
  983. insertE: manhuadb_insertE,
  984. interval: 5000,
  985. scrollD: 3000
  986. }
  987. }, // 漫画 DB
  988. hicomic: {
  989. host: 'www.hicomic.net',
  990. url: ()=> {if (indexOF('/chapters/')) {
  991. setTimeout(hicomic_init, 100);
  992. curSite = DBSite.hicomic;
  993. }},
  994. style: '.content {height: auto !important;} .footer, .left_cursor, .right_cursor, .finish {display: none !important;} .content > img {display: block !important;margin: 0 auto !important;}',
  995. pager: {
  996. type: 4,
  997. nextL: hicomic_nextL,
  998. insertP: ['.content', 3],
  999. insertE: hicomic_insertE,
  1000. interval: 5000,
  1001. scrollD: 3000
  1002. }
  1003. }, // HiComic (嗨漫画)
  1004. dmzj: {
  1005. host: 'www.dmzj.com',
  1006. url: ()=> {if (indexOF('/view/')) {
  1007. if (getCookie('display_mode') != '1') { // 强制开启 [上下滚动阅读] 模式
  1008. document.cookie='display_mode=1; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; // 写入 Cookie 开启 [上下滚动阅读] 模式
  1009. location.reload(); // 刷新网页
  1010. }
  1011. setTimeout(function() {dmzj_init('.comic_wraCon > a > img')}, 100);
  1012. curSite = DBSite.dmzj;
  1013. } else if (indexOF('/category') || indexOF('/update')) {
  1014. curSite = DBSite.dmzj_list;
  1015. } else if (indexOF('/rank')) {
  1016. curSite = DBSite.dmzj_rank;
  1017. }},
  1018. style: 'p.mh_curr_page, .btmBtnBox, .float_code, #floatCode {display: none !important;} .comic_wraCon > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}', // 隐藏中间的页数信息
  1019. pager: {
  1020. type: 4,
  1021. nextL: 'span.next > a',
  1022. insertP: ['.comic_wraCon', 3],
  1023. insertE: dmzj_insertE,
  1024. replaceE: '.wrap_last_mid, .wrap_last_head',
  1025. interval: 2000,
  1026. scrollD: 3000
  1027. }
  1028. }, // 动漫之家 - 原创
  1029. dmzj_list: {
  1030. style: '.wrap_mhlist_l.con_left, .wrap_list {height: auto!important;}',
  1031. blank: 1,
  1032. pager: {
  1033. nextL: 'a.pg_next',
  1034. pageE: 'ul.list_con_li > li',
  1035. replaceE: '.page',
  1036. scrollD: 1000
  1037. }
  1038. }, // 动漫之家 - 原创 - 分类页
  1039. dmzj_rank: {
  1040. style: '.wrap_mhlist_l.con_left {height: auto!important;}',
  1041. pager: {
  1042. nextL: 'a.pg_next',
  1043. pageE: '.ph_r_con_li > div:not(.ad_column)',
  1044. replaceE: '.page',
  1045. scrollD: 1000
  1046. }
  1047. }, // 动漫之家 - 原创 - 排行榜
  1048. dmzj_manhua: {
  1049. host: 'manhua.dmzj.com',
  1050. url: ()=> {if (indexOF(/\/\d+\.shtml/)) {
  1051. let chapterScroll = getCSS('#qiehuan_txt') // 强制为 [上下滚动阅读] 模式
  1052. if (chapterScroll && chapterScroll.textContent === '切换到上下滚动阅读') {chapterScroll.click();}
  1053. setTimeout(function() {dmzj_init('#center_box > .inner_img img[src]')}, 100);
  1054. curSite = DBSite.dmzj_manhua;
  1055. /*} else if (indexOF('/tags/')) {
  1056. curSite = DBSite.dmzj_manhua_list;*/
  1057. } else if (indexOF('/update')) {
  1058. curSite = DBSite.dmzj_manhua_update;
  1059. }},
  1060. style: 'p.curr_page, .btmBtnBox, .float_code, #floatCode {display: none !important;} #center_box > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}', // 隐藏中间的页数信息
  1061. pager: {
  1062. type: 4,
  1063. nextL: '#next_chapter',
  1064. insertP: ['#center_box', 3],
  1065. insertE: dmzj_manhua_insertE,
  1066. replaceE: '.display_graybg',
  1067. interval: 2000,
  1068. scrollD: 3000
  1069. }
  1070. }, // 动漫之家 - 日漫
  1071. /*dmzj_manhua_list: {
  1072. pager: {
  1073. nextL: ()=> getNextUPN(/(?<=-)\d+(?=\.shtml)/, /-\d+\.shtml/, '-', '.shtml', '2', getCSS('#topage > option:last-child').value),
  1074. pageE: '#search_list_div ul'
  1075. }
  1076. },*/ // 动漫之家 - 日漫 - 分类页
  1077. dmzj_manhua_update: {
  1078. blank: 1,
  1079. pager: {
  1080. nextL: '//div[@class="pages"]/a[contains(text(), "下一页")]',
  1081. pageE: '.newpic_content > *:not(.pages)',
  1082. replaceE: '.pages',
  1083. scrollD: 1000
  1084. }
  1085. }, //动漫之家 - 日漫 - 最新更新
  1086. acgn: {
  1087. host: 'comic.acgn.cc',
  1088. url: ()=> {
  1089. if (indexOF('/view-')) {
  1090. curSite = DBSite.acgn;
  1091. acgn_aF();
  1092. } else if (indexOF('/cate-') || indexOF('/pinyin-')) {
  1093. curSite = DBSite.acgn_list;
  1094. }
  1095. },
  1096. style: '.img1 {cursor: initial !important;}',
  1097. pager: {
  1098. nextL: '#next_chapter',
  1099. pageE: '.pic[_src]',
  1100. replaceE: '[class^="display_"]',
  1101. interval: 2000,
  1102. scrollD: 2000
  1103. },
  1104. function: {
  1105. aF: acgn_aF
  1106. }
  1107. }, // 动漫戏说
  1108. acgn_list: {
  1109. blank: 1,
  1110. pager: {
  1111. nextL: 'a[rel="next"]',
  1112. pageE: 'ul#display > li',
  1113. replaceE: '#pagination',
  1114. scrollD: 1000
  1115. }
  1116. }, // 动漫戏说 - 分类页
  1117. ykmh: {
  1118. host: 'www.ykmh.com',
  1119. url: ()=> {if (indexOF(/\/\d+\.html/)) {
  1120. let chapterScroll = getCSS('#qiehuan_txt') // 强制为 [上下滚动阅读] 模式
  1121. if (localStorage.getItem('chapterScroll') != '"scroll"') {
  1122. localStorage.setItem('chapterScroll', '"scroll"'); location.reload()
  1123. } else {
  1124. setTimeout(ykmh_init, 100);
  1125. curSite = DBSite.ykmh;
  1126. }
  1127. } else if (indexOF('/list') || indexOF('/search')) {
  1128. curSite = DBSite.ykmh_list;
  1129. }},
  1130. style: 'p.img_info {display: none !important;} #images > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}',
  1131. pager: {
  1132. type: 4,
  1133. nextL: ykmh_nextL,
  1134. insertP: ['#images', 3],
  1135. insertE: ykmh_insertE,
  1136. replaceE: '.head_title, span.head_wz',
  1137. interval: 2000,
  1138. scrollD: 3000
  1139. }
  1140. }, // 优酷漫画
  1141. ykmh_list: {
  1142. blank: 1,
  1143. pager: {
  1144. nextL: 'li.next > a',
  1145. pageE: 'li.list-comic',
  1146. replaceE: 'ul.pagination',
  1147. scrollD: 1000
  1148. }
  1149. }, // 优酷漫画 - 分类页
  1150. mhxqiu: {
  1151. host: /\.mhxqiu/,
  1152. url: ()=> {if (indexOF(/\/\d+\.html/)) { // 阅读页
  1153. curSite = DBSite.mhxqiu;
  1154. } else if (indexOF(/\/\d+\/$/)) { // 目录页
  1155. setTimeout(function(){if (getCSS('#zhankai')) getCSS('#zhankai').click();}, 500)
  1156. } else if (indexOF(/\/(sort|rank)\//)) { // 分类页
  1157. curSite = DBSite.mhxqiu_list;
  1158. }},
  1159. style: '.imgFloat_1, .imgFloat_2, .main_control, span.comic-ft {display: none !important;} html, body, #mainView {height: auto !important;} body.view .main ul.comic-contain li{margin:0 auto !important;} .comic-contain .loaded{box-shadow: none !important;}',
  1160. pager: {
  1161. type: 4,
  1162. nextL: '#mainControlNext',
  1163. insertP: ['#comicContain', 3],
  1164. insertE: mhxqiu_insertE,
  1165. replaceE: '.main_control, h1.chaptername_title, span.title-comicHeading',
  1166. interval: 4000,
  1167. scrollD: 3000
  1168. }
  1169. }, // 漫画星球
  1170. mhxqiu_list: {
  1171. blank: 1,
  1172. pager: {
  1173. nextL: '//div[@class="NewPages"]//a[contains(text(), "下一页")]',
  1174. pageE: '.cy_list_mh > ul',
  1175. replaceE: '.NewPages',
  1176. scrollD: 1000
  1177. }
  1178. }, // 漫画星球 - 分类页
  1179. fffdm: {
  1180. host: 'manhua.fffdm.com',
  1181. url: ()=> {if (location.pathname.split('/').length === 4) {curSite = DBSite.fffdm;}},
  1182. style: '#footer, #header {display: none !important;} #mhimg0 img {display: block !important;margin: 0 auto !important;}',
  1183. pager: {
  1184. type: 4,
  1185. nextL: '//a[contains(text(), "下一页") or contains(text(), "下一頁") or contains(text(), "下一话") or contains(text(), "下一話")]',
  1186. insertP: ['#mhimg0', 3],
  1187. insertE: fffdm_insertE,
  1188. replaceE: '.navigation, #weizhi, h1',
  1189. scrollD: 2000
  1190. }
  1191. }, // 风之动漫
  1192. leyuman: {
  1193. host: 'www.leyuman.com',
  1194. url: ()=> {if (indexOF(/\/comic\/\d+\/\d+\.html/)) {
  1195. curSite = DBSite.leyuman;
  1196. setTimeout(leyuman_init, 100);
  1197. } else if (indexOF(/\/comic\/\d+\.html/)) {
  1198. setTimeout(function(){if (getCSS('#read-more')) getCSS('#read-more').click();}, 500)
  1199. } else {
  1200. curSite = DBSite.leyuman_list;
  1201. }},
  1202. style: '.mh_select, .mh_comicpic > p, mh_headpager {display: none !important;} .mh_comicpic > img{width: 100% !important; height: auto !important;}',
  1203. pager: {
  1204. type: 4,
  1205. nextL: '#xurl',
  1206. insertP: ['.mh_comicpic', 3],
  1207. insertE: leyuman_insertE,
  1208. replaceE: '.mh_headpager, .mh_readtitle',
  1209. interval: 3000,
  1210. scrollD: 3000
  1211. }
  1212. }, // 乐语漫画
  1213. leyuman_list: {
  1214. blank: 1,
  1215. pager: {
  1216. nextL: '//a[@class="page-link"][contains(text(), "下一页")]',
  1217. pageE: '.works_recommend.classification_works > ul',
  1218. replaceE: '.paging',
  1219. scrollD: 1000
  1220. },
  1221. function: {
  1222. bF: src_bF,
  1223. bFp: [0, 'img[data-src]', 'data-src']
  1224. }
  1225. }, // 乐语漫画 - 分类页
  1226. _77mh: {
  1227. host: 'www.77mh.cc',
  1228. url: ()=> {if (indexOF(/\/\d+\.html/)) {
  1229. curSite = DBSite._77mh;
  1230. setTimeout(_77mh_init, 100);
  1231. } else if (indexOF('/colist_')) {
  1232. setTimeout(function(){if (getCSS('#listmore1, .listmore')) getCSS('#listmore1, .listmore').click();}, 500)
  1233. } else {
  1234. curSite = DBSite._77mh_list;
  1235. }},
  1236. style: '.page_num, #bdtopbot {display: none !important;} #comicImg > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}',
  1237. pager: {
  1238. type: 4,
  1239. nextL: _77mh_nextL,
  1240. insertP: ['#comicImg', 3],
  1241. insertE: _77mh_insertE,
  1242. interval: 3000,
  1243. scrollD: 2000
  1244. }
  1245. }, // 新新漫画
  1246. _77mh_list: {
  1247. blank: 1,
  1248. pager: {
  1249. nextL: '//div[@class="pages_s"]/a[text()="下一页"]',
  1250. pageE: '.ar_list_co > ul > li',
  1251. replaceE: '.pages_s',
  1252. scrollD: 1000
  1253. }
  1254. }, // 新新漫画 - 分类页
  1255. _77mh_search: {
  1256. host: 'so.77mh.cc',
  1257. blank: 1,
  1258. pager: {
  1259. nextL: 'a.next',
  1260. pageE: '.ar_list_co > ul > dl',
  1261. replaceE: '.pages_s',
  1262. scrollD: 1000
  1263. }
  1264. }, // 新新漫画 - 搜索页
  1265. gufengmh: {
  1266. host: /gufengmh/,
  1267. url: ()=> {if (indexOF(/\/\d+.+\.html/)) {
  1268. let chapterScroll = getCSS('#chapter-scroll') // 强制为 [下拉阅读] 模式
  1269. if (chapterScroll && chapterScroll.className === '') {chapterScroll.click();}
  1270. curSite = DBSite.gufengmh;
  1271. } else if (indexOF(/\/(update|list|search)/)) {
  1272. curSite = DBSite.gufengmh_list;
  1273. }},
  1274. style: 'p.img_info {display: none !important;}', // 隐藏中间的页数信息
  1275. pager: {
  1276. type: 4,
  1277. nextL: gufengmh_nextL,
  1278. pageE: 'body > script:first-child',
  1279. insertP: ['#images', 3],
  1280. insertE: gufengmh_insertE,
  1281. interval: 5000,
  1282. scrollD: 4000
  1283. }
  1284. }, // 古风漫画网
  1285. gufengmh_list: {
  1286. blank: 1,
  1287. pager: {
  1288. nextL: 'li.next > a',
  1289. pageE: 'ul.book-list > li',
  1290. replaceE: 'ul.pagination',
  1291. scrollD: 1000
  1292. }
  1293. }, // 古风漫画网 - 分类页
  1294. szcdmj: {
  1295. host: 'www.szcdmj.com',
  1296. url: ()=> {
  1297. if (indexOF('/szcchapter/')) {
  1298. curSite = DBSite.szcdmj;
  1299. } else if (indexOF('/szcbook/')) {
  1300. if (getCSS('#detail-list-more')) getCSS('#detail-list-more').click();
  1301. } else if (lp == '/szcbolist' || lp == '/update') {
  1302. curSite = DBSite.szcdmj_list;
  1303. }},
  1304. style: '.header {opacity: 0.3 !important;}',
  1305. pager: {
  1306. nextL: '//div[@class="fanye"][1]/a[@href][text()="下一页" or text()="下一话"]',
  1307. pageE: '.comicpage > div',
  1308. insertP: ['.comicpage', 3],
  1309. replaceE: '.fanye,h1.title',
  1310. scrollD: 2000
  1311. },
  1312. function: {
  1313. bF: src_bF,
  1314. bFp: [0, 'img[data-original]', 'data-original']
  1315. }
  1316. }, // 砂之船动漫家
  1317. szcdmj_list: {
  1318. blank: 1,
  1319. pager: {
  1320. nextL: '#nextPage',
  1321. pageE: 'ul.mh-list > li',
  1322. replaceE: '.pagination',
  1323. scrollD: 1000
  1324. }
  1325. }, // 砂之船动漫家 - 分类/搜索页
  1326. mangabz: {
  1327. host: ['mangabz.com', 'www.mangabz.com'],
  1328. url: ()=> {if (indexOF(/\/m\d+/)) {
  1329. setTimeout(mangabz_init, 1500);
  1330. curSite = DBSite.mangabz;
  1331. } else if (indexOF(/\/\d+bz\//)) {
  1332. if (getCSS('.detail-list-form-more')) getCSS('.detail-list-form-more').click();
  1333. } else if (indexOF('/manga-list') || lp == '/search') {
  1334. curSite = DBSite.mangabz_list;
  1335. }},
  1336. 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;}',
  1337. pager: {
  1338. type: 4,
  1339. nextL: mangabz_nextL,
  1340. insertP: ['#cp_img', 3],
  1341. insertE: mangabz_insertE,
  1342. replaceE: 'p.top-title, body > .container > div:not([id])',
  1343. interval: 500,
  1344. scrollD: 2000
  1345. }
  1346. }, // Mangabz 漫画
  1347. mangabz_list: {
  1348. blank: 1,
  1349. pager: {
  1350. nextL: '//div[contains(@class,"page-pagination")]//a[contains(text(), ">")]',
  1351. pageE: 'ul.mh-list > li',
  1352. replaceE: '.page-pagination',
  1353. scrollD: 800
  1354. }
  1355. }, // Mangabz 漫画 - 分类/搜索页
  1356. dm5: {
  1357. host: 'www.dm5.com',
  1358. url: ()=> {if (indexOF(/\/m\d+/)) {
  1359. setTimeout(mangabz_init, 1500);
  1360. curSite = DBSite.dm5;
  1361. } else if (indexOF('/manga-list') || lp == '/search' || getCSS('.box-body > ul.mh-list > li')) {
  1362. curSite = DBSite.mangabz_list;
  1363. } else if (getCSS('.detail-more')) {
  1364. getCSS('.detail-more').click();
  1365. }},
  1366. style: '.view-paging > .container, .view-comment {display: none !important;} .rightToolBar {opacity: 0.3 !important;} #cp_img > img{display: block !important;margin: 0 auto !important; max-width: 99% !important; width: auto !important; height: auto !important;} body {overflow: auto !important;}',
  1367. pager: {
  1368. type: 4,
  1369. nextL: dm5_nextL,
  1370. insertP: ['#cp_img', 3],
  1371. insertE: dm5_insertE,
  1372. replaceE: '.view-paging > .container, .rightToolBar',
  1373. interval: 500,
  1374. scrollD: 2000
  1375. }
  1376. }, // 动漫屋
  1377. xmanhua: {
  1378. host: ['xmanhua.com', 'www.xmanhua.com'],
  1379. url: ()=> {if (indexOF(/\/m\d+/)) {
  1380. setTimeout(mangabz_init, 1500);
  1381. curSite = DBSite.xmanhua;
  1382. } else if (indexOF(/\/\d+xm\//)) {
  1383. if (getCSS('.detail-list-form-more')) getCSS('.detail-list-form-more').click();
  1384. } else if (indexOF('/manga-list') || lp == '/search') {
  1385. curSite = DBSite.xmanhua_list;
  1386. }},
  1387. 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;}',
  1388. hiddenPN: true,
  1389. pager: {
  1390. type: 4,
  1391. nextL: xmanhua_nextL,
  1392. insertP: ['#cp_img', 3],
  1393. insertE: xmanhua_insertE,
  1394. replaceE: '.reader-title, body > .container > div:not([id])',
  1395. interval: 500,
  1396. scrollD: 2500
  1397. }
  1398. }, // Xmanhua 漫画
  1399. xmanhua_list: {
  1400. blank: 1,
  1401. pager: {
  1402. nextL: '//div[@class="page-pagination"]//a[contains(text(), ">")]',
  1403. pageE: 'ul.mh-list > li',
  1404. replaceE: '.page-pagination',
  1405. scrollD: 1000
  1406. }
  1407. }, // Xmanhua 漫画 - 分类/搜索页
  1408. cocomanga: {
  1409. host: 'www.cocomanga.com',
  1410. url: ()=> {if (indexOF('.html')) {
  1411. if (!(getCookie('mh_readmode') === '' || getCookie('mh_readmode') === '3')) {
  1412. document.cookie='mh_readmode=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; // 强制开启自带的无缝翻页功能
  1413. location.reload(); // 刷新网页
  1414. }
  1415. setTimeout(cocomanga_init, 500);
  1416. curSite = DBSite.cocomanga;
  1417. } else if (indexOF(/\/\d+\/$/)) {
  1418. setTimeout(function(){if (getCSS('a.website-display-all')) getCSS('a.website-display-all').click();}, 300)
  1419. } else if (lp == '/show') {
  1420. curSite = DBSite.cocomanga_list;
  1421. } else if (lp == '/search') {
  1422. curSite = DBSite.cocomanga_search;
  1423. }},
  1424. style: '.mh_readend, .mh_footpager, .mh_readmode {display: none !important;} .mh_comicpic img {cursor: unset !important;} .mh_comicpic img {min-height: 150px;}',
  1425. pager: {
  1426. type: 4,
  1427. nextL: '//a[contains(@class, "read_page_link") and contains(string(), "下一章")][not(contains(@href, "javascript"))]',
  1428. insertP: ['#mangalist', 3],
  1429. insertE: cocomanga_insertE,
  1430. replaceE: '.mh_readtitle, .mh_headpager > a.mh_prevbook, .mh_readend',
  1431. interval: 1000,
  1432. scrollD: 2500
  1433. }
  1434. }, // COCOMANGA 漫画
  1435. cocomanga_list: {
  1436. blank: 1,
  1437. pager: {
  1438. nextL: ()=> getNextEP('.fed-page-info a.fed-btns-green+a[onclick]', 'page=', /page=\d+/),
  1439. pageE: 'ul.fed-list-info > li',
  1440. replaceE: '.fed-page-info',
  1441. scrollD: 1000
  1442. },
  1443. function: {
  1444. bF: src_bF,
  1445. bFp: [1, 'a[data-original]', 'data-original']
  1446. }
  1447. }, // COCOMANGA 漫画 - 分类页
  1448. cocomanga_search: {
  1449. blank: 1,
  1450. pager: {
  1451. nextL: ()=> getNextEP('.fed-page-info a.fed-btns-green+a[onclick]', 'page=', /page=\d+/),
  1452. pageE: 'dl.fed-deta-info',
  1453. replaceE: '.fed-page-info',
  1454. scrollD: 1000
  1455. },
  1456. function: {
  1457. bF: src_bF,
  1458. bFp: [1, 'a[data-original]', 'data-original']
  1459. }
  1460. }, // COCOMANGA 漫画 - 搜索页
  1461. coolkeyan: {
  1462. host: 'www.coolkeyan.com',
  1463. url: ()=> {if (location.hash.indexOf('/project/') > -1) curSite = DBSite.coolkeyan;},
  1464. style: '.q-img {height: auto !important;} .q-img__image {max-height: 1000px !important;} .row.q-my-sm.q-gutter-sm {display: none !important;}',
  1465. pager: {
  1466. type: 4,
  1467. nextL: coolkeyan_nextL,
  1468. insertP: ['//div[contains(@class, "q-img__image")][last()]', 4],
  1469. insertE: coolkeyan_insertE
  1470. }
  1471. }, // 酷科研
  1472. nsfc: {
  1473. host: ['output.nsfc.gov.cn', 'kd.nsfc.gov.cn'],
  1474. url: ()=> {if (indexOF('/conclusionProject/')) curSite = DBSite.nsfc;},
  1475. style: '#pageNoUl {display: none !important;}',
  1476. pager: {
  1477. type: 4,
  1478. nextL: nsfc_nextL,
  1479. insertP: ['#pageNoUl', 1],
  1480. insertE: nsfc_insertE
  1481. }
  1482. } // 国家自然科学基金
  1483. };
  1484. // 合并 自定义规则、外置规则、内置规则
  1485. DBSite = Object.assign(GM_getValue('menu_customRules', {}), GM_getValue('menu_rules', {}), DBSite)
  1486. // 生成 SiteTypeID
  1487. setSiteTypeID();
  1488. //console.log(DBSite)
  1489. // 用于脚本判断(针对部分特殊的网站)
  1490. SiteType = {
  1491. BAIDU_TIEBA: DBSite.baidu_tieba.SiteTypeID
  1492. };
  1493. }
  1494. // 获取外置翻页规则
  1495. function getRulesUrl(update = false) {
  1496. // 如果是原来的时间格式 或 刚安装脚本,则需要立即更新
  1497. if (typeof(GM_getValue('menu_ruleUpdateTime', '')) == 'string') update = true
  1498.  
  1499. let urlArr = [//'https://userscript.gh2233.ml/other/Autopage/rules.json',
  1500. //'https://raw.iqiq.io/XIU2/UserScript/master/other/Autopage/rules.json',
  1501. 'https://hk1.monika.love/XIU2/UserScript/master/other/Autopage/rules.json',
  1502. 'https://raw.fastgit.org/XIU2/UserScript/master/other/Autopage/rules.json',
  1503. 'https://ghproxy.fsofso.com/https://github.com/XIU2/UserScript/blob/master/other/Autopage/rules.json',
  1504. 'https://raw-gh.gcdn.mirr.one/XIU2/UserScript/master/other/Autopage/rules.json',
  1505. 'https://cdn.staticaly.com/gh/XIU2/UserScript/master/other/Autopage/rules.json',
  1506. //'https://cdn.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json',
  1507. 'https://gcore.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json',
  1508. 'https://fastly.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json']
  1509.  
  1510. if (update) { // 手动更新(或安装后首次更新)
  1511. GM_notification({text: '🔄 更新外置翻页规则中,请勿操作网页...', timeout: 3000});
  1512. getRulesUrl_(true);
  1513. } else if (parseInt(+new Date()/1000) - GM_getValue('menu_ruleUpdateTime', 0) > 172800) { // 自动更新,距离上次检查更新超过 2 天,则立即更新规则
  1514. getRulesUrl_();
  1515. }
  1516.  
  1517. function getRulesUrl_(n = false) {
  1518. let url = urlArr[Math.floor(Math.random()*urlArr.length)];
  1519. if (n) url = 'https://userscript.xiu2.xyz/other/Autopage/rules.json'
  1520. GM_xmlhttpRequest({
  1521. url: url,
  1522. method: 'GET',
  1523. responseType: 'json',
  1524. overrideMimeType: 'application/json; charset=utf-8',
  1525. timeout: 5000,
  1526. onload: function (response) {
  1527. try {
  1528. //console.log('最终 URL:' + response.finalUrl, '返回内容:',response.response, response.responseHeaders)
  1529. if (response.response) {
  1530. GM_setValue('menu_rules', response.response); // 写入最新规则
  1531. GM_setValue('menu_ruleUpdateTime', parseInt(+new Date()/1000)); // 写入当前时间戳
  1532.  
  1533. curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1534. registerMenuCommand(); // 重新判断规则
  1535. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1536. pageLoading(); // 自动无缝翻页
  1537.  
  1538. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1539. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1540.  
  1541. 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});}});
  1542. } else {
  1543. GM_notification({text: '❌ 为空!更新失败,请联系作者解决...', timeout: 5000});
  1544. }
  1545. } catch (e) {
  1546. console.log('URL:' + url, e);
  1547. GM_notification({text: '❌ 报错!更新失败,请联系作者解决...', timeout: 5000});
  1548. }
  1549. },
  1550. onerror: function (response) {
  1551. console.log('URL:' + url, response)
  1552. GM_notification({text: '❌ 错误!更新失败,请联系作者解决...', timeout: 5000});
  1553. },
  1554. ontimeout: function (response) {
  1555. console.log('URL:' + url, response)
  1556. GM_notification({text: '❌ 超时!更新失败,请联系作者解决...', timeout: 5000});
  1557. }
  1558. })
  1559. }
  1560. }
  1561.  
  1562.  
  1563. // --------------------------------------------------------
  1564.  
  1565.  
  1566. // 判断网站类型
  1567. webTypeIf();
  1568.  
  1569. // 帖子内自动翻页判断
  1570. if (!GM_getValue('menu_thread')) {
  1571. if (curSite.thread) {curSite = {SiteTypeID: 0}; pageNum.now = 1;}
  1572. }
  1573.  
  1574. //console.log(curSite)
  1575. // 显示页码
  1576. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');}
  1577. // 左键双击网页空白处暂停翻页
  1578. pausePageEvent();
  1579. // 强制新标签页打开链接
  1580. if (curSite.blank != undefined || curSite.forceTarget != undefined) forceTarget();
  1581.  
  1582. // 对于使用 pjax 技术的网站,需要监听 URL 变化来重新判断翻页规则
  1583. if (urlC) {
  1584. nowLocation = location.href
  1585. if (window.onurlchange === undefined) {addUrlChangeEvent();} // Tampermonkey v4.11 版本添加的 onurlchange 事件 grant,可以监控 pjax 等网页的 URL 变化
  1586. if (webType === 1) {
  1587. window.addEventListener('urlchange', function(){
  1588. lp = location.pathname;
  1589. //console.log(nowLocation, location.href)
  1590. if (curSite.history !== false && window.top.document.Autopage_nowUrl === location.href) {nowLocation = location.href; return}
  1591. if (nowLocation == location.href) return
  1592. if (curSite.pager && curSite.pager.type == 5) {
  1593. if (self != top) {window.top.location.href = location.href;} else {if (getCSS('iframe#Autopage_iframe')) {getCSS('iframe#Autopage_iframe').remove();}}
  1594. pausePage = true;
  1595. } // 对于翻页模式 5,如果是 iframe 框架内 URL 变动,则升级为顶级页面,如果是顶级页面的 URL 变动,则清理 iframe 框架
  1596. nowLocation = location.href; curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1597. registerMenuCommand(); // 重新判断规则
  1598. //console.log(curSite);
  1599. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1600. // 帖子内自动翻页判断
  1601. if (!GM_getValue('menu_thread')) {
  1602. if (curSite.thread) {curSite = {SiteTypeID: 0}; pageNum.now = 1;}
  1603. }
  1604. pageLoading(); // 自动无缝翻页
  1605.  
  1606. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1607. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1608. })
  1609. } else if (webType === 2) {
  1610. window.addEventListener('urlchange', function(){
  1611. lp = location.pathname;
  1612. //console.log(nowLocation, location.href)
  1613. if (nowLocation == location.href) return
  1614. setTimeout(function(){
  1615. nowLocation = location.href; curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1616. discuz_(); // 重新判断规则
  1617.  
  1618. // 帖子内自动翻页判断
  1619. if (!GM_getValue('menu_thread')) {
  1620. if (curSite.thread) {curSite = {SiteTypeID: 0}; pageNum.now = 1;}
  1621. }
  1622.  
  1623. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1624. pageLoading(); // 自动无缝翻页
  1625.  
  1626. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1627. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1628. }, 500)
  1629. })
  1630. } else if (webType === 3) {
  1631. window.addEventListener('urlchange', function(){
  1632. lp = location.pathname;
  1633. if (nowLocation == location.href) return
  1634. nowLocation = location.href; curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
  1635. DBSite.flarum.url(); // 重新判断规则
  1636. if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
  1637. pageLoading(); // 自动无缝翻页
  1638.  
  1639. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  1640. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1641. })
  1642. }
  1643. }
  1644. // 插入 Style CSS 样式
  1645. if (curSite.style) insStyle(curSite.style)
  1646.  
  1647. // 自动无缝翻页
  1648. pageLoading();
  1649.  
  1650.  
  1651. // --------------------------------------------------------
  1652.  
  1653.  
  1654. // [Discuz! 论坛] 判断各版块帖子列表类型
  1655. function discuzForum(m) {
  1656. if (m == 'm') { // 手机版页面
  1657. if (getCSS('a.loadmore')) {
  1658. curSite = DBSite.discuz_m_forum;
  1659. } else if (getCSS('.threadlist')) {
  1660. curSite = DBSite.discuz_m; curSite.pager.pageE = '.threadlist > ul > li';
  1661. } else if (getCSS('[id^="normalthread_"]')) {
  1662. curSite = DBSite.discuz_m; curSite.pager.pageE = '[id^="normalthread_"]:not(.ZDlist)';
  1663. }
  1664. if (curSite.SiteTypeID !== 0 && location.hostname === 'keylol.com') {curSite.history = false; urlC = true;}
  1665. } else {
  1666. if (getCSS('#autopbn')) { // 判断是否有 [下一页] 按钮
  1667. curSite = DBSite.discuz_forum;
  1668. } else if (getCSS('#waterfall')) { // 判断是否为图片模式
  1669. if (!getCSS('#pgbtn, .pgbtn')) { // 如果各版块帖子列表已存在这个元素,说明自带了无缝翻页
  1670. curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理
  1671. }
  1672. } else {
  1673. curSite = DBSite.discuz_guide;
  1674. }
  1675. }
  1676. }
  1677. // [Discuz! 论坛] 判断手机版帖子内
  1678. function discuzThreadM() {
  1679. if (getCSS('[id^="pid"]')) {
  1680. curSite = DBSite.discuz_m; curSite.pager.pageE = '[id^="pid"], [id^="pid"]+div:not([id="post_new"])'
  1681. } else if (getCSS('[id^="post_"]')) {
  1682. curSite = DBSite.discuz_m; curSite.pager.pageE = '[id^="post_"]';
  1683. }
  1684. if (curSite.SiteTypeID !== 0 && location.hostname === 'keylol.com') {curSite.history = false; urlC = true;}
  1685. }
  1686. function discuz_() {
  1687. if (getCSS('body[id="nv_forum"][class^="pg_"][onkeydown*="27"]')) {
  1688. switch (getCSS('body[id="nv_forum"][class^="pg_"][onkeydown*="27"]').className) {
  1689. case 'pg_forumdisplay': // < 各版块帖子列表 >
  1690. discuzForum(); break;
  1691. case 'pg_viewthread': // < 帖子内 >
  1692. curSite = DBSite.discuz_thread; break;
  1693. case 'pg_guide': // < 导读帖子列表等 >
  1694. curSite = DBSite.discuz_guide; break;
  1695. case 'pg_collection': // < 淘贴列表 >
  1696. curSite = DBSite.discuz_collection; break;
  1697. }
  1698. }
  1699. // 如果上面没有匹配的则继续 < 搜索结果 >
  1700. if (curSite.SiteTypeID === 0) {
  1701. if (indexOF('search') || getCSS('body[id="nv_search"][onkeydown*="27"]')) {
  1702. if (indexOF('mobile=2', 's')) { // 手机版页面
  1703. curSite = DBSite.discuz_m; curSite.pager.pageE = '.threadlist > ul > li'; urlC = true;
  1704. } else {
  1705. curSite = DBSite.discuz_search;
  1706. }
  1707. }
  1708. }
  1709. // 如果上面没有匹配的则继续
  1710. if (curSite.SiteTypeID === 0) {
  1711. if (indexOF('.html')) { // 判断是不是静态网页(.html 结尾)
  1712. if (indexOF('/forum-')) { // < 各版块帖子列表 >
  1713. if (getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
  1714. discuzForum('m');
  1715. } else {
  1716. discuzForum();
  1717. }
  1718. } else if (indexOF('/thread-')) { // < 帖子内 >
  1719. if (getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
  1720. discuzThreadM();
  1721. } else {
  1722. curSite = DBSite.discuz_thread;
  1723. }
  1724. }
  1725. }
  1726. }
  1727. // 如果上面没有匹配的则继续
  1728. if (curSite.SiteTypeID === 0) {
  1729. if (indexOF('mod=forumdisplay', 's') || indexOF('forumdisplay.php')) { // < 各版块帖子列表 >
  1730. 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/")]')) { // 手机版页面
  1731. discuzForum('m');
  1732. } else {
  1733. discuzForum();
  1734. }
  1735. } else if (indexOF('mod=viewthread', 's') || indexOF('viewthread.php')) { // < 帖子内 >
  1736. 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/")]')) { // 手机版页面
  1737. discuzThreadM();
  1738. } else {
  1739. curSite = DBSite.discuz_thread;
  1740. }
  1741. } else if (indexOF('mod=guide', 's')) { // < 导读帖子列表 >
  1742. curSite = DBSite.discuz_guide;
  1743. } else if(indexOF('mod=space', 's') && indexOF('do=thread', 's')) { // 别人的主题/回复
  1744. curSite = DBSite.discuz_youspace;
  1745. } else if (indexOF('mod=collection', 's')) { // < 淘贴列表 >
  1746. curSite = DBSite.discuz_collection;
  1747. } else if (getCSS('#threadlist')) { // < 部分论坛的各板块 URL 是自定义的 >
  1748. discuzForum();
  1749. } else if (getCSS('#postlist')) { // < 部分论坛的帖子内 URL 是自定义的 >
  1750. curSite = DBSite.discuz_thread;
  1751. } else if (isMobile()) { // 手机版判断
  1752. discuzForum('m');
  1753. if (curSite.SiteTypeID === 0) discuzThreadM();
  1754. }
  1755. }
  1756. }
  1757. // [Discuz! 论坛] 图片模式列表样式预处理
  1758. function waterfallStyle() {
  1759. let width = getCSS('#waterfall > li:first-child').style.width;
  1760. 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;}`);
  1761. }
  1762.  
  1763.  
  1764. // [百度贴吧](发帖按钮点击事件)
  1765. function baidu_tieba_1() {
  1766. let button = getCSS('.tbui_aside_fbar_button.tbui_fbar_post > a');
  1767. if (button) {
  1768. button.remove();
  1769. getCSS('li.tbui_aside_fbar_button.tbui_fbar_down').insertAdjacentHTML(getAddTo(4), '<li class="tbui_aside_fbar_button tbui_fbar_post"><a href="javascript:void(0);" title="因为 [自动无缝翻页] 的原因,请点击该按钮发帖!"></a></li>')
  1770. button = getCSS('.tbui_aside_fbar_button.tbui_fbar_post > a');
  1771. if (button) {
  1772. button.onclick = function(){
  1773. let button2 = getCSS('div.edui-btn.edui-btn-fullscreen.edui-btn-name-portrait');
  1774. if (button2) {button2.click();} else {alert('提示:登录(不可用)后才能发帖!');}
  1775. return false;
  1776. }
  1777. }
  1778. }
  1779. }
  1780. // [百度贴吧] 插入数据
  1781. function baidu_tieba_insertE(pageE, type) {
  1782. if (!pageE) return
  1783. // 获取 <script> 内容
  1784. const scriptElems = getXpath(`//script[contains(text(), 'Bigpipe.register("frs-list/pagelet/thread_list", ')]`, pageE, pageE);
  1785. if (scriptElems) {
  1786. // 从 <script> 中提取帖子列表字符串
  1787. let scriptText = scriptElems.textContent.replace('Bigpipe.register("frs-list/pagelet/thread_list", ','');
  1788. scriptText = scriptText.slice(0, scriptText.indexOf(').'));
  1789. // 字符串转 Element 元素
  1790. let temp_baidu_tieba = document.createElement('div'); temp_baidu_tieba.innerHTML = JSON.parse(scriptText).content;
  1791. processElems(temp_baidu_tieba);
  1792. }
  1793. }
  1794.  
  1795.  
  1796. // [NexusMods] 获取下一页地址
  1797. function nexusmods_nextL() {
  1798. if (getCSS('.nexus-ui-blocker')) return
  1799. let modList;
  1800. if (indexOF('/news')) {modList = RH_NewsTabContent;} else {modList = RH_ModList;}
  1801. if (!modList) return
  1802. let out_items = JSON.stringify(modList.out_items).replace(/{|}|"/g,''),
  1803. nextNum = getXpath('//div[contains(@class, "pagenav")][1]//a[contains(@class, "page-selected")]/parent::li/following-sibling::li/a'),
  1804. categories = modList.out_items.categories, categoriesUrl = '';
  1805. var url = '';
  1806. if (nextNum && nextNum.innerText) {
  1807. nextNum = nextNum.innerText;
  1808. if (out_items.indexOf('page:') > -1) {
  1809. out_items = out_items.replace(/page:\d+/, `page:${nextNum}`)
  1810. } else {
  1811. out_items += `,page:${nextNum}`;
  1812. }
  1813. if (categories && categories != []) {
  1814. for (let i = 0; i < categories.length; i++) {
  1815. categoriesUrl += `,categories[]:${categories[i]}`
  1816. }
  1817. categoriesUrl = categoriesUrl.replace(/,/,'');
  1818. if (out_items.indexOf('categories:') > -1) {
  1819. out_items = out_items.replace(/categories:\[.*\]/, categoriesUrl)
  1820. }
  1821. }
  1822. return `https://www.nexusmods.com${modList.uri}?RH_${modList.id}=${out_items}`
  1823. }
  1824. return ''
  1825. }
  1826. // [NexusMods] 的插入前函数(隐藏底部元素)
  1827. function nexusmods_bF(pageE) {
  1828. pageE.forEach(function (one) {
  1829. let now = one.querySelector('.mod-tile-left');
  1830. if (now) {
  1831. let downloadCount = now.querySelector('.downloadcount > span.flex-label');
  1832. if (downloadCount) {
  1833. if (GlobalModStats[now.dataset.gameId] && GlobalModStats[now.dataset.gameId][now.dataset.modId]) {
  1834. downloadCount.textContent = shortFormat(parseInt(GlobalModStats[now.dataset.gameId][now.dataset.modId].total));
  1835. }
  1836. }
  1837. }
  1838. });
  1839. return pageE
  1840. }
  1841.  
  1842.  
  1843. // [bilibili_search] 获取下一页地址
  1844. function bilibili_search_nextL() {
  1845. if (!location.search) return
  1846. let pageActive = 1, pageLast = parseInt(getXpath('//ul[@class="pages"]/li[contains(@class, "page-item")][not(contains(@class, "next") or contains(@class, "prev"))][last()]').innerText);
  1847. if (!pageLast) return
  1848. if (indexOF(/page=\d+/, 's')) {
  1849. pageActive = parseInt(/page=\d+/.exec(location.search)[0].replace('page=',''))
  1850. }
  1851. if (pageActive < pageLast) {
  1852. if (indexOF(/page=\d+/, 's')) {
  1853. return (location.origin + location.pathname + location.search.replace(/page=\d+/,`page=${pageActive+1}`))
  1854. } else {
  1855. return (location.origin + location.pathname + location.search + `&page=${pageActive+1}`)
  1856. }
  1857. }
  1858. }
  1859. // [bilibili_search] 插入前函数(加载图片)
  1860. function bilibili_search_bF(pageE) {
  1861. pageE.forEach(function (one) {
  1862. let img = getCSS('.img > .lazy-img > img[src=""]', one)
  1863. if (img) {
  1864. img.setAttribute('data-srclz', 'lazy')
  1865. }
  1866. });
  1867. return pageE
  1868. }
  1869. // [bilibili_search] 插入后函数(加载图片)
  1870. function bilibili_search_aF() {
  1871. let result = __INITIAL_STATE__.flow[__INITIAL_STATE__.flow.fields[0]].result;
  1872. if (result.length > 0) {
  1873. let imgArr = getAllCSS('.img > .lazy-img > img[data-srclz]');
  1874. if (imgArr.length > 0) {
  1875. for (let i = 0; i < imgArr.length; i++) {
  1876. imgArr[i].src = result[i].pic;
  1877. imgArr[i].removeAttribute('data-srclz');
  1878. }
  1879. }
  1880. }
  1881. }
  1882.  
  1883.  
  1884. // [漫画狂] 获取下一页地址
  1885. function cartoonmad_nextL() {
  1886. let url = getXpath('//a[@class="pages"][contains(text(),"下一頁")]');
  1887. if (url) {
  1888. if (url.getAttribute('href') === 'thend.asp') {
  1889. url = getXpath('//a[@class="pages"][contains(string(),"下一話")]')
  1890. if (url) return url.href;
  1891. pausePage = false;
  1892. GM_notification({text: `注意:该网站早期漫画章节,因为网站自身问题而无法翻至下一话(仅限于显示为 [第 X 卷]/[下一卷] 的)。\n因此需要手动去 [目录页] 进入下一卷!`, timeout: 10000});
  1893. } else {
  1894. return url.href;
  1895. }
  1896. }
  1897. return '';
  1898. }
  1899.  
  1900.  
  1901. // [漫画猫] 初始化(显示本话所以图片)
  1902. function manhuacat_init() {
  1903. let _img = '';
  1904. for (let now of img_data_arr) {_img += `<img src="${asset_domain}${img_pre}${now}">`;}
  1905. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  1906.  
  1907. }
  1908. // [漫画猫] 获取下一页地址
  1909. function manhuacat_nextL(pageE, type) {
  1910. if (type === 'url') {
  1911. if(pageE.code == '0000') {
  1912. if (pageE.url === curSite.pageUrl) return
  1913. curSite.pageUrl = pageE.url;
  1914. getPageE_(curSite.pageUrl); // 真正的下一页链接
  1915. }
  1916. } else {
  1917. let vg_r_data = getCSS('.vg-r-data');
  1918. if (vg_r_data) {
  1919. getPageE_(`${location.origin}/chapter_num?chapter_id=${vg_r_data.dataset.chapter_num}&ctype=1&type=${vg_r_data.dataset.chapterType};`, 'json', 'GET', '', 'url');
  1920. }
  1921. }
  1922. }
  1923. // [漫画猫] 插入数据
  1924. function manhuacat_insertE(pageE, type) {
  1925. if (!pageE) return
  1926. if (type === 'url') { // 获取下一页链接
  1927. manhuacat_nextL(pageE, type); return
  1928. }
  1929. addHistory(pageE);
  1930. replaceElems(pageE);
  1931.  
  1932. // 插入图片
  1933. 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');;
  1934. for (let now of _img_arr) {_img += `<img src="${vg_r_data.dataset.chapterDomain}${img_pre}${now}">`;}
  1935. if (_img) {
  1936. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  1937. pageNum.now = pageNum._now + 1
  1938. }
  1939. }
  1940.  
  1941.  
  1942. // [漫画柜] 初始化(将本话其余图片插入网页中)
  1943. function manhuagui_init() {
  1944. // hook imgDate 代码
  1945. SMH.imgData = function(n) {window['imgDate'] = n;return{preInit:function(){}}}
  1946. // 重新执行本页的 imgDate 代码
  1947. insScript(curSite.pager.pageE);
  1948. let _img = '', imgPath = `${location.protocol}//i.hamreus.com${window['imgDate'].path}`;
  1949. //console.log(imgPath, window['imgDate'])
  1950. if (!(window['imgDate']) || !(imgPath)) return
  1951. // 遍历图片文件名数组,组合为 img 标签
  1952. for (let i = 0; i < window['imgDate'].files.length; i++) {_img += `<img src="${imgPath + window['imgDate'].files[i]}?e=${window['imgDate'].sl.e}&m=${window['imgDate'].sl.m}">`;}
  1953. // 插入并覆盖原来的一个图片
  1954. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  1955. pausePage = true;
  1956. }
  1957. // [漫画柜] 获取下一页地址
  1958. function manhuagui_nextL() {
  1959. if (window['imgDate'].nextId == 0) return
  1960. var url = location.origin + location.pathname.replace(window['imgDate'].cid.toString(), window['imgDate'].nextId.toString())
  1961. if (url === curSite.pageUrl) return
  1962. curSite.pageUrl = url
  1963. getPageE_(curSite.pageUrl);
  1964. }
  1965. // [漫画柜] 插入数据
  1966. function manhuagui_insertE(pageE, type) {
  1967. if (!pageE) return
  1968. // 重新执行本页的 imgDate 代码
  1969. insScript(curSite.pager.pageE, pageE);
  1970. let _img = '', imgPath = `${location.protocol}//i.hamreus.com${window['imgDate'].path}`;
  1971. //console.log(imgPath, window['imgDate'])
  1972. if (!(window['imgDate']) || !(imgPath)) return
  1973. // 遍历图片文件名数组,组合为 img 标签
  1974. for (let i = 0; i < window['imgDate'].files.length; i++) {_img += `<img src="${imgPath + window['imgDate'].files[i]}?e=${window['imgDate'].sl.e}&m=${window['imgDate'].sl.m}">`;}
  1975. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
  1976. addHistory(pageE);
  1977. pageNum.now = pageNum._now + 1
  1978. }
  1979.  
  1980.  
  1981. // [36漫画] 初始化(将本话其余图片插入网页中)
  1982. function _36manga_init() {
  1983. let _img = '', imgPath = `${SinConf.resHost[0].domain[0]}${chapterPath}`;
  1984. if (!(chapterImages) || !(imgPath)) return
  1985. // 遍历图片文件名数组,组合为 img 标签
  1986. for (let i = 0; i < chapterImages.length; i++) {_img += `<img src="${imgPath}${chapterImages[i]}">`;}
  1987. // 插入并覆盖原来的一个图片
  1988. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  1989. pausePage = true;
  1990. }
  1991. // [36漫画] 获取下一页地址
  1992. function _36manga_nextL() {
  1993. if (!nextChapterData.id) return
  1994. var url = comicUrl + nextChapterData.id + '.html'
  1995. if (url === curSite.pageUrl) return
  1996. curSite.pageUrl = url
  1997. getPageE_(curSite.pageUrl);
  1998. }
  1999. // [36漫画] 插入数据
  2000. function _36manga_insertE(pageE, type) {
  2001. if (!pageE) return
  2002. // 插入并执行数据代码
  2003. insScript(curSite.pager.pageE, pageE);
  2004. let _img = '', imgPath = `${SinConf.resHost[0].domain[0]}${chapterPath}`;
  2005. if (!(chapterImages) || !(imgPath)) return
  2006. // 遍历图片文件名数组,组合为 img 标签
  2007. for (let i = 0; i < chapterImages.length; i++) {_img += `<img src="${imgPath}${chapterImages[i]}">`;}
  2008. // 插入并覆盖原来的一个图片
  2009. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
  2010. addHistory(pageE);
  2011. pageNum.now = pageNum._now + 1
  2012. }
  2013.  
  2014.  
  2015. // [爱漫画] 获取全部图片
  2016. function imanhuaw_getIMG() {
  2017. let _img = '', _imgUrl;
  2018. for (let one of base64_decode(qTcms_S_m_murl_e).split("$qingtiandy$")) {
  2019. _imgUrl = one;
  2020. if (one.substring(0,1) == '/') {
  2021. _imgUrl = qTcms_m_weburl + _imgUrl;
  2022. } else {
  2023. if (qTcms_Pic_m_if != '2') {
  2024. one = one.replace(/\?/gi, 'a1a1');
  2025. one = one.replace(/&/gi, 'b1b1');
  2026. one = one.replace(/%/gi, 'c1c1');
  2027. let m_httpurl = '';
  2028. if (typeof(qTcms_S_m_mhttpurl) != 'undefined') m_httpurl = base64_decode(qTcms_S_m_mhttpurl);
  2029. if (location.hostname == 'www.ccshwy.com') qTcms_m_indexurl = 'http://h.ccshwy.com/';
  2030. _imgUrl = qTcms_m_indexurl + 'statics/pic/?p=' + escape(one) + '&picid=' + qTcms_S_m_id + '&m_httpurl=' + escape(m_httpurl);
  2031. } else {
  2032. _imgUrl = _imgUrl.replace('http:', '') ;
  2033. _imgUrl = _imgUrl.replace('https:', '');
  2034. }
  2035. }
  2036. _img += `<img src="${_imgUrl}">`;
  2037. }
  2038. return _img;
  2039. }
  2040. // [爱漫画] 初始化(调整本话其余图片)
  2041. function imanhuaw_init() {
  2042. getOne(curSite.pager.insertP[0]).outerHTML = imanhuaw_getIMG();
  2043. document.oncontextmenu = function(){}
  2044. }
  2045. // [爱漫画] 获取下一页地址
  2046. function imanhuaw_nextL() {
  2047. let next = location.origin + qTcms_Pic_nextArr
  2048. if (next && next != location.origin && next != curSite.pageUrl) {
  2049. curSite.pageUrl = next;
  2050. getPageE_(curSite.pageUrl);
  2051. }
  2052. }
  2053. // [爱漫画] 插入数据
  2054. function imanhuaw_insertE(pageE, type) {
  2055. if (!pageE) return
  2056. // 插入并运行 <script>
  2057. insScript('//head/script[not(@src)][contains(text(), "qTcms_S_m_murl_e")]', pageE);
  2058. // 将 img 标签插入到网页中
  2059. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), imanhuaw_getIMG());
  2060. addHistory(pageE);
  2061. pageNum.now = pageNum._now + 1
  2062. }
  2063.  
  2064.  
  2065. // [漫画 DB] 初始化(将本话其余图片插入网页中)
  2066. function manhuadb_init() {
  2067. let _img = '', data = getCSS('.vg-r-data'), imgDate;
  2068. if (!data) return
  2069. getAllCSS(curSite.pager.pageE.replace('', '')).forEach(function (one) {
  2070. if (one.tagName === 'SCRIPT' && one.textContent.indexOf('var img_data =') > -1) {
  2071. let json = JSON.parse(window.atob(one.textContent.split("'")[1]));
  2072. if (json) {
  2073. let _img = '';
  2074. for (let i = 0; i < json.length; i++) {_img += `<img class="img-fluid show-pic" src="${data.dataset.host + data.dataset.img_pre + json[i].img}">`;}
  2075. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2076. }
  2077. }
  2078. })
  2079. }
  2080. // [漫画 DB] 获取下一页地址
  2081. function manhuadb_nextL() {
  2082. let nextArr = getAllCSS('a.fixed-a-es'), next;
  2083. var url = '';
  2084. if (nextArr.length == 0) return
  2085. for (let i = 0; i < nextArr.length; i++) {
  2086. if (nextArr[i].className.indexOf('active') > -1) {
  2087. if (nextArr[i+1]) url = nextArr[i+1].href;
  2088. break;
  2089. }
  2090. }
  2091. if (url === curSite.pageUrl) return
  2092. curSite.pageUrl = url
  2093. getPageE_(curSite.pageUrl);
  2094. }
  2095. // [漫画 DB] 插入数据
  2096. function manhuadb_insertE(pageE, type) {
  2097. if (!pageE) return
  2098. if (replaceElems(pageE, curSite.pager.pageE, curSite.pager.pageE)) {
  2099. addHistory(pageE);
  2100. pageNum.now = pageNum._now + 1
  2101. manhuadb_init(); // 将刚刚替换的图片插入网页中
  2102. }
  2103. }
  2104.  
  2105.  
  2106. // [HiComic(嗨漫画)] 初始化(将本话其余图片插入网页中)
  2107. function hicomic_init() {
  2108. let _img = '';
  2109. getAllCSS('.chapter > section:not(:first-child) > section[val]').forEach(function (one) {
  2110. let src = one.getAttribute('val');
  2111. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h'
  2112. _img += `<img src="${src}">`
  2113. })
  2114. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2115. window.document.title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${getCSS('.chapter_name').textContent}) - HiComic`); // 修改网页标题(加上 第 X 话)
  2116. }
  2117. // [HiComic(嗨漫画)] 获取下一页地址
  2118. function hicomic_nextL() {
  2119. let nextId;
  2120. nextId = getCSS('.next_chapter:not(.end)')
  2121. if (nextId && nextId.id && nextId.id != 'None') {
  2122. curSite.pageUrl = location.href;
  2123. getPageE_(`https://www.hicomic.net/api/web/chapter/${nextId.id}/contents`, 'json');
  2124. }
  2125. }
  2126. // [HiComic(嗨漫画)] 插入数据
  2127. function hicomic_insertE(pageE, type) {
  2128. if (!pageE || pageE.code != 200) return
  2129. if (pageE.results.chapter.next) { // 写入下一页的 UUID
  2130. getCSS('.next_chapter').id = pageE.results.chapter.next;
  2131. } else {
  2132. getCSS('.next_chapter').id = 'None';
  2133. getCSS('.next_chapter').classList.add('end');
  2134. }
  2135. curSite.pageUrl =`https://www.hicomic.net/chapters/${pageE.results.chapter.uuid}/contents`
  2136. getCSS('.chapter_name').textContent = pageE.results.chapter.name; // 修改漫画标题
  2137. addHistory(pageE, window.document.title.replace(/(\(第.+\))? - HiComic/, `(${pageE.results.chapter.name}) - HiComic`));
  2138. let _img = '';
  2139. for (let i = 0; i < pageE.results.chapter.contents.length; i++) { // 遍历图片文件名数组,组合为 img 标签
  2140. let src = pageE.results.chapter.contents[i].url;
  2141. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h';
  2142. _img += `<img src="${src}">`
  2143. }
  2144. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2145. pageNum.now = pageNum._now + 1
  2146. }
  2147.  
  2148.  
  2149. // [动漫之家] 初始化(调整本话其余图片)
  2150. function dmzj_init(css) {
  2151. let _img = '';
  2152. getAllCSS(css).forEach(function (one) {_img += `<img src="${one.dataset.original}">`;})
  2153. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  2154. }
  2155. // [动漫之家] 插入数据
  2156. function dmzj_insertE(pageE, type) {
  2157. if (!pageE) return
  2158. // 插入并运行 <script>
  2159. insScript('head > script[type]:not([src])', pageE);
  2160.  
  2161. // 插入图片
  2162. let _img = '', _img_arr;
  2163. if (pages.indexOf('|') === -1) {
  2164. _img_arr = JSON.parse(pages.replace(/\r\n/g,'|')).page_url.split('|');
  2165. } else {
  2166. _img_arr = JSON.parse(pages).page_url.split('|');
  2167. }
  2168. for (let now of _img_arr) {
  2169. _img += `<img src="${img_prefix}${now}">`;
  2170. }
  2171. if (_img) {
  2172. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2173. addHistory(pageE);
  2174. if (replaceElems(pageE)) pageNum.now = pageNum._now + 1
  2175. }
  2176. }
  2177. // [动漫之家-漫画] 插入数据
  2178. function dmzj_manhua_insertE(pageE, type) {
  2179. if (!pageE) return
  2180. // 插入并运行 <script>
  2181. insScript('head > script[type]:not([src])', pageE);
  2182.  
  2183. // 插入图片
  2184. let _img = '';
  2185. for (let now of arr_pages) {
  2186. _img += `<img src="${img_prefix}${now}">`;
  2187. }
  2188. if (_img) {
  2189. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2190. addHistory(pageE);
  2191. if (replaceElems(pageE)) pageNum.now = pageNum._now + 1
  2192. }
  2193. }
  2194.  
  2195.  
  2196. // [优酷漫画] 初始化(调整本话其余图片)
  2197. function ykmh_init(css) {
  2198. let host = SinMH.getChapterImage(1).split('/')[0] + '//' + SinMH.getChapterImage(1).split('/')[2];
  2199. if (!host) return
  2200. let _img = '';
  2201. for (let one of chapterImages) {_img += `<img src="${host}${one}">`;}
  2202. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  2203. }
  2204. // [优酷漫画] 获取下一页地址
  2205. function ykmh_nextL() {
  2206. let url = comicUrl + nextChapterData.id + '.html'
  2207. if (url && url != '.html' && url != curSite.pageUrl) {
  2208. curSite.pageUrl = url;
  2209. getPageE_(curSite.pageUrl);
  2210. }
  2211. }
  2212. // [优酷漫画] 插入数据
  2213. function ykmh_insertE(pageE, type) {
  2214. //console.log(pageE)
  2215. if (!pageE) return
  2216. // 插入并运行 <script>
  2217. insScript('//script[contains(text(),"chapterImages")]', pageE);
  2218.  
  2219. let host = SinMH.getChapterImage(1).split('/')[0] + '//' + SinMH.getChapterImage(1).split('/')[2];
  2220. if (!host) host = document.querySelector(curSite.pager.insertP[0]).src.split('/')[0] + '//' + document.querySelector(curSite.pager.insertP[0]).src.split('/')[2]
  2221. // 插入图片
  2222. let _img = '';
  2223. for (let one of chapterImages) {_img += `<img src="${host}${one}">`;}
  2224. if (_img) {
  2225. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2226. addHistory(pageE);
  2227. if (replaceElems(pageE)) pageNum.now = pageNum._now + 1
  2228. }
  2229. }
  2230.  
  2231.  
  2232. // [动漫戏说] 插入后函数(加载图片)
  2233. function acgn_aF() {
  2234. let old = getAllCSS('.pic[_src][id]'), _img = '';
  2235. if (old.length > 0) {
  2236. for (let now of old) {now.outerHTML = `<div class="pic" _src="${now.getAttribute('_src')}"><img src="${now.getAttribute('_src')}" class="img1"></div>`;}
  2237. }
  2238. }
  2239.  
  2240.  
  2241. // [漫画星球] 插入数据
  2242. function mhxqiu_insertE(pageE, type) {
  2243. if (!pageE) return
  2244. // 插入并运行 <script>
  2245. insScript('//script[contains(text(), "eval") and contains(text(), "newImgs")]', pageE);
  2246.  
  2247. // 插入图片
  2248. let _img = '';
  2249. for (let now of newImgs) {_img += `<li><div style="display: inline-block;zoom: 1;"><img src="${now}" class="loaded lazy" style="opacity: 1;box-shadow:none;"></div></li>`;}
  2250. if (_img) {
  2251. // 将 img 标签插入到网页中
  2252. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
  2253. addHistory(pageE);
  2254. pageNum.now = pageNum._now + 1
  2255. replaceElems(pageE)
  2256. }
  2257. }
  2258.  
  2259.  
  2260. // [风之动漫] 插入数据
  2261. function fffdm_insertE(pageE, type) {
  2262. if (!pageE) return
  2263. // 插入并运行 <script>
  2264. let scriptElems = getXpath('id("main")/script[contains(text(), "mhpicurl")][1]', pageE, pageE);
  2265. if (scriptElems) {
  2266. document.body.appendChild(document.createElement('script')).textContent = scriptElems.textContent.replace(/document\.write.+/, '');
  2267.  
  2268. // 插入图片
  2269. setTimeout(function() {
  2270. getOne(curSite.pager.insertP[0]).appendChild(document.createElement('img')).src = mhpicurl;
  2271. addHistory(pageE);
  2272. pageNum.now = pageNum._now + 1
  2273. replaceElems(pageE)
  2274. }, 100)
  2275. }
  2276. }
  2277.  
  2278.  
  2279. // [乐语漫画] 初始化(调整本话其余图片)
  2280. function leyuman_init() {
  2281. let _img = '';
  2282. for (let one of JSON.parse(z_img)) {
  2283. if (one.slice(0,4) === 'http') {
  2284. _img += `<img src="${one}">`;
  2285. } else {
  2286. _img += `<img src="https://img.shishi-life.com/${one}">`;
  2287. }
  2288. }
  2289. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  2290.  
  2291. }
  2292. // [乐语漫画] 插入数据
  2293. function leyuman_insertE(pageE, type) {
  2294. if (!pageE) return
  2295. // 插入并运行 <script>
  2296. insScript('//body//script[not(@src)][contains(text(), "z_img=")]', pageE);
  2297.  
  2298. // 插入图片
  2299. let _img = '';
  2300. for (let one of JSON.parse(z_img)) {
  2301. if (one.slice(0,4) === 'http') {
  2302. _img += `<img src="${one}">`;
  2303. } else {
  2304. _img += `<img src="https://img.shishi-life.com/${one}">`;
  2305. }
  2306. }
  2307. if (_img) {
  2308. // 将 img 标签插入到网页中
  2309. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
  2310. addHistory(pageE);
  2311. pageNum.now = pageNum._now + 1
  2312. replaceElems(pageE)
  2313. }
  2314. }
  2315.  
  2316.  
  2317. // [新新漫画] 初始化(调整本话其余图片)
  2318. function _77mh_init() {
  2319. let _img = '';
  2320. for (let one of arr) {_img += `<img src="${img_qianz}${one}">`;}
  2321. getOne(curSite.pager.insertP[0]).innerHTML = _img;
  2322. }
  2323. // [新新漫画] 获取下一页地址
  2324. function _77mh_nextL() {
  2325. let next = nextLink_b
  2326. if (next && next != curSite.pageUrl) {
  2327. curSite.pageUrl = next;
  2328. getPageE_(curSite.pageUrl);
  2329. }
  2330. }
  2331. // [新新漫画] 插入数据
  2332. function _77mh_insertE(pageE, type) {
  2333. if (!pageE) return
  2334. // 插入并运行 <script>
  2335. insScript('//script[not(@src)][contains(text(), "eval(")]', pageE);
  2336.  
  2337. // 插入图片
  2338. let _img = '';
  2339. for (let one of msg.split('|')) {_img += `<img src="${img_qianz}${one}.webp">`;}
  2340. if (_img) {
  2341. // 将 img 标签插入到网页中
  2342. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
  2343. addHistory(pageE);
  2344. pageNum.now = pageNum._now + 1
  2345. }
  2346. }
  2347.  
  2348.  
  2349. // [古风漫画网] 获取下一页地址
  2350. function gufengmh_nextL() {
  2351. let pageE = getOne(curSite.pager.pageE); // 寻找数据所在元素
  2352. if (pageE) {
  2353. let comicUrl, nextId;
  2354. var url = '';
  2355. pageE.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历
  2356. //console.log(one)
  2357. if (one.indexOf('comicUrl') > -1) { // 下一页 URL 前半部分
  2358. comicUrl = one.split('"')[1];
  2359. } else if (one.indexOf('nextChapterData') > -1) { // 下一页 URL 的后半部分 ID
  2360. nextId = one.split('"id":')[1].split(',')[0];
  2361. }
  2362. })
  2363. if (comicUrl && nextId && nextId != 'null') { // 组合到一起就是下一页 URL
  2364. url = comicUrl + nextId + '.html'
  2365. if (url === curSite.pageUrl) return
  2366. curSite.pageUrl = url
  2367. getPageE_(curSite.pageUrl); // 访问下一页 URL 获取
  2368. }
  2369. }
  2370. }
  2371. // [古风漫画网] 插入数据
  2372. function gufengmh_insertE(pageE, type) {
  2373. if (pageE) {
  2374. let url = curSite.pageUrl;
  2375. pageE = getOne(curSite.pager.pageE, pageE, pageE);
  2376. let chapterImages, chapterPath;
  2377. getOne(curSite.pager.pageE).innerText = pageE.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL
  2378. pageE.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历
  2379. //console.log(one)
  2380. if (one.indexOf('chapterImages') > -1) { // 图片文件名数组
  2381. chapterImages = one.replace(/^.+\[/, '').replace(']', '').replaceAll('"', '').split(',')
  2382. } else if (one.indexOf('chapterPath') > -1) { // 图片文件路径
  2383. chapterPath = one.split('"')[1];
  2384. } else if (one.indexOf('pageTitle') > -1) { // 网页标题
  2385. addHistory(pageE, one.split('"')[1]);
  2386. }
  2387. })
  2388. if (chapterImages && chapterPath) {
  2389. let _img = '';
  2390. chapterImages.forEach(function (one2){_img += '<img src="https://res.xiaoqinre.com/' + chapterPath + one2 + '" data-index="0" style="display: inline-block;">';})
  2391. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2392. pageNum.now = pageNum._now + 1
  2393. }
  2394. }
  2395. }
  2396.  
  2397.  
  2398. // [Mangabz 漫画] 初始化(调整本话图片)
  2399. function mangabz_init() {
  2400. let showimage = getCSS('#showimage'),
  2401. cp_img = getCSS('#cp_img'),
  2402. cp_image = getCSS('#cp_image');
  2403. if (showimage) {showimage.removeAttribute('oncontextmenu');}
  2404. if (cp_img) {cp_img.removeAttribute('oncontextmenu');}
  2405. if (cp_image) {
  2406. cp_image.removeAttribute('oncontextmenu');
  2407. cp_image.removeAttribute('id');
  2408. cp_image.removeAttribute('style');
  2409. }
  2410. }
  2411. // [Mangabz 漫画] 获取下一页地址
  2412. function mangabz_nextL() {
  2413. var url = '';
  2414. if (MANGABZ_PAGE === MANGABZ_IMAGE_COUNT) { // 下一话
  2415. if (getNextE('//a[./img[contains(@src, "icon_xiayizhang")]]')) getPageE_(curSite.pageUrl); // 访问下一话 URL 获取
  2416. } else { // 下一页
  2417. if (!mkey) var mkey = '';
  2418. 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}`
  2419. if (url === curSite.pageUrl) return
  2420. curSite.pageUrl = url
  2421. //console.log(curSite.pageUrl)
  2422. getPageE_(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取
  2423. }
  2424. }
  2425. // [Mangabz 漫画] 插入数据
  2426. function mangabz_insertE(pageE, type) {
  2427. if (pageE) {
  2428. if (type === 'Next') { // 下一页
  2429. let imgArr = eval(pageE),
  2430. _img = '';
  2431. for (let now of imgArr) {_img += `<img src="${now}">`;}
  2432. if (_img) {
  2433. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2434. MANGABZ_PAGE += imgArr.length;
  2435. addHistory(pageE, document.title, location.origin + MANGABZ_CURL.substring(0, MANGABZ_CURL.length - 1) + '-p' + MANGABZ_PAGE + '/');
  2436. }
  2437. } else { // 下一话
  2438. // 插入 <script> 标签
  2439. insScript('html:not([dir]) > head > script:not([src])', pageE);
  2440. addHistory(pageE);
  2441. pageNum.now = pageNum._now + 1
  2442. replaceElems(pageE)
  2443. MANGABZ_PAGE = 0;
  2444. mangabz_nextL();
  2445. }
  2446. }
  2447. }
  2448.  
  2449.  
  2450. // [动漫屋] 获取下一页地址
  2451. function dm5_nextL() {
  2452. var url = '';
  2453. if (DM5_PAGE === DM5_IMAGE_COUNT) { // 下一话
  2454. if (getNextE('//div[@class="view-paging"]//a[text()="下一章"]')) getPageE_(curSite.pageUrl); // 访问下一话 URL 获取
  2455. } else { // 下一页
  2456. if (!mkey) var mkey = '';
  2457. 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}`
  2458. if (url === curSite.pageUrl) return
  2459. curSite.pageUrl = url
  2460. //console.log(curSite.pageUrl)
  2461. getPageE_(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取
  2462. }
  2463. }
  2464. // [动漫屋] 插入数据
  2465. function dm5_insertE(pageE, type) {
  2466. if (pageE) {
  2467. if (type === 'Next') { // 下一页
  2468. let imgArr = eval(pageE),
  2469. _img = '';
  2470. for (let now of imgArr) {_img += `<img src="${now}">`;}
  2471. if (_img) {
  2472. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2473. DM5_PAGE += imgArr.length;
  2474. addHistory(pageE, document.title, location.origin + DM5_CURL.substring(0, DM5_CURL.length - 1) + '-p' + DM5_PAGE + '/');
  2475. }
  2476. } else { // 下一话
  2477. // 插入 <script> 标签
  2478. insScript('html:not([dir]) > head > script:not([src])', pageE);
  2479. addHistory(pageE);
  2480. pageNum.now = pageNum._now + 1
  2481. replaceElems(pageE)
  2482. DM5_PAGE = 0;
  2483. dm5_nextL();
  2484. }
  2485. }
  2486. }
  2487.  
  2488.  
  2489. // [Xmanhua 漫画] 获取下一页地址
  2490. function xmanhua_nextL() {
  2491. var url = '';
  2492. if (XMANHUA_PAGE === XMANHUA_IMAGE_COUNT) { // 下一话
  2493. if (getNextE('//a[./img[contains(@src, "reader-bottom-right-2.png")]]')) getPageE_(curSite.pageUrl); // 访问下一话 URL 获取
  2494. } else { // 下一页
  2495. if (!mkey) var mkey = '';
  2496. 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}`
  2497. if (url === curSite.pageUrl) return
  2498. curSite.pageUrl = url
  2499. //console.log(curSite.pageUrl)
  2500. getPageE_(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取
  2501. }
  2502. }
  2503. // [Xmanhua 漫画] 插入数据
  2504. function xmanhua_insertE(pageE, type) {
  2505. if (pageE) {
  2506. if (type === 'Next') { // 下一页
  2507. let imgArr = eval(pageE),
  2508. _img = '';
  2509. for (let now of imgArr) {_img += `<img src="${now}">`;}
  2510. if (_img) {
  2511. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2512. XMANHUA_PAGE += imgArr.length;
  2513. addHistory(pageE, document.title, location.origin + XMANHUA_CURL.substring(0, XMANHUA_CURL.length - 1) + '-p' + XMANHUA_PAGE + '/');
  2514. }
  2515. } else { // 下一话
  2516. // 插入 <script> 标签
  2517. insScript('html:not([dir]) > head > script:not([src])', pageE);
  2518. addHistory(pageE);
  2519. pageNum.now = pageNum._now + 1
  2520. replaceElems(pageE)
  2521. XMANHUA_PAGE = 0;
  2522. xmanhua_nextL();
  2523. }
  2524. }
  2525. }
  2526.  
  2527.  
  2528. // [COCOMANGA 漫画] 初始化(调整本话图片)
  2529. function cocomanga_init() {
  2530. let last = getCSS('.mh_comicpic:last-of-type');
  2531. if (last && last.getAttribute('p')) {
  2532. getOne(curSite.pager.insertP[0]).innerHTML = ''; // 删除旧图片元素
  2533. cocomanga_img(parseInt(last.getAttribute('p'))) // 插入新图片元素
  2534. }
  2535. }
  2536. // [COCOMANGA 漫画] 生成图片元素并插入网页
  2537. function cocomanga_img(totalImageCount) {
  2538. if (totalImageCount < 1) return
  2539. let _img = '';
  2540. for (let i=1; i<=totalImageCount; i++) {_img += `<div class="mh_comicpic" p="${i}"><img src="${__cr.getPicUrl(i)}"></div>`;}
  2541. getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
  2542. }
  2543. // [COCOMANGA 漫画] 插入数据
  2544. function cocomanga_insertE(pageE, type) {
  2545. if (pageE) {
  2546. // 插入 <script> 标签
  2547. insScript('head > script:not([src]), script[src*="custom.js"], script[src*="dynamicjs.js"]', pageE);
  2548.  
  2549. // 插入新图片元素
  2550. setTimeout(function() {
  2551. let totalImageCount = __cdecrypt('fw122587mkertyui', CryptoJS.enc.Base64.parse(mh_info.enc_code1).toString(CryptoJS.enc.Utf8));
  2552. if (!totalImageCount) totalImageCount = __cdecrypt('fw12558899ertyui', CryptoJS.enc.Base64.parse(mh_info.enc_code1).toString(CryptoJS.enc.Utf8));
  2553. cocomanga_img(parseInt(totalImageCount));
  2554. }, 100)
  2555. addHistory(pageE);
  2556. pageNum.now = pageNum._now + 1
  2557. replaceElems(pageE)
  2558. }
  2559. }
  2560.  
  2561.  
  2562. // [国家自然科学基金] 获取下一页地址
  2563. function nsfc_nextL() {
  2564. let id = decodeURIComponent(document.location.href.split('/')[document.location.href.split('/').length - 1]), data
  2565. if (!document.nowPageNum) document.nowPageNum = 2
  2566. data = `id=${id}&index=${document.nowPageNum}`
  2567. if (data === curSite.pageUrl) return
  2568. curSite.pageUrl = data
  2569. getPageE_(location.origin + '/baseQuery/data/completeProjectReport', 'json', 'POST', data); // 访问下一页 URL 获取
  2570. }
  2571. // [国家自然科学基金] 插入数据
  2572. function nsfc_insertE(pageE, type) {
  2573. if (!pageE || pageE.code != 200) {curSite.SiteTypeID = 0; return}
  2574. if (!pageE.data.hasnext) {curSite.SiteTypeID = 0} else {document.nowPageNum++}
  2575. pageNum.now = pageNum._now + 1
  2576. 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}">`);
  2577. }
  2578.  
  2579.  
  2580.  
  2581. // [酷科研] 获取下一页地址
  2582. function coolkeyan_nextL() {
  2583. if (!getCSS('.q-img__image')) return
  2584. let id = getCSS('.q-breadcrumbs--last > span.q-breadcrumbs__el'), data
  2585. if (id && id.textContent) {id=parseInt(id.textContent)} else {return}
  2586. if (!document.nowPageNum) document.nowPageNum = 2
  2587. data = `ratify_no=${id}&index=${document.nowPageNum}`
  2588. if (data === curSite.pageUrl) return
  2589. curSite.pageUrl = data
  2590. getPageE_(location.origin + '/api/funds/nsfc/creport?' + data, 'json', 'GET'); // 访问下一页 URL 获取
  2591. }
  2592. // [酷科研] 插入数据
  2593. function coolkeyan_insertE(pageE, type) {
  2594. if (!pageE || pageE == {}) {curSite.SiteTypeID = 0; return}
  2595. if (!pageE.url) {curSite.SiteTypeID = 0; return} else {document.nowPageNum++}
  2596. pageNum.now = pageNum._now + 1
  2597. getCSS('.q-img>div[style*="padding-bottom"]').style.paddingBottom = `${(document.nowPageNum * 1000) - 1000}px`
  2598. 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>`);
  2599. }
  2600.  
  2601.  
  2602. // --------------------------------------------------------
  2603.  
  2604.  
  2605. // 自动无缝翻页
  2606. function pageLoading() {
  2607. if (curSite.SiteTypeID === 0 || !curSite.pager) return
  2608. if (curSite.pager.type === undefined) curSite.pager.type = 1; // 默认翻页模式 1
  2609. if (curSite.pager.scrollD === undefined) curSite.pager.scrollD = 1500; // 默认翻页触发线 1500
  2610. if (curSite.pager.interval === undefined) curSite.pager.interval = 500; // 默认间隔时间 500ms
  2611. //console.log(curSite)
  2612. curSite.pageUrl = ''; // 下一页URL
  2613. windowScroll(function (direction, e) {
  2614. // 下滑 且 未暂停翻页 且 SiteTypeID > 0 时,才准备翻页
  2615. if (direction != 'down' || !pausePage || curSite.SiteTypeID == 0) return
  2616.  
  2617. // 翻页模式 5 且为框架内时,要判断顶层是否通过页码暂停翻页了
  2618. if (curSite.pager.type == 5 && self != top && window.top.document.xiu_pausePage == false) return
  2619.  
  2620. let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
  2621. scrollHeight = window.innerHeight || document.documentElement.clientHeight,
  2622. scrollD = curSite.pager.scrollD;
  2623. // <<<<< 翻页类型 3(依靠 [基准元素] 与 [浏览器可视区域底部] 之间的距离缩小来触发翻页)>>>>>
  2624. if (curSite.pager.type === 3) {
  2625. if (!curSite.pager.scrollE) curSite.pager.scrollE = curSite.pager.replaceE; // 默认基准元素是页码
  2626. let scrollE = getOne(curSite.pager.scrollE);
  2627. //console.log(scrollE.offsetTop, scrollE.offsetTop - (scrollTop + scrollHeight), scrollD, scrollTop + scrollHeight, curSite.SiteTypeID)
  2628. if (scrollE.offsetTop - (scrollTop + scrollHeight) <= scrollD) {intervalPause(); checkURL(getPageE);}
  2629.  
  2630. } else if (document.documentElement.scrollHeight <= scrollHeight + scrollTop + scrollD) {
  2631. // <<<<< 翻页类型 1(由脚本实现自动无缝翻页)>>>>>
  2632. if (curSite.pager.type === 1) {
  2633. intervalPause(); checkURL(getPageE);
  2634.  
  2635. // <<<<< 翻页类型 2(网站自带了自动无缝翻页功能,只需要点击下一页按钮即可)>>>>>
  2636. } else if (curSite.pager.type === 2) {
  2637. let autopbn = getOne(curSite.pager.nextL);
  2638. if (!autopbn) return
  2639. if (curSite.pager.isHidden && isHidden(autopbn)) return // 如果 isHidden = true,那么需要判断元素是否隐藏
  2640. if (curSite.pager.nextText) {
  2641. //console.log(curSite.pager.nextText, autopbn.innerText, autopbn)
  2642. // 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页
  2643. if (autopbn.innerText === curSite.pager.nextText) {autopbn.click(); pageNum.now = pageNum._now + 1;}
  2644. } else if (curSite.pager.nextTextOf) {
  2645. // 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页
  2646. if (autopbn.innerText.indexOf(curSite.pager.nextTextOf) > -1) {autopbn.click(); pageNum.now = pageNum._now + 1;}
  2647. } else if (curSite.pager.nextHTML) {
  2648. // 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页
  2649. if (autopbn.innerHTML === curSite.pager.nextHTML) {autopbn.click(); pageNum.now = pageNum._now + 1;}
  2650. } else {
  2651. intervalPause();
  2652. // 如果没有指定按钮文字就直接点击
  2653. autopbn.click(); pageNum.now = pageNum._now + 1;
  2654. }
  2655.  
  2656. // <<<<< 翻页类型 4(部分简单的动态加载类网站)>>>>>
  2657. } else if (curSite.pager.type === 4) {
  2658. // 为百度贴吧的发帖考虑,预留底部一小部分...
  2659. if (!(curSite.SiteTypeID === SiteType.BAIDU_TIEBA && document.documentElement.scrollHeight <= scrollHeight + scrollTop + 200)) {
  2660. intervalPause(); if (typeof curSite.pager.nextL == 'function') {curSite.pager.nextL();} else if (getNextE(curSite.pager.nextL)) {getPageE_(curSite.pageUrl);}
  2661. }
  2662.  
  2663. // <<<<< 翻页类型 5(插入 iframe 方式来加载下一页)>>>>>
  2664. } else if (curSite.pager.type === 5) {
  2665. checkURL(insIframe);
  2666.  
  2667. // <<<<< 翻页类型 6(通过 iframe 获取下一页动态加载内容)>>>>>
  2668. } else if (curSite.pager.type === 6) {checkURL(insIframe_);}
  2669. }
  2670. });
  2671.  
  2672. function intervalPause() {
  2673. if (curSite.pager.interval) {
  2674. pausePage = false
  2675. setTimeout(function(){pausePage = true;}, curSite.pager.interval)
  2676. }
  2677. }
  2678. }
  2679.  
  2680. // 翻页类型 1/3
  2681. function getPageE(url) {
  2682. GM_xmlhttpRequest({
  2683. url: url,
  2684. method: 'GET',
  2685. overrideMimeType: 'text/html; charset=' + document.charset,
  2686. headers: {
  2687. 'Referer': (curSite.noReferer === true) ? '':location.href,
  2688. 'User-Agent': navigator.userAgent
  2689. },
  2690. timeout: 10000,
  2691. onload: function (response) {
  2692. try {
  2693. //console.log('URL:' + url, '最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  2694. processElems(createDocumentByString(response.responseText));
  2695. } catch (e) {
  2696. console.error('[自动无缝翻页] - 处理获取到的下一页内容时出现问题,请检查!', e);
  2697. }
  2698. },
  2699. onerror: function (response) {
  2700. console.log('URL:' + url, response)
  2701. GM_notification({text: '❌ 获取下一页失败...', timeout: 5000});
  2702. },
  2703. ontimeout: function (response) {
  2704. setTimeout(function(){curSite.pageUrl = '';}, 3000)
  2705. console.log('URL:' + url, response)
  2706. GM_notification({text: '❌ 获取下一页超时,可 3 秒后再次滚动网页重试(或尝试刷新网页)...', timeout: 5000});
  2707. }
  2708. });
  2709. }
  2710. // 翻页类型 4
  2711. function getPageE_(url, type = '', method = 'GET', data = '', type2) {
  2712. let mimeType;
  2713. switch (type) {
  2714. case 'json':
  2715. mimeType = 'application/json; charset=' + document.charset; break;
  2716. case 'text':
  2717. mimeType = 'text/plain; charset=' + document.charset; break;
  2718. default:
  2719. mimeType = 'text/html; charset=' + document.charset;
  2720. }
  2721.  
  2722. GM_xmlhttpRequest({
  2723. url: url,
  2724. method: method,
  2725. data: data,
  2726. responseType: type,
  2727. overrideMimeType: mimeType,
  2728. headers: {
  2729. 'Referer': (curSite.noReferer === true) ? '':location.href,
  2730. 'Content-Type': (method === 'POST') ? 'application/x-www-form-urlencoded':'',
  2731. 'User-Agent': navigator.userAgent
  2732. },
  2733. timeout: 10000,
  2734. onload: function (response) {
  2735. try {
  2736. //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  2737. switch (type) {
  2738. case 'json':
  2739. curSite.pager.insertE(response.response, type2);
  2740. break;
  2741. case 'text':
  2742. curSite.pager.insertE(response.responseText, type2)
  2743. break;
  2744. default:
  2745. curSite.pager.insertE(createDocumentByString(response.responseText), type2)
  2746. }
  2747. } catch (e) {
  2748. console.log(e);
  2749. }
  2750. },
  2751. onerror: function (response) {
  2752. console.log('URL:' + url, response)
  2753. GM_notification({text: '❌ 获取下一页失败...', timeout: 5000});
  2754. },
  2755. ontimeout: function (response) {
  2756. setTimeout(function(){curSite.pageUrl = '';}, 3000)
  2757. console.log('URL:' + url, response)
  2758. GM_notification({text: '❌ 获取下一页超时,可 3 秒后再次滚动网页重试(或尝试刷新网页)...', timeout: 5000});
  2759. }
  2760. });
  2761. }
  2762. // 翻页类型 5(插入 iframe 方式加载下一页,无限套娃)
  2763. function insIframe(src) {
  2764. // 停用当前页面翻页
  2765. if (curSite.SiteTypeID == 0) return
  2766. curSite.SiteTypeID = 0;
  2767.  
  2768. // 创建 iframe
  2769. let iframe = document.createElement('iframe');
  2770. iframe.style = 'position: absolute; width: 100%; height: 100%; border: none;';
  2771. iframe.id = 'Autopage_iframe';
  2772. iframe.src = src;
  2773.  
  2774. var beforeScrollTop = document.documentElement.scrollTop || document.body.scrollTop
  2775. // 当滚动条到底部时(即完全显示 iframe 框架),隐藏当前页面的滚动条
  2776. window.addEventListener('scroll', function () {
  2777. let scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  2778. clientHeight = document.documentElement.clientHeight || document.body.clientHeight,
  2779. scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight,
  2780. afterScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  2781. delta = afterScrollTop - beforeScrollTop;
  2782. if (delta == 0) return false;
  2783. beforeScrollTop = afterScrollTop;
  2784.  
  2785. //console.log(delta, (scrollTop + clientHeight + 10), scrollHeight, '1111')
  2786. if (delta > 0 && scrollTop + clientHeight + 10 >= scrollHeight && !getCSS('#Autopage_iframe-scroll')) {
  2787. let newStyle = document.createElement('style'); newStyle.id = 'Autopage_iframe-scroll';
  2788. newStyle.textContent = 'html::-webkit-scrollbar, body::-webkit-scrollbar {width: 0 !important;height: 0 !important;} html, body {scrollbar-width: none !important;}';
  2789. if (curSite.pager.style) newStyle.textContent += curSite.pager.style;
  2790. document.documentElement.appendChild(newStyle);
  2791.  
  2792. // 恢复 iframe 的滚动条
  2793. if (iframe.contentWindow.document.querySelector('#Autopage_iframe-scroll-hidden')) iframe.contentWindow.document.querySelector('#Autopage_iframe-scroll-hidden').remove();
  2794.  
  2795. // 给予 iframe 焦点
  2796. iframe.focus();
  2797. if (iframe.contentWindow.document.body) {iframe.contentWindow.document.body.focus(); iframe.contentWindow.document.body.click();}
  2798. } else if (delta < 0 && scrollTop + clientHeight + 10 <= scrollHeight && getCSS('#Autopage_iframe-scroll')) {
  2799. getCSS('#Autopage_iframe-scroll').remove();
  2800.  
  2801. // 再次禁用 iframe 的滚动条
  2802. let newStyle = document.createElement('style'); newStyle.id = 'Autopage_iframe-scroll-hidden';
  2803. newStyle.textContent = 'html, body {overflow: hidden !important;}';
  2804. iframe.contentWindow.document.documentElement.appendChild(newStyle);
  2805. }
  2806. }, false);
  2807.  
  2808. // 加载完成后才继续
  2809. iframe.onload = function() {
  2810. // 暂时禁用 iframe 的滚动条
  2811. let newStyle = document.createElement('style'); newStyle.id = 'Autopage_iframe-scroll-hidden';
  2812. newStyle.textContent = 'html, body {overflow: hidden !important;}';
  2813. iframe.contentWindow.document.documentElement.appendChild(newStyle);
  2814.  
  2815. // 添加历史记录
  2816. if (curSite.history === undefined) {
  2817. if (GM_getValue('menu_history', true)) addHistory(iframe.contentWindow.document, iframe.contentWindow.document.title);
  2818. } else {
  2819. if (curSite.history) addHistory(iframe.contentWindow.document, iframe.contentWindow.document.title);
  2820. }
  2821. // 当前页码 + 1
  2822. if (!curSite.hiddenPN) {
  2823. let autopageNumber = getCSS('#Autopage_number', window.top.document)
  2824. if (autopageNumber) {autopageNumber.textContent = parseInt(autopageNumber.textContent) + 1;}
  2825. }
  2826. }
  2827.  
  2828. // 插入 iframe
  2829. document.documentElement.appendChild(iframe);
  2830. }
  2831. // 翻页类型 6(通过 iframe 获取下一页动态加载内容,只有一个娃)
  2832. function insIframe_(src) {
  2833. // 暂停翻页
  2834. if (!pausePage) return
  2835. pausePage = false
  2836. //console.log(src)
  2837. // 如果不存在,则创建一个 iframe
  2838. let iframe = document.getElementById('Autopage_iframe');
  2839. if (!iframe) {
  2840. iframe = document.createElement('iframe');
  2841. iframe.style = 'position: absolute; top: -9999px; left: -9999px; width: 100%; height: 100%; border: none; z-index: -999; /*visibility: hidden;*/';
  2842. //iframe.sandbox = 'allow-same-origin allow-scripts allow-popups allow-forms';
  2843. iframe.id = 'Autopage_iframe';
  2844. iframe.src = src;
  2845. }
  2846.  
  2847. // 加载完成后才继续
  2848. iframe.onload = function() {
  2849. //iframe.contentWindow.scrollTo(0, 999999); // 滚动到底部,以触发网页的滚动条相关加载事件
  2850. //iframe.contentWindow.scrollTo({top: 9999999, behavior: 'smooth'});
  2851. if (!curSite.pager.loadTime) curSite.pager.loadTime = 100; // 默认 100ms
  2852. //console.log(curSite.pager.loadTime, curSite.pager.loadTime/30)
  2853. //console.time('sort');
  2854. let time1 = 0 ,time2 = setInterval(function(){
  2855. let scrollHeight = (iframe.contentWindow.document.documentElement.scrollHeight || iframe.contentWindow.document.body.scrollHeight)/10
  2856. iframe.contentWindow.scrollTo(0, 999999);
  2857. iframe.contentWindow.scrollTo(0, scrollHeight*time1);
  2858. //console.log(time1, iframe.contentWindow.document.documentElement.scrollHeight || iframe.contentWindow.document.body.scrollHeight)
  2859. if (++time1 == 10) {
  2860. //console.timeEnd('sort');
  2861. clearInterval(time2);
  2862. processElems(iframe.contentWindow.document); // 插入/替换元素等
  2863. //console.log(iframe.contentWindow.document.documentElement.scrollHeight || iframe.contentWindow.document.body.scrollHeight)
  2864. pausePage = true; // 恢复翻页
  2865. }
  2866. }, curSite.pager.loadTime/10)
  2867. }
  2868.  
  2869. // 插入 iframe(如果已存在则直接改 src)
  2870. if (document.getElementById('Autopage_iframe')) {
  2871. iframe.src = src;
  2872. } else {
  2873. document.documentElement.appendChild(iframe);
  2874. }
  2875. }
  2876.  
  2877.  
  2878. // XHR 后处理结果,插入、替换元素等(适用于翻页类型 1/3/6)
  2879. function processElems(response) {
  2880. if (!curSite.pager.insertP) {curSite.pager.insertP = [curSite.pager.pageE, 5]}
  2881. let pageE = getAll(curSite.pager.pageE, response, response), toE;
  2882. if (curSite.pager.insertP[1] === 5) { // 插入 pageE 列表最后一个元素的后面
  2883. toE = toE5pop(getAll(curSite.pager.insertP[0]));
  2884. } else {
  2885. toE = getOne(curSite.pager.insertP[0]);
  2886. }
  2887. //console.log(curSite.pager.pageE, pageE, curSite.pager.insertP, toE)
  2888.  
  2889. if (pageE.length > 0 && toE) {
  2890. // 如果有插入前函数就执行函数
  2891. if (curSite.function && curSite.function.bF) {
  2892. if (curSite.function.bFp) { // 如果指定了参数
  2893. if (typeof(curSite.function.bF) == 'string') { // 如果是字符串,说明是自定义规则
  2894. pageE = new Function('pageE', 'bFp', 'fun', curSite.function.bF)(pageE, curSite.function.bFp, window.autoPage)
  2895. } else {
  2896. pageE = curSite.function.bF(pageE, curSite.function.bFp);
  2897. }
  2898. } else {
  2899. if (typeof(curSite.function.bF) == 'string') { // 如果是字符串,说明是自定义规则
  2900. pageE = new Function('pageE', 'fun', curSite.function.bF)(pageE, window.autoPage)
  2901. } else {
  2902. pageE = curSite.function.bF(pageE);
  2903. }
  2904. }
  2905. }
  2906.  
  2907. // 插入位置
  2908. let addTo = getAddTo(curSite.pager.insertP[1]);
  2909.  
  2910. // 插入新页面元素
  2911. if (curSite.pager.insertP[1] === 6) { // 插入到目标内部末尾(针对文本,比如小说网页)
  2912. let afterend = '';
  2913. if (curSite.pager.insertP6Br) afterend += '<br/><br/>'
  2914. pageE.forEach(function (one) {afterend += one.innerHTML;});
  2915. toE.insertAdjacentHTML(addTo, afterend);
  2916. } else {
  2917. if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 插入到 [元素内头部]、[目标本身后面] 时,需要反转顺序
  2918. pageE.forEach(function (one) {toE.insertAdjacentElement(addTo, one);});
  2919. }
  2920.  
  2921. // 当前页码 + 1
  2922. pageNum.now = pageNum._now + 1
  2923.  
  2924. // 添加历史记录
  2925. if (curSite.history === undefined) {
  2926. if (GM_getValue('menu_history', true)) addHistory(response);
  2927. } else {
  2928. if (curSite.history) addHistory(response);
  2929. }
  2930.  
  2931. // 替换待替换元素
  2932. if (curSite.pager.replaceE) replaceElems(response);
  2933.  
  2934. // 插入 <script> 标签
  2935. if (curSite.pager.scriptT || curSite.pager.scriptT == 0) {
  2936. switch (curSite.pager.scriptT) {
  2937. case 0: // 下一页的所有 <script> 标签
  2938. insScript('script', response); break;
  2939. case 1: // 下一页的所有 <script> 标签(不包括 src 链接)
  2940. insScript('script:not([src])', response); break;
  2941. case 2: // 下一页主体元素 (pageE) 的同级 <script> 标签
  2942. if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 为了避免 JS 执行顺序反了,还需要再给反转回去
  2943. insScript(null, pageE); break;
  2944. case 3: // 下一页主体元素 (pageE) 的子元素 <script> 标签
  2945. if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 为了避免 JS 执行顺序反了,还需要再给反转回去
  2946. insScript('script:not([src])', pageE); break;
  2947. }
  2948. }
  2949.  
  2950. // 如果有插入后函数就执行函数
  2951. if (curSite.function && curSite.function.aF) {
  2952. if (curSite.function.aFp) { // 如果指定了参数
  2953. if (typeof(curSite.function.aF) == 'string') { // 如果是字符串,说明是自定义规则
  2954. new Function('aFp', 'fun', curSite.function.aF)(curSite.function.aFp, window.autoPage)
  2955. } else {
  2956. curSite.function.aF(curSite.function.aFp);
  2957. }
  2958. } else {
  2959. if (typeof(curSite.function.aF) == 'string') { // 如果是字符串,说明是自定义规则
  2960. new Function('fun', curSite.function.aF)(window.autoPage);
  2961. } else {
  2962. curSite.function.aF();
  2963. }
  2964. }
  2965. }
  2966. } else { // 获取主体元素失败后,尝试重新获取
  2967. console.log(curSite.pager.pageE, pageE, curSite.pager.insertP, toE)
  2968. if (curSite.retry) {
  2969. console.warn('[自动无缝翻页] 获取主体元素失败,尝试重新获取...')
  2970. setTimeout(function(){curSite.pageUrl = '';}, curSite.retry)
  2971. } else {
  2972. console.error('[自动无缝翻页] 获取主体元素失败...')
  2973. // 尝试替换元素看能不能继续翻页下去
  2974. /*if (curSite.pager.replaceE) {
  2975. if (replaceElems(response)) { // 如果替换成功
  2976. console.log('[自动无缝翻页] 获取主体元素失败,尝试替换元素成功!')
  2977. // 当前页码 + 1
  2978. pageNum.now = pageNum._now + 1;
  2979. // 添加历史记录
  2980. if (curSite.history === undefined) {
  2981. if (GM_getValue('menu_history', true)) addHistory(response);
  2982. } else {
  2983. if (curSite.history) addHistory(response);
  2984. }
  2985. } else {console.error('[自动无缝翻页] 获取主体元素失败,尝试替换元素失败...')}
  2986. }*/
  2987. }
  2988. }
  2989. }
  2990. // 通用型插入前函数(加载图片)
  2991. function src_bF(pageE, css) {
  2992. pageE.forEach(function (one) {
  2993. if (css[0] == 0) { // src 图片
  2994. if (one.tagName == 'IMG' && one.getAttribute(css[2])) one.src = one.getAttribute(css[2]);
  2995. one.querySelectorAll(css[1]).forEach(function (now) {
  2996. now.src = now.getAttribute(css[2]);
  2997. });
  2998. } else if (css[0] == 1) { // 背景图片
  2999. if (one.tagName == 'IMG' && one.getAttribute(css[2])) one.style.backgroundImage = 'url("' + one.getAttribute(css[2]) + '")';
  3000. one.querySelectorAll(css[1]).forEach(function (now) {
  3001. now.style.backgroundImage = 'url("' + now.getAttribute(css[2]) + '")';
  3002. });
  3003. }
  3004. });
  3005. return pageE
  3006. }
  3007. // 文字型插入前函数(正则过滤)
  3008. function xs_bF(pageE, reg) {
  3009. pageE.forEach(function (one) {one.innerHTML = one.innerHTML.replace(reg[0], reg[1])});
  3010. return pageE
  3011. }
  3012.  
  3013. // 通用型获取下一页地址(从 元素 中获取页码)
  3014. function getNextE(css) {
  3015. if (!css) css = curSite.pager.nextL;
  3016. let next = getOne(css);
  3017. if (next && next.nodeType === 1 && next.href && next.href.slice(0,4) === 'http' && next.getAttribute('href').slice(0,1) !== '#') {
  3018. if (next.href != curSite.pageUrl) {
  3019. if (curSite.pager.forceHTTPS && location.protocol === 'https:') {
  3020. if (next.href.replace(/^http:/,'https:') === curSite.pageUrl) {
  3021. return false
  3022. }
  3023. curSite.pageUrl = next.href.replace(/^http:/,'https:');
  3024. } else {
  3025. curSite.pageUrl = next.href;
  3026. }
  3027. } else {
  3028. return false
  3029. }
  3030. //console.log(curSite.pageUrl)
  3031. return true
  3032. }
  3033. return false
  3034. }
  3035. // 通用型获取下一页地址(从 元素 中获取页码,URL 替换 page= 参数)
  3036. function getNextEP(css, pf, reg) {
  3037. let nextNum = getOne(css), url = '';
  3038. if (nextNum && nextNum.textContent) {
  3039. nextNum = nextNum.textContent.replaceAll(' ','');
  3040. if (location.search) {
  3041. if (indexOF(pf, 's')) {
  3042. url = location.search.replace(reg, pf + nextNum);
  3043. } else {
  3044. url = location.search + '&' + pf + nextNum;
  3045. }
  3046. } else {
  3047. url = '?' + pf + nextNum;
  3048. }
  3049. url = location.origin + location.pathname + url;
  3050. }
  3051. return url
  3052. }
  3053. // 通用型获取下一页地址(从 元素 中获取页码,URL 替换 pathname 路径)
  3054. function getNextEPN(css, reg, a, b = '') {
  3055. let nextNum = getOne(css), url = '';
  3056. if (nextNum && nextNum.textContent) {
  3057. nextNum = nextNum.textContent.replaceAll(' ','');
  3058. if (location.pathname) {
  3059. if (indexOF(reg)) {
  3060. url = location.pathname.replace(reg, a + nextNum + b);
  3061. } else {
  3062. url = location.pathname + a + nextNum + b;
  3063. }
  3064. } else {
  3065. url = location.pathname + a + nextNum + b;
  3066. }
  3067. url = location.origin + url + location.search;
  3068. }
  3069. return url
  3070. }
  3071. // 通用型获取下一页地址(从 URL 中获取页码,URL 替换 pathname 路径)
  3072. function getNextUPN(urlReg, reg, a, b = '', initP = '2', endP) {
  3073. let nextNum = urlReg.exec(location.pathname);
  3074. if (nextNum) {
  3075. nextNum = String(parseInt(nextNum[0])+1);
  3076. if (endP && (parseInt(nextNum) > parseInt(endP))) return ''
  3077. } else {
  3078. nextNum = initP;
  3079. if (endP && (parseInt(nextNum) >= parseInt(endP))) return ''
  3080. }
  3081. let url = '';
  3082. if (location.pathname) {
  3083. if (indexOF(reg)) {
  3084. url = location.pathname.replace(reg, a + nextNum + b);
  3085. } else {
  3086. url = location.pathname + a + nextNum + b;
  3087. }
  3088. } else {
  3089. url = location.pathname + a + nextNum + b;
  3090. }
  3091. url = location.origin + url + location.search;
  3092. return url
  3093. }
  3094. // 通用型获取下一页地址(从 URL 中获取页码,URL 替换 page= 参数)
  3095. function getNextUP(pf, reg, lp = location.pathname, initP = '2', endP) {
  3096. let nextNum = getSearch(pf.replace('=',''));
  3097. if (nextNum) {
  3098. nextNum = String(parseInt(nextNum)+1);
  3099. if (endP && (parseInt(nextNum) > parseInt(endP))) return ''
  3100. } else {
  3101. nextNum = initP;
  3102. if (endP && (parseInt(nextNum) >= parseInt(endP))) return ''
  3103. }
  3104. let url = '';
  3105. if (location.search) {
  3106. if (indexOF(pf, 's')) {
  3107. url = location.search.replace(reg, pf + nextNum);
  3108. } else {
  3109. url = location.search + '&' + pf + nextNum;
  3110. }
  3111. } else {
  3112. url = '?' + pf + nextNum;
  3113. }
  3114. url = location.origin + lp + url;
  3115. return url
  3116. }
  3117. // 通用型获取下一页地址(从 form input 中获取,返回 GET URL)
  3118. function getNextF(css) {
  3119. let form = getOne(css), value = '';
  3120. if (form) {
  3121. form.querySelectorAll('input[name]').forEach(function(input) {value += input.name + '=' + input.value + '&';}) // 生成表单参数
  3122. value = encodeURI(value.replace(/&$/,'')); // 清理最后一个 & 符号
  3123. if (form.action && value) return (form.action + '?' + value)
  3124. }
  3125. return '';
  3126. }
  3127.  
  3128.  
  3129. // 检查 URL
  3130. function checkURL(func) {
  3131. if (!curSite.pager.nextL) return
  3132. if (typeof curSite.pager.nextL == 'function') {
  3133. let tempUrl = curSite.pager.nextL();
  3134. if (!tempUrl || tempUrl === curSite.pageUrl || tempUrl.slice(0,4) !== 'http') return
  3135. curSite.pageUrl = tempUrl;
  3136. func(curSite.pageUrl);
  3137. } else if (curSite.pager.nextL.search(/^js;/i) === 0) { // 自定义翻页规则中执行 JavaScript 代码的
  3138. try {
  3139. let tempUrl = new Function('fun', curSite.pager.nextL.slice(3))(window.autoPage);
  3140. if (!tempUrl || tempUrl === curSite.pageUrl || tempUrl.slice(0,4) !== 'http') return
  3141. curSite.pageUrl = tempUrl;
  3142. func(curSite.pageUrl);
  3143. } catch (e) {
  3144. console.error('[自动无缝翻页] - 当前网页规则 "nextL" 内 JS 代码有误,请检查!', e);
  3145. }
  3146. } else if (getNextE()) {
  3147. func(curSite.pageUrl);
  3148. }
  3149. //console.log(curSite.pageUrl);
  3150. }
  3151. // 替换元素
  3152. function replaceElems(pageE, o = curSite.pager.replaceE, r = curSite.pager.replaceE) {
  3153. let oE = getAll(o),
  3154. rE = getAll(r, pageE, pageE);
  3155. if (oE.length != 0 && rE.length != 0 && oE.length === rE.length) {
  3156. for (let i = 0; i < oE.length; i++) {
  3157. oE[i].outerHTML = rE[i].outerHTML;
  3158. }
  3159. return true
  3160. }
  3161. return false
  3162. }
  3163. // 添加历史记录
  3164. function addHistory(pageE, title, url) {
  3165. if (!curSite.pageUrl) return
  3166. // 对于自带类似功能 或者 覆盖了 history 原生函数的网站,则跳过不再添加历史记录
  3167. if (window.top.history.toString() !== '[object History]') return
  3168.  
  3169. title = title || (pageE.querySelector('title')) ? pageE.querySelector('title').textContent : window.top.document.title;
  3170. url = url || curSite.pageUrl;
  3171. window.top.document.Autopage_nowUrl = curSite.pageUrl;
  3172. // 对于下一页 URL 和当前网页 URL 的协议不同时,跳过
  3173. if (url.indexOf(window.top.location.protocol) === -1) return
  3174. window.top.history.pushState('Autopage_history', title, url);
  3175. window.top.document.title = title;
  3176. }
  3177. // 插入 <Script>
  3178. function insScript(selector, contextNode = document, toE = document.body) {
  3179. let scriptElems = contextNode;
  3180. if (selector) {
  3181. if (contextNode instanceof Array) {
  3182. scriptElems = []; contextNode.forEach(function (one) {scriptElems = scriptElems.concat(getAll(selector, one, one));})
  3183. } else {
  3184. scriptElems = getAll(selector, contextNode, contextNode);
  3185. }
  3186. }
  3187.  
  3188. scriptElems.forEach(function (one) {
  3189. if (one.tagName === 'SCRIPT') {
  3190. if (one.src) {
  3191. toE.appendChild(document.createElement('script')).src = one.src;
  3192. } else {
  3193. toE.appendChild(document.createElement('script')).textContent = one.textContent;//.replaceAll('document.write', '');
  3194. }
  3195. }
  3196. });
  3197. }
  3198. // 插入 <Style>
  3199. function insStyle(style) {
  3200. document.documentElement.appendChild(document.createElement('style')).textContent = style;
  3201. }
  3202.  
  3203.  
  3204. // 获取元素(CSS/Xpath)来自:https://github.com/machsix/Super-preloader
  3205. function getCSS(css, contextNode = document) {
  3206. return contextNode.querySelector(css);
  3207. }
  3208. function getAllCSS(css, contextNode = document) {
  3209. return [].slice.call(contextNode.querySelectorAll(css));
  3210. }
  3211. function getXpath(xpath, contextNode, doc = document) {
  3212. contextNode = contextNode || doc;
  3213. try {
  3214. const result = doc.evaluate(xpath, contextNode, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  3215. // 应该总是返回一个元素节点
  3216. return result.singleNodeValue && result.singleNodeValue.nodeType === 1 && result.singleNodeValue;
  3217. } catch (err) {
  3218. throw new Error(`无效 Xpath: ${xpath}`);
  3219. }
  3220. }
  3221. function getAllXpath(xpath, contextNode, doc = document) {
  3222. contextNode = contextNode || doc;
  3223. const result = [];
  3224. try {
  3225. const query = doc.evaluate(xpath, contextNode, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  3226. for (let i = 0; i < query.snapshotLength; i++) {
  3227. const node = query.snapshotItem(i);
  3228. // 如果是 Element 节点
  3229. if (node.nodeType === 1) result.push(node);
  3230. }
  3231. } catch (err) {
  3232. throw new Error(`无效 Xpath: ${xpath}`);
  3233. }
  3234. return result;
  3235. }
  3236. function getOne(selector, contextNode = undefined, doc = document) {
  3237. if (!selector) return;
  3238. contextNode = contextNode || doc;
  3239. if (selector.slice(0,1) === '/' || selector.slice(0,2) === './' || selector.slice(0,3) === 'id(') {
  3240. return getXpath(selector, contextNode, doc);
  3241. } else {
  3242. return getCSS(selector, contextNode);
  3243. }
  3244. }
  3245. function getAll(selector, contextNode = undefined, doc = document) {
  3246. if (!selector) return [];
  3247. contextNode = contextNode || doc;
  3248. if (selector.slice(0,1) === '/' || selector.slice(0,2) === './' || selector.slice(0,3) === 'id(') {
  3249. return getAllXpath(selector, contextNode, doc);
  3250. } else {
  3251. return getAllCSS(selector, contextNode);
  3252. }
  3253. }
  3254. function createDocumentByString(e) {
  3255. if (e) {
  3256. if ('HTML' !== document.documentElement.nodeName) return (new DOMParser).parseFromString(e, 'application/xhtml+xml');
  3257. var t;
  3258. try { t = (new DOMParser).parseFromString(e, 'text/html');} catch (e) {}
  3259. if (t) return t;
  3260. if (document.implementation.createHTMLDocument) {
  3261. t = document.implementation.createHTMLDocument('ADocument');
  3262. } else {
  3263. 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) {}
  3264. }
  3265. if (t) {
  3266. var r = document.createRange(),
  3267. n = r.createContextualFragment(e);
  3268. r.selectNodeContents(document.body);
  3269. t.body.appendChild(n);
  3270. 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);
  3271. return t;
  3272. }
  3273. } else console.error('没有找到要转成 DOM 的字符串');
  3274. }
  3275.  
  3276.  
  3277. // 强制新标签页打开链接
  3278. function forceTarget() {
  3279. // 过渡,过几个星期后删除这两个判断
  3280. if (curSite.forceTarget != undefined && curSite.blank == undefined) curSite.blank = curSite.forceTarget
  3281. if (curSite.blank === true) curSite.blank = 2
  3282. // 过渡,过几个星期后删除这两个判断
  3283.  
  3284. if (curSite.blank === 1) {
  3285. document.head.appendChild(document.createElement('base')).target = '_blank';
  3286.  
  3287. } else {
  3288. let d;
  3289. if (curSite.blank === 2) {
  3290. d = document.body
  3291. } else if (curSite.blank === 3) {
  3292. let dd = toE5pop(getAll(curSite.pager.pageE));
  3293. if (dd && dd.parentElement != null) d = dd.parentElement
  3294. }
  3295. if (!d) return
  3296.  
  3297. function forceTarget_(target, e){
  3298. if (target.href && target.target != '_blank' && !(target.getAttribute('onclick')) && target.href.slice(0,4) == 'http' && target.getAttribute('href').slice(0,1) != '#') {
  3299. e.preventDefault(); // 阻止默认打开链接事件
  3300. window.GM_openInTab(target.href, {active: true,insert: true,setParent: true});
  3301. }
  3302. }
  3303. d.addEventListener('click', function(e) {
  3304. //console.log(e.target.tagName, e.path)
  3305. if (e.target.tagName === 'A') {
  3306. forceTarget_(e.target, e);
  3307. } else {
  3308. let path = e.path || e.composedPath();
  3309. for (let i = 1; i < path.length - 4; i++) {if (path[i].tagName === 'A') {forceTarget_(path[i], e); break;}}
  3310. }
  3311. });
  3312. }
  3313. }
  3314. // 判断元素是否隐藏(隐藏返回 true)
  3315. function isHidden(el){
  3316. return (el.offsetParent === null);
  3317. }
  3318. // 判断是否为手机版(是则返回 true)
  3319. function isMobile(){
  3320. 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));
  3321. }
  3322. // 用以自定义规则中设置 urlC = true
  3323. function isUrlC(){
  3324. urlC = true;
  3325. }
  3326. // 判断 URL 是否存在指定文本
  3327. function indexOF(e, l = 'p', low = true){
  3328. switch (l) {
  3329. case 'h':
  3330. l = location.href; break;
  3331. case 'p':
  3332. l = location.pathname; break;
  3333. case 's':
  3334. l = location.search; break;
  3335. }
  3336. //console.log(l,e,l.indexOf(e))
  3337. if (e instanceof RegExp) {
  3338. if (e.test(l)) return true
  3339. } else {
  3340. if (low) {e = e.toLowerCase(); l = l.toLowerCase();} // 全部转为小写(即不区分大小写)
  3341. if (l.indexOf(e) != -1) return true
  3342. }
  3343. return false
  3344. }
  3345. // 获取 Search 指定参数
  3346. function getSearch(variable) {
  3347. let query = window.location.search.substring(1),
  3348. vars = query.split('&');
  3349. for (var i=0;i<vars.length;i++) {
  3350. var pair = vars[i].split('=');
  3351. if(pair[0] == variable){return pair[1];}
  3352. }
  3353. return '';
  3354. }
  3355. // 启用/禁用 (当前网站)
  3356. function menu_disable(type) {
  3357. switch(type) {
  3358. case 'check':
  3359. return check(); break;
  3360. case 'add':
  3361. add(); break;
  3362. case 'del':
  3363. del(); break;
  3364. }
  3365.  
  3366. function check() { // 存在返回真,不存在返回假
  3367. if (GM_getValue('menu_disable').indexOf(location.hostname) == -1) return false // 不存在返回假
  3368. return true
  3369. }
  3370.  
  3371. function add() {
  3372. if (check()) return
  3373. let list = GM_getValue('menu_disable'); // 读取网站列表
  3374. list.push(location.hostname); // 追加网站域名
  3375. GM_setValue('menu_disable', list); // 写入配置
  3376. location.reload(); // 刷新网页
  3377. }
  3378.  
  3379. function del() {
  3380. if (!check()) return
  3381. let list = GM_getValue('menu_disable'), // 读取网站列表
  3382. index = list.indexOf(location.hostname);
  3383. list.splice(index, 1); // 删除网站域名
  3384. GM_setValue('menu_disable', list); // 写入配置
  3385. location.reload(); // 刷新网页
  3386. }
  3387. }
  3388. // 左键双击网页空白处暂停翻页
  3389. function pausePageEvent() {
  3390. if (!GM_getValue('menu_pause_page')) return
  3391. if (curSite.SiteTypeID === 0) return
  3392. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  3393. document.body.addEventListener('dblclick', function () {
  3394. if (pausePage) {GM_notification({text: `❌ 已暂停本页 [自动无缝翻页]\n (再次双击可恢复)`, timeout: 2000});} else {GM_notification({text: `✅ 已恢复本页 [自动无缝翻页]\n (再次双击可暂停)`, timeout: 2000});}
  3395. pausePage = !pausePage;
  3396. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  3397. });
  3398. }
  3399. // 自定义翻页规则
  3400. function customRules() {
  3401. if (getCSS('#Autopage_customRules')) return
  3402.  
  3403. let customRules = JSON.stringify(GM_getValue('menu_customRules', {}), null, '\t');
  3404. if (customRules == '{}') customRules = '{\n\t\n}'; // 引导用户插入位置
  3405. 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;">
  3406. <h3 style="font-size: 22px !important;"><strong># 自定义翻页规则(优先级最高,但前提是 "规则名" 不能重复)-【将规则插入默认的 <code>{ }</code> 中间】</strong></h3>
  3407. <details>
  3408. <summary><kbd><strong>「 点击展开 查看示例 」(为了避免需要的时候还要找,我干脆把常用规则都一股脑塞进去了)</strong></kbd></summary>
  3409. <ul style="list-style: disc !important; margin-left: 35px !important;">
  3410. <li>翻页规则为 JSON 格式,因此大家需要多少<strong>了解一点 JSON 的基本格式</strong>(主要就是逗号、转义、双引号等)。</li>
  3411. <li>具体的翻页规则说明、示例,为了方便更新及补充,我都写到 <strong><a href="https://github.com/XIU2/UserScript/issues/176" target="_blank">Github</a></strong> 里面了。</li>
  3412. <li>脚本会自动格式化规则,因此<strong>无需手动缩进、换行</strong>,只需把规则<strong>插入默认的 { } 中间</strong>即可。</li>
  3413. </ul>
  3414. <pre>
  3415. // 下面示例是把所有规则都塞进去了,但实际上大都用不上,大多数网站只需要像第一个 "aaa" 这样的规则
  3416. // "aaa" 是规则名,唯一!不能重复!否则会被 外置/内置规则 覆盖,支持中文等各种字符
  3417. // "url" 是用来控制哪些网站中页面适用该规则,省略后代表该规则应用于全站
  3418. // "scrollD" 是用来控制翻页敏感度的(越大就越早触发翻页,访问速度慢的网站需要调大,可省略(注意逗号),默认 1500)
  3419. {
  3420. "aaa": {
  3421. "host": "aaaa",
  3422. "url": "xxxx",
  3423. "pager": {
  3424. "nextL": "xxxx",
  3425. "pageE": "xxxx",
  3426. "replaceE": "xxxx",
  3427. "scrollD": 1000
  3428. }
  3429. },
  3430. "bbb": {
  3431. "host": ["bbb1.com", "bbb2.com"],
  3432. "url": "/^\\/s$/",
  3433. "style": ".aaaa {display: none !important;}",
  3434. "blank": 1,
  3435. "hiddenPN": true,
  3436. "history": false,
  3437. "thread": true,
  3438. "iframe": true,
  3439. "pager": {
  3440. "type": 1,
  3441. "nextL": "id('page')//a[contains(text(),'下一页')] || id('page2')//a[text()='下一页']",
  3442. "pageE": "aaa",
  3443. "insertP": [".bbb",3],
  3444. "replaceE": ".page",
  3445. "scriptT": 1,
  3446. "forceHTTPS": true,
  3447. "interval": 500,
  3448. "scrollD": 1500
  3449. },
  3450. "function": {
  3451. "bF": "return fun.src_bF(pageE, [0,'img[data-src]','data-src'])",
  3452. "aF": "document.body.appendChild(document.createElement('script')).textContent = 'xxx'"
  3453. }
  3454. },
  3455. "这里也可以用中文": {
  3456. "host": "/\\.ccc\\.com/",
  3457. "url": "fun.isUrlC(); return (fun.lp() == '/' || fun.indexOF('/s') || fun.isMobile())",
  3458. "pager": {
  3459. "type": 2,
  3460. "nextL": "#autopbn",
  3461. "nextText": "下一页",
  3462. "nextTextOf": "下一页",
  3463. "isHidden": true,
  3464. "interval": 1000,
  3465. "scrollD": 1500
  3466. }
  3467. }
  3468. }
  3469. </pre>
  3470. </details>
  3471.  
  3472. <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>
  3473. <button id="Autopage_customRules_save" style="margin-right: 20px !important;">保存并刷新</button><button id="Autopage_customRules_cancel">取消修改</button>
  3474. </div>`
  3475. document.documentElement.insertAdjacentHTML('beforeend', _html);
  3476. document.documentElement.style.overflow = document.body.style.overflow = 'hidden';
  3477. // 点击事件
  3478. getCSS('#Autopage_customRules_save').onclick = function () {
  3479. customRules = getCSS('#Autopage_customRules_textarea').value;
  3480. //console.log(customRules)
  3481. if (!customRules) customRules = '{}'
  3482. try {
  3483. customRules = JSON.parse(customRules)
  3484. //console.log(customRules)
  3485. GM_setValue('menu_customRules', customRules)
  3486. location.reload();
  3487. } catch (e) {
  3488. console.error('自定义规则存在格式错误:\n' + e + '\n\n格式错误一般为:\n· 逗号:每组 {} 中的最后一个值末尾不能加逗号\n\n· 转义:如果正则表达式中含有转义符 \\ 那就要对其再次转义为 \\\\\n\n· 双引号:规则中冒号左右的内容都需要加上双引号,如果内容中含有双引号则需要对双引号转义(即 \\" 这样),或改为单引号')
  3489. window.alert('自定义规则存在格式错误:\n' + e + '\n\n格式错误一般为:\n· 逗号:每组 {} 中的最后一个值末尾不能加逗号\n\n· 转义:如果正则表达式中含有转义符 \\ 那就要对其再次转义为 \\\\\n\n· 双引号:规则中冒号左右的内容都需要加上双引号,如果内容中含有双引号则需要对双引号转义(即 \\" 这样),或改为单引号');
  3490. }
  3491. }
  3492. getCSS('#Autopage_customRules_cancel').onclick = function () {document.documentElement.style.overflow = document.body.style.overflow = ''; getCSS('#Autopage_customRules').remove();}
  3493. }
  3494. // 显示页码
  3495. function pageNumber(type) {
  3496. 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}
  3497. let status = getCSS('#Autopage_number');
  3498. switch (type) {
  3499. case 'add':
  3500. add(); break;
  3501. case 'del':
  3502. del(); break;
  3503. case 'set':
  3504. set(); break;
  3505. }
  3506.  
  3507. function add(){
  3508. if (status) {
  3509. if (status.style.display === 'none') {status.style.display = 'flex';}
  3510. return
  3511. }
  3512. // 插入网页
  3513. 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>`,
  3514. _html = `<div id="Autopage_number" title="1. 此为 [当前页码](仅指脚本翻了多少页,并非实际页码,该页码可在脚本菜单中关闭)&#10;&#10;2. 鼠标 [左键] 点击此处可 [临时暂停翻页](再次点击可恢复)&#10;&#10;3. 鼠标 [右键] 点击此处可 [回到顶部]">${pageNum._now}</div>`
  3515. document.documentElement.insertAdjacentHTML('beforeend', _style + _html);
  3516. // 解决 远景论坛 会清理掉前面插入的 CSS 样式的问题
  3517. if (location.hostname === 'bbs.pcbeta.com') {setTimeout(function(){document.documentElement.insertAdjacentHTML('beforeend', _style);}, 500);}
  3518. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  3519. // 左键点击事件(临时暂停翻页)
  3520. getCSS('#Autopage_number').onclick = function(e) {
  3521. if (pausePage) {this.style = 'color: #FF5722 !important; font-style: italic !important;';} else {this.style = '';}
  3522. pausePage = !pausePage;
  3523. if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
  3524. e.preventDefault();
  3525. e.stopPropagation();
  3526. return false
  3527. };
  3528. // 右键点击事件(回到顶部)
  3529. getCSS('#Autopage_number').oncontextmenu = function(e) {
  3530. window.scrollTo(0,0);
  3531. e.preventDefault();
  3532. e.stopPropagation();
  3533. return false
  3534. };
  3535. status = getCSS('#Autopage_number');
  3536. set();
  3537. }
  3538. // 监听储存当前页码的对象值的变化
  3539. function set(){
  3540. Object.defineProperty(pageNum, 'now', {
  3541. set: function(value) {
  3542. this._now = value;
  3543. if (status) status.textContent = value;
  3544. }
  3545. });
  3546. }
  3547. function del(){
  3548. if (!status) return
  3549. status.style.display = 'none';
  3550. }
  3551. }
  3552. // 菜单开关
  3553. function menu_switch(menu_status, Name, Tips) {
  3554. if (menu_status === true){
  3555. GM_setValue(Name, false);
  3556. } else {
  3557. GM_setValue(Name, true);
  3558. }
  3559. if (Name === 'menu_page_number') {
  3560. if (menu_status === true){pageNumber('del');} else {pageNumber('add');}
  3561. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  3562. } else {
  3563. location.reload();}
  3564. };
  3565. // 生成 SiteTypeID
  3566. function setSiteTypeID() {
  3567. let num = 0
  3568. for (let val in DBSite) {
  3569. DBSite[val].SiteTypeID = num = num + 1;
  3570. }
  3571. }
  3572. // 获取 Cookie
  3573. function getCookie(name) {
  3574. if (!name) return ''
  3575. let arr = document.cookie.split(';');
  3576. name += '='
  3577. for (let i=0; i<arr.length; i++) {
  3578. let now = arr[i].trim();
  3579. if (now.indexOf(name) == 0) return now.substring(name.length, now.length);
  3580. }
  3581. return '';
  3582. }
  3583. // 插入位置
  3584. function getAddTo(num) {
  3585. switch (num) {
  3586. case 1:
  3587. return 'beforebegin'; break;
  3588. case 2:
  3589. return 'afterbegin'; break;
  3590. case 3:
  3591. case 6:
  3592. return 'beforeend'; break;
  3593. case 4:
  3594. case 5:
  3595. return 'afterend'; break;
  3596. }
  3597. }
  3598. // 插入位置 5 时,排除 <script> <style> <link> 标签
  3599. function toE5pop(a) {
  3600. if (a.length === 0) return
  3601. let b = a.pop();
  3602. if (b.tagName === 'SCRIPT' || b.tagName === 'STYLE' || b.tagName === 'LINK') {
  3603. return toE5pop(a);
  3604. }
  3605. return b
  3606. }
  3607. // 滚动条事件
  3608. function windowScroll(fn1) {
  3609. var beforeScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  3610. fn = fn1 || function () {};
  3611. setTimeout(function () { // 延时 1 秒执行,避免刚载入到页面就触发翻页事件
  3612.  
  3613. // 避免网页内容太少,高度撑不起来,不显示滚动条而无法触发翻页事件
  3614. let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
  3615. scrollHeight = window.innerHeight || document.documentElement.clientHeight
  3616. if (scrollTop === 0 && document.documentElement.scrollHeight === scrollHeight) {
  3617. insStyle(`html, body {min-height: ${document.documentElement.scrollHeight+10}px;}`)
  3618. }
  3619.  
  3620. window.addEventListener('scroll', function (e) {
  3621. var afterScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  3622. delta = afterScrollTop - beforeScrollTop;
  3623. if (delta == 0) return false;
  3624. fn(delta > 0 ? 'down' : 'up', e);
  3625. beforeScrollTop = afterScrollTop;
  3626. }, false);
  3627. }, 1000)
  3628. }
  3629. // 自定义 urlchange 事件(用来监听 URL 变化)
  3630. function addUrlChangeEvent() {
  3631. history.pushState = ( f => function pushState(){
  3632. var ret = f.apply(this, arguments);
  3633. window.dispatchEvent(new Event('pushstate'));
  3634. window.dispatchEvent(new Event('urlchange'));
  3635. return ret;
  3636. })(history.pushState);
  3637.  
  3638. history.replaceState = ( f => function replaceState(){
  3639. var ret = f.apply(this, arguments);
  3640. window.dispatchEvent(new Event('replacestate'));
  3641. window.dispatchEvent(new Event('urlchange'));
  3642. return ret;
  3643. })(history.replaceState);
  3644.  
  3645. window.addEventListener('popstate',()=>{
  3646. window.dispatchEvent(new Event('urlchange'))
  3647. });
  3648. }
  3649. })();

QingJ © 2025

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