自动无缝翻页

⭐无缝衔接下一页内容到网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、微博、NGA、V2EX、B 站(Bilibili)、煎蛋网、龙的天空、起点中文、IT之家、千图网、千库网、Pixabay、Pixiv、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、小众软件、【动漫狂、漫画猫、漫画屋、漫画 DB、动漫之家、拷贝漫画、HiComic、Mangabz、Xmanhua 等漫画网站...】、PubMed、Z-Library、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了...

当前为 2022-03-07 提交的版本,查看 最新版本

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