自动无缝翻页

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

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

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

QingJ © 2025

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