自动无缝翻页

无缝拼接下一页内容,目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、贴吧、豆瓣、微博、NGA玩家社区、V2EX、超能网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、小霸王其乐无穷、片库、音范丝、BT之家、爱恋动漫、Nyaa、SrkBT、RARBG、423Down、不死鸟、小众软件、极简插件、乐软博客、不忘初心、果核剥壳、六音软件、微当下载、th-sjy汉化、异次元软件、老殁殁漂遥、异星软件空间、动漫狂、漫画DB、HiComic(嗨漫画)、古风漫画网、砂之船动漫家、PubMed、wikiHow、AfreecaTV、GreasyFork、CS.RIN.RU、Crackhub213、FitGirl Repacks...

当前为 2021-08-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 自动无缝翻页
  3. // @version 1.8.4
  4. // @author X.I.U
  5. // @description 无缝拼接下一页内容,目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、贴吧、豆瓣、微博、NGA玩家社区、V2EX、超能网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、小霸王其乐无穷、片库、音范丝、BT之家、爱恋动漫、Nyaa、SrkBT、RARBG、423Down、不死鸟、小众软件、极简插件、乐软博客、不忘初心、果核剥壳、六音软件、微当下载、th-sjy汉化、异次元软件、老殁殁漂遥、异星软件空间、动漫狂、漫画DB、HiComic(嗨漫画)、古风漫画网、砂之船动漫家、PubMed、wikiHow、AfreecaTV、GreasyFork、CS.RIN.RU、Crackhub213、FitGirl Repacks...
  6. // @match *://*/*
  7. // @connect www.gamersky.com
  8. // @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png
  9. // @grant GM_xmlhttpRequest
  10. // @grant GM_registerMenuCommand
  11. // @grant GM_openInTab
  12. // @grant GM_getValue
  13. // @grant GM_setValue
  14. // @grant GM_notification
  15. // @grant unsafeWindow
  16. // @noframes
  17. // @license GPL-3.0 License
  18. // @run-at document-end
  19. // @namespace https://github.com/XIU2/UserScript
  20. // @supportURL https://github.com/XIU2/UserScript
  21. // @homepageURL https://github.com/XIU2/UserScript
  22. // ==/UserScript==
  23.  
  24. (function() {
  25. 'use strict';
  26. var webType = 0, curSite = {SiteTypeID: 0}, DBSite, SiteType, pausePage = true;
  27. if (GM_getValue('menu_disable') == null){GM_setValue('menu_disable', [])}; if (GM_getValue('menu_discuz_thread_page') == null){GM_setValue('menu_discuz_thread_page', true)}; if (GM_getValue('menu_pause_page') == null){GM_setValue('menu_pause_page', true)};
  28. // 注册脚本菜单
  29. if (menu_disable('check')) { // 当前网站是否已存在禁用列表中
  30. GM_registerMenuCommand('❌ 已禁用 (点击对当前网站启用)', function(){menu_disable('del')});
  31. return
  32. } else {
  33. webType = doesItSupport(); // 判断网站类型(即是否支持),顺便直接赋值
  34. if (webType === 0) {
  35. GM_registerMenuCommand('❌ 当前网站暂不支持 [点击申请支持]', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});});
  36. console.info('[自动无缝翻页] - 不支持当前网站,欢迎申请支持:https://github.com/XIU2/UserScript / https://greasyfork.org/zh-CN/scripts/419215/feedback');
  37. return
  38. }
  39. GM_registerMenuCommand('✅ 已启用 (点击对当前网站禁用)', function(){menu_disable('add')});
  40. if (webType === 2 || location.host === 'cs.rin.ru') {
  41. GM_registerMenuCommand(`${GM_getValue('menu_discuz_thread_page')?'✅':'❌'} 帖子内自动翻页 (仅论坛)`, function(){menu_switch(GM_getValue('menu_discuz_thread_page'), 'menu_discuz_thread_page', 'Discuz! 论坛帖子内翻页')});
  42. }
  43. GM_registerMenuCommand(`${GM_getValue('menu_pause_page')?'✅':'❌'} 左键双击网页空白处暂停翻页`, function(){menu_switch(GM_getValue('menu_pause_page'), 'menu_pause_page', '左键双击网页空白处暂停翻页')});
  44. }
  45. GM_registerMenuCommand('💬 反馈 & 欢迎申请支持', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});});
  46.  
  47. function setDBSite() {
  48. /*
  49. 自动翻页规则
  50. type:
  51. 1 = 由脚本实现自动无缝翻页
  52. 2 = 网站自带了自动无缝翻页功能,只需要点击下一页按钮即可
  53. nextText: 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页)
  54. nextTextOf: 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页)
  55. nextHTML: 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页)
  56. intervals: 点击间隔时间,对于没有按钮文字变化的按钮,可以手动指定间隔时间,单位:ms
  57. 3 = 依靠元素距离可视区域底部的距离来触发翻页
  58. 4 = 部分简单的动态加载类网站(暂时)
  59. insertPosition:
  60. 1 = 插入该元素本身的前面;
  61. 2 = 插入该元素当中,第一个子元素前面;
  62. 3 = 插入该元素当中,最后一个子元素后面;
  63. 4 = 插入该元素本身的后面;
  64. mimeType: 网站编码
  65. scriptType: 单独插入 <script> 标签
  66. 1 = 下一页的所有 <script> 标签
  67. 2 = 下一页主体元素同级 <script> 标签
  68. 3 = 下一页主体元素子元素 <script> 标签
  69. scrollDelta:数值越大,滚动条触发点越靠上(越早开始翻页),一般是访问网页速度越慢,该值就需要越大(如果 Type = 3,则相反)
  70. function:
  71. before = 插入前执行函数;
  72. after = 插入后执行函数;
  73. parameter = 参数
  74. */
  75. DBSite = {
  76. discuz_forum: { // 各版块帖子列表(自带无缝加载下一页按钮的)
  77. SiteTypeID: 0,
  78. pager: {
  79. type: 2,
  80. nextLink: '#autopbn',
  81. nextText: '下一页 »',
  82. scrollDelta: 1500
  83. }
  84. },
  85. discuz_thread: { // 帖子内
  86. SiteTypeID: 0,
  87. pager: {
  88. type: 1,
  89. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  90. pageElement: 'css;#postlist > div[id^="post_"]',
  91. insertPosition: ['css;#postlist', 3],
  92. replaceE: 'css;.pg, .pages',
  93. scrollDelta: 1000
  94. }
  95. },
  96. discuz_search: { // 搜索页
  97. SiteTypeID: 0,
  98. pager: {
  99. type: 1,
  100. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  101. pageElement: 'css;#threadlist > ul',
  102. insertPosition: ['css;#threadlist', 3],
  103. replaceE: 'css;.pg, .pages',
  104. scrollDelta: 1000
  105. }
  106. },
  107. discuz_guide: { // 导读之类的 及 各版块帖子列表(不带无缝加载下一页按钮的)
  108. SiteTypeID: 0,
  109. pager: {
  110. type: 1,
  111. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  112. pageElement: 'css;#threadlist table > tbody[id^="normalthread_"]',
  113. insertPosition: ['id("threadlist")//table/tbody[starts-with(@id, "normalthread_")]/parent::table', 3],
  114. replaceE: 'css;.pg, .pages',
  115. scrollDelta: 1000
  116. }
  117. },
  118. discuz_youspace: { // 别人的回复页、主题页
  119. SiteTypeID: 0,
  120. pager: {
  121. type: 1,
  122. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  123. pageElement: 'css;tbody > tr:not(.th)',
  124. insertPosition: ['css;tbody', 3],
  125. replaceE: 'css;.pg, .pages',
  126. scrollDelta: 1000
  127. }
  128. },
  129. discuz_collection: { // 淘帖页
  130. SiteTypeID: 0,
  131. pager: {
  132. type: 1,
  133. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  134. pageElement: 'css;#ct .bm_c table > tbody',
  135. insertPosition: ['css;#ct .bm_c table', 3],
  136. replaceE: 'css;.pg, .pages',
  137. scrollDelta: 1000
  138. }
  139. },
  140. flarum: {
  141. SiteTypeID: 0,
  142. pager: {
  143. type: 2,
  144. nextLink: '.DiscussionList-loadMore > button[title]',
  145. scrollDelta: 1000
  146. }
  147. },
  148. dux: { // 一种 WordPress 主题
  149. SiteTypeID: 0,
  150. pager: {
  151. type: 1,
  152. nextLink: '//li[@class="next-page"]/a[@href]',
  153. pageElement: 'css;.content > article',
  154. insertPosition: ['css;.content > .pagination', 1],
  155. replaceE: 'css;.content > .pagination',
  156. scrollDelta: 1500
  157. },
  158. function: {
  159. before: dux_functionBefore
  160. }
  161. },
  162. baidu: { // 百度搜素
  163. SiteTypeID: 0,
  164. host: 'www.baidu.com',
  165. pager: {
  166. type: 1,
  167. nextLink: 'id("page")//a[contains(text(),"下一页")][@href]',
  168. pageElement: 'css;#content_left > *',
  169. insertPosition: ['css;#content_left', 3],
  170. replaceE: 'css;#page',
  171. scrollDelta: 1200
  172. }
  173. },
  174. google: { // 谷歌搜索
  175. SiteTypeID: 0,
  176. host: 'www.google.com',
  177. functionStart: function() {if (location.pathname === '/search') curSite = DBSite.google;},
  178. pager: {
  179. type: 1,
  180. nextLink: 'id("pnnext")[@href]',
  181. pageElement: 'css;#res > *',
  182. insertPosition: ['css;#res', 3],
  183. replaceE: 'id("navcnt") | id("rcnt")//div[@role="navigation"]',
  184. scriptType: 1,
  185. scrollDelta: 3000
  186. }
  187. },
  188. bing: { // 必应搜索
  189. SiteTypeID: 0,
  190. host: ['www.bing.com','cn.bing.com'],
  191. functionStart: function() {if (location.pathname === '/search') {curSite = DBSite.bing; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.b_imagePair.square_mp > .inner {display: none;}';}},
  192. pager: {
  193. type: 1,
  194. nextLink: '//a[contains(@class,"sb_pagN")][@href]',
  195. pageElement: 'css;#b_results > li:not(.b_msg):not(.b_pag):not(#mfa_root)',
  196. insertPosition: ['css;#b_results > .b_pag', 1],
  197. replaceE: 'css;#b_results > .b_pag',
  198. scrollDelta: 1500
  199. }
  200. },
  201. baidu_tieba: { // 百度贴吧 - 帖子列表
  202. SiteTypeID: 0,
  203. host: 'tieba.baidu.com',
  204. functionStart: function() {if (location.pathname === '/f') { // 帖子列表
  205. baidu_tieba_1(); // 右侧悬浮发帖按钮点击事件(解决自动翻页导致无法发帖的问题)
  206. curSite = DBSite.baidu_tieba; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'img.j_retract {margin-top: 0 !important;margin-bottom: 0 !important;}'; // 修复帖子列表中预览图片,在切换下一个/上一个图片时,多出来的图片上下边距
  207. } else if (location.pathname === '/f/search/res') { // 吧内搜索/全吧搜索
  208. curSite = DBSite.baidu_tieba_search;
  209. }},
  210. pager: {
  211. type: 4,
  212. nextLink: baidu_tieba_functionNext,
  213. pageElement: 'css;#thread_list > li',
  214. insertPosition: ['css;#thread_list', 3],
  215. insertElement: baidu_tieba_insertElement,
  216. replaceE: 'css;#frs_list_pager',
  217. intervals: 3000,
  218. scrollDelta: 2000
  219. },
  220. function: {
  221. before: baidu_tieba_functionBefore
  222. }
  223. },
  224. baidu_tieba_post: { // 百度贴吧 - 帖子内
  225. SiteTypeID: 0,
  226. pager: {
  227. type: 1,
  228. nextLink: '//li[contains(@class,"pb_list_pager")]/a[contains(text(),"下一页")][@href]',
  229. pageElement: 'css;#j_p_postlist > div',
  230. insertPosition: ['css;#j_p_postlist', 3],
  231. replaceE: 'css;li.pb_list_pager',
  232. scrollDelta: 1000
  233. }
  234. },
  235. baidu_tieba_search: { // 百度贴吧 - 搜索页
  236. SiteTypeID: 0,
  237. pager: {
  238. type: 1,
  239. nextLink: '//a[@class="next"][@href]',
  240. pageElement: 'css;.s_post_list > .s_post',
  241. insertPosition: ['css;.s_post_list', 3],
  242. replaceE: 'css;.pager.pager-search',
  243. scrollDelta: 1000
  244. }
  245. },
  246. douban_subject_comments: { // 豆瓣 - 短评
  247. SiteTypeID: 0,
  248. host: 'movie.douban.com',
  249. functionStart: function() {if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/comments') > -1) { // 短评列表
  250. curSite = DBSite.douban_subject_comments;
  251. } else if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/reviews') > -1) { // 影评列表
  252. curSite = DBSite.douban_subject_reviews;
  253. } else if(location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/episode') > -1) { // 电视剧每集评论
  254. curSite = DBSite.douban_subject_episode;
  255. }},
  256. pager: {
  257. type: 1,
  258. nextLink: '//a[@class="next"][@href]',
  259. pageElement: 'css;#comments > .comment-item',
  260. insertPosition: ['css;#paginator', 1],
  261. replaceE: 'css;#paginator',
  262. scrollDelta: 1000
  263. }
  264. },
  265. douban_subject_reviews: { // 豆瓣 - 影评
  266. SiteTypeID: 0,
  267. pager: {
  268. type: 1,
  269. nextLink: '//link[@rel="next"][@href]',
  270. pageElement: 'css;.review-list > div',
  271. insertPosition: ['css;.review-list', 3],
  272. replaceE: 'css;.paginator',
  273. scrollDelta: 1000
  274. }
  275. },
  276. douban_subject_episode: { // 豆瓣 - 剧评
  277. SiteTypeID: 0,
  278. pager: {
  279. type: 1,
  280. nextLink: '//link[@rel="next"][@href]',
  281. pageElement: 'css;#comments > div',
  282. insertPosition: ['css;#comments', 3],
  283. replaceE: 'css;.paginator',
  284. scrollDelta: 1000
  285. }
  286. },
  287. weibo_comment: { // 微博评论
  288. SiteTypeID: 0,
  289. host: 'weibo.com',
  290. pager: {
  291. type: 2,
  292. nextLink: 'a[action-type="click_more_comment"]',
  293. nextText: '查看更多c',
  294. scrollDelta: 1000
  295. }
  296. },
  297. nga_thread: { // NGA - 各版块帖子列表
  298. SiteTypeID: 0,
  299. host: 'bbs.nga.cn',
  300. functionStart: function() {if (location.pathname === '/thread.php') { // 帖子列表
  301. curSite = DBSite.nga_thread;
  302. } else if (location.pathname === '/read.php') { // 帖子内
  303. curSite = DBSite.nga_read;
  304. }},
  305. pager: {
  306. type: 1,
  307. nextLink: 'css;#pagebbtm a[title="下一页"][href]',
  308. pageElement: 'css;#topicrows > tbody, #topicrows > script',
  309. insertPosition: ['css;#topicrows', 3],
  310. replaceE: 'css;div[name="pageball"]',
  311. scriptType: 2,
  312. scrollDelta: 1000
  313. },
  314. function: {
  315. after: nga_thread_functionAfter
  316. }
  317. },
  318. nga_read: { // NGA - 帖子内
  319. SiteTypeID: 0,
  320. pager: {
  321. type: 1,
  322. nextLink: 'css;#pagebbtm a[title="下一页"][href]',
  323. pageElement: 'id("m_posts_c")/table | id("m_posts_c")/script | //script[contains(text(), "commonui.userInfo.setAll")]',
  324. insertPosition: ['css;#m_posts_c', 3],
  325. replaceE: 'css;div[name="pageball"]',
  326. scriptType: 2,
  327. scrollDelta: 1000
  328. }
  329. },
  330. v2ex_recent: { // V2EX - 最近主题页
  331. SiteTypeID: 0,
  332. host: ['v2ex.com', 'www.v2ex.com'],
  333. functionStart: function() {if (location.pathname === '/') { // 首页
  334. v2ex_functionAfter('#Main a.topic-link:not([target])');
  335. } else if (location.pathname === '/recent') { // 最近主题页
  336. curSite = DBSite.v2ex_recent;
  337. v2ex_functionAfter('#Main a.topic-link:not([target])');
  338. } else if (location.pathname === '/notifications') { // 提醒消息页
  339. curSite = DBSite.v2ex_notifications;
  340. v2ex_functionAfter('#Main a[href^="/t/"]:not([target])');
  341. } else if (location.pathname === '/balance') { // 账户余额页
  342. curSite = DBSite.v2ex_balance;
  343. } else if (location.pathname.indexOf('/go/') > -1) { // 分类主题页
  344. curSite = DBSite.v2ex_go;
  345. v2ex_functionAfter('#Main a.topic-link:not([target])');
  346. } else if (location.pathname.indexOf('/replies') > -1) { // 用户回复页
  347. curSite = DBSite.v2ex_replies;
  348. v2ex_functionAfter('#Main a[href^="/t/"]:not([target])');
  349. }},
  350. pager: {
  351. type: 1,
  352. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  353. pageElement: 'css;.cell.item',
  354. insertPosition: ['//div[@id="Main"]//div[@class="box"]//div[@class="cell"][last()]', 1],
  355. replaceE: 'css;#Main > .box > .cell[style]:not(.item) > table',
  356. scrollDelta: 1500
  357. },
  358. function: {
  359. after: v2ex_functionAfter,
  360. parameter: '#Main a.topic-link:not([target])'
  361. }
  362. },
  363. v2ex_notifications: { // V2EX - 提醒消息页
  364. SiteTypeID: 0,
  365. pager: {
  366. type: 1,
  367. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  368. pageElement: 'css;#notifications > div',
  369. insertPosition: ['css;#notifications', 3],
  370. replaceE: 'css;#Main > .box > .cell[style] > table',
  371. scrollDelta: 1500
  372. },
  373. function: {
  374. after: v2ex_functionAfter,
  375. parameter: '#Main a[href^="/t/"]:not([target])'
  376. }
  377. },
  378. v2ex_replies: { // V2EX - 用户回复页
  379. SiteTypeID: 0,
  380. pager: {
  381. type: 1,
  382. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  383. pageElement: '//div[@id="Main"]//div[@class="box"]//div[@class="dock_area"] | //*[@id="Main"]//div[@class="box"]//div[@class="inner"] | //*[@id="Main"]//div[@class="box"]//div[@class="dock_area"][last()]/following-sibling::div[@class="cell"][1]',
  384. insertPosition: ['//div[@id="Main"]//div[@class="box"]//div[@class="cell"][last()]', 1],
  385. replaceE: 'css;#Main > .box > .cell[style] > table',
  386. scrollDelta: 1500
  387. },
  388. function: {
  389. after: v2ex_functionAfter,
  390. parameter: '#Main a[href^="/t/"]:not([target])'
  391. }
  392. },
  393. v2ex_go: { // V2EX - 分类主题页
  394. SiteTypeID: 0,
  395. pager: {
  396. type: 1,
  397. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  398. pageElement: 'css;#TopicsNode > div',
  399. insertPosition: ['css;#TopicsNode', 3],
  400. replaceE: 'css;#Main > .box > .cell[style] > table',
  401. scrollDelta: 1500
  402. },
  403. function: {
  404. after: v2ex_functionAfter,
  405. parameter: '#Main a.topic-link:not([target])'
  406. }
  407. },
  408. v2ex_balance: { // V2EX - 账户余额页
  409. SiteTypeID: 0,
  410. pager: {
  411. type: 1,
  412. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  413. pageElement: 'css;#Main .box > div:not(.cell) > table > tbody > tr:not(:first-child)',
  414. insertPosition: ['css;#Main .box > div:not(.cell) > table > tbody', 3],
  415. replaceE: 'css;#Main > .box > .cell[style] > table',
  416. scrollDelta: 1000
  417. }
  418. },
  419. xcar_forumdisplay: { // 爱卡汽车网论坛 - 各版块帖子列表
  420. SiteTypeID: 0,
  421. host: 'www.xcar.com.cn',
  422. functionStart: function() {if (location.pathname === '/bbs/forumdisplay.php') {curSite = DBSite.xcar_forumdisplay}},
  423. pager: {
  424. type: 1,
  425. nextLink: 'css;a.page_down',
  426. pageElement: 'css;.table-section > dl:not(.table_head)',
  427. insertPosition: ['css;.table-section', 3],
  428. replaceE: 'css;.forumList_page',
  429. scrollDelta: 2000
  430. }
  431. },
  432. expreview: { // 超能网
  433. SiteTypeID: 0,
  434. host: 'www.expreview.com',
  435. pager: {
  436. type: 2,
  437. nextLink: '#show_article_red_1SHOW',
  438. intervals: 1500,
  439. scrollDelta: 1500
  440. }
  441. },
  442. ithome: { // IT 之家
  443. SiteTypeID: 0,
  444. host: 'www.ithome.com',
  445. pager: {
  446. type: 2,
  447. nextLink: 'a.more',
  448. intervals: 1500,
  449. scrollDelta: 1500
  450. }
  451. },
  452. _58pic: { // 千图网 - 分类/搜索页
  453. SiteTypeID: 0,
  454. host: 'www.58pic.com',
  455. functionStart: function() {if (location.pathname.indexOf('/tupian/') > -1) {
  456. curSite = DBSite._58pic; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.qtw-card.place-box.is-two {display: none !important;}'; // 隐藏末尾很大的 [下一页] 按钮
  457. } else if (location.pathname.indexOf('/c/') > -1) {
  458. curSite = DBSite._58pic_c;
  459. }},
  460. pager: {
  461. type: 1,
  462. nextLink: '//div[contains(@class,"page-box")]//a[text()="下一页"][@href]',
  463. pageElement: 'css;.pic-box > .qtw-card',
  464. insertPosition: ['css;.pic-box', 3],
  465. replaceE: 'css;.page-box',
  466. scrollDelta: 2000
  467. },
  468. function: {
  469. before: _58pic_functionBefore
  470. }
  471. },
  472. _58pic_c: { // 千图网 - 专题/收藏夹
  473. SiteTypeID: 0,
  474. pager: {
  475. type: 1,
  476. nextLink: '//div[contains(@class,"page-box")]//a[text()="下一页"][@href]',
  477. pageElement: 'css;.list-box > .qtw-card',
  478. insertPosition: ['css;.list-box', 3],
  479. replaceE: 'css;.page-box',
  480. scrollDelta: 4000
  481. },
  482. function: {
  483. before: _58pic_functionBefore
  484. }
  485. },
  486. pixabay: { // Pixabay(都是搜索页)
  487. SiteTypeID: 0,
  488. host: 'pixabay.com',
  489. pager: {
  490. type: 1,
  491. nextLink: '//a[text()="Next page"][@href]',
  492. pageElement: 'css;[class^="results"] > [class^="container"] > div',
  493. insertPosition: ['css;[class^="results"] > [class^="container"]', 3],
  494. replaceE: '//a[text()="Next page"][@href]',
  495. scrollDelta: 2000
  496. },
  497. function: {
  498. before: pixabay_functionBefore
  499. }
  500. },
  501. _3dmgame: { // 3DM
  502. SiteTypeID: 0,
  503. host: 'www.3dmgame.com',
  504. pager: {
  505. type: 3,
  506. nextLink: '//li[@class="next"]/a[@href]',
  507. pageElement: 'css;.news_warp_center > *',
  508. insertPosition: ['css;.news_warp_center', 3],
  509. replaceE: 'css;.pagewrap',
  510. scrollElement: '.pagewrap',
  511. scrollDelta: 400
  512. }
  513. },
  514. ali213_www: { // 游侠网
  515. SiteTypeID: 0,
  516. host: 'www.ali213.net',
  517. pager: {
  518. type: 3,
  519. nextLink: 'id("after_this_page")[@href]',
  520. pageElement: 'css;#Content >*:not(.news_ding):not(.page_fenye)',
  521. insertPosition: ['css;.page_fenye', 1],
  522. replaceE: 'css;.page_fenye',
  523. scrollElement: '.page_fenye',
  524. scrollDelta: 400
  525. }
  526. },
  527. ali213_gl: { // 游侠网 - 攻略
  528. SiteTypeID: 0,
  529. host: 'gl.ali213.net',
  530. functionStart: function() {curSite = DBSite.ali213_gl; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.n_show_b {display: none !important;}';},
  531. pager: {
  532. type: 3,
  533. nextLink: '//a[@class="next n"][@href]',
  534. pageElement: 'css;.c-detail >*',
  535. insertPosition: ['css;.c-detail', 3],
  536. replaceE: 'css;.page_fenye',
  537. scrollElement: '.page_fenye',
  538. scrollDelta: 400
  539. }
  540. },
  541. ali213_pic: { // 游侠网 - 图库
  542. SiteTypeID: 0,
  543. host: 'pic.ali213.net',
  544. functionStart: function() {curSite = DBSite.ali213_pic; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'a.prev, a.next {display: none !important;}';},
  545. pager: {
  546. type: 1,
  547. nextLink: 'css;a.next[href]',
  548. pageElement: 'css;#image-show > img',
  549. insertPosition: ['css;#image-show', 3],
  550. replaceE: 'css;#image-show > a',
  551. scrollDelta: 1200
  552. }
  553. },
  554. gamersky_ent: { // 游民星空
  555. SiteTypeID: 0,
  556. host: 'www.gamersky.com',
  557. functionStart: function() {if (location.pathname.indexOf('/ent/') > -1) {curSite = DBSite.gamersky_ent;} else {curSite = DBSite.gamersky_gl;}},
  558. pager: {
  559. type: 3,
  560. nextLink: '//div[@class="page_css"]/a[text()="下一页"][@href]',
  561. pageElement: 'css;.Mid2L_con > *:not(.gs_nc_editor):not(.pagecss):not(.page_css):not(.gs_ccs_solve):not(.post_ding)',
  562. insertPosition: ['css;.page_css', 1],
  563. replaceE: 'css;.page_css',
  564. scrollElement: '.page_css',
  565. scrollDelta: 100
  566. }
  567. },
  568. gamersky_gl: { // 游民星空 - 攻略
  569. SiteTypeID: 0,
  570. pager: {
  571. type: 3,
  572. nextLink: '//div[@class="page_css"]/a[text()="下一页"][@href]',
  573. pageElement: 'css;.Mid2L_con > *:not(.gs_nc_editor):not(.pagecss):not(.gs_ccs_solve):not(.post_ding)',
  574. insertPosition: ['css;.gs_nc_editor', 1],
  575. replaceE: 'css;.page_css',
  576. scrollElement: '.pagecss',
  577. scrollDelta: -1000
  578. },
  579. function: {
  580. before: gamersky_gl_functionBefore
  581. }
  582. },
  583. nexusmods: { // NexusMods
  584. SiteTypeID: 0,
  585. host: 'www.nexusmods.com',
  586. pager: {
  587. type: 4,
  588. nextLink: nexusmods_functionNext,
  589. pageElement: 'css;#mod-list > ul.tiles > li',
  590. insertPosition: ['css;#mod-list > ul.tiles', 3],
  591. insertElement: nexusmods_insertElement,
  592. replaceE: 'css;#mod-list .pagination',
  593. scrollDelta: 3000
  594. }
  595. },
  596. steamcommunity: { // 创意工坊 - 项目列表
  597. SiteTypeID: 0,
  598. host: 'steamcommunity.com',
  599. pager: {
  600. type: 1,
  601. nextLink: '//a[@class="pagebtn"][last()][@href]',
  602. pageElement: 'css;.workshopBrowseItems > *',
  603. insertPosition: ['css;.workshopBrowseItems', 3],
  604. replaceE: 'css;.workshopBrowsePaging',
  605. scriptType: 2,
  606. scrollDelta: 1500
  607. }
  608. },
  609. yikm: { // 小霸王其乐无穷
  610. SiteTypeID: 0,
  611. host: 'www.yikm.net',
  612. pager: {
  613. type: 1,
  614. nextLink: '//ul[@class="pager"]//a[text()="下一页"]',
  615. pageElement: '//h2[contains(text(), "所有游戏") or contains(text(), "搜索结果")]/following-sibling::div[1]/div',
  616. insertPosition: ['//h2[contains(text(), "所有游戏") or contains(text(), "搜索结果")]/following-sibling::div[1]', 3],
  617. replaceE: 'css;ul.pager',
  618. scrollDelta: 1500
  619. }
  620. },
  621. cs_rin_ru: { // 各版块帖子列表
  622. SiteTypeID: 0,
  623. host: 'cs.rin.ru',
  624. functionStart: function() {if (location.pathname === '/forum/viewforum.php') { // 版块帖子列表
  625. curSite = DBSite.cs_rin_ru;
  626. } else if (location.pathname === '/forum/viewtopic.php') { // 帖子内
  627. if (GM_getValue('menu_discuz_thread_page')) curSite = DBSite.cs_rin_ru_viewtopic;
  628. } else if (location.pathname === '/forum/search.php') { // 搜索结果
  629. curSite = DBSite.cs_rin_ru_search;
  630. }},
  631. pager: {
  632. type: 1,
  633. nextLink: '//td[@class="gensmall"][@align="right"]//a[text()="Next"][@href]',
  634. pageElement: 'css;#pagecontent > table.tablebg > tbody > tr:not([align])',
  635. insertPosition: ['css;#pagecontent > table.tablebg > tbody > tr[align]', 1],
  636. replaceE: 'css;#pagecontent > table:first-child',
  637. scrollDelta: 1500
  638. },
  639. function: {
  640. before: cs_rin_ru_functionBefore
  641. }
  642. },
  643. cs_rin_ru_viewtopic: { // 帖子内
  644. SiteTypeID: 0,
  645. pager: {
  646. type: 1,
  647. nextLink: 'id("pageheader")/p[@class="gensmall"]//a[text()="Next"][@href]',
  648. pageElement: 'css;#pagecontent > table.tablebg:not(:nth-last-child(2)):not(:nth-child(2))',
  649. insertPosition: ['css;#pagecontent > table.tablebg:nth-last-child(2)', 1],
  650. replaceE: 'css;#pagecontent >table:not(.tablebg), #pageheader p.gensmall',
  651. scrollDelta: 1500
  652. }
  653. },
  654. cs_rin_ru_search: { // 搜索页
  655. SiteTypeID: 0,
  656. pager: {
  657. type: 1,
  658. nextLink: 'id("wrapcentre")/div[@class="nav"]//a[text()="Next"]',
  659. pageElement: 'css;#wrapcentre > form > table.tablebg > tbody > tr[valign]',
  660. insertPosition: ['css;#wrapcentre > form > table.tablebg > tbody > tr:last-child', 1],
  661. replaceE: 'css;#wrapcentre > div',
  662. scrollDelta: 1500
  663. }
  664. },
  665. crackhub: {
  666. SiteTypeID: 0,
  667. host: 'crackhub.site',
  668. functionStart: function() {curSite = DBSite.crackhub; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'html.wp-dark-mode-active .inside-article {background-color: var(--wp-dark-mode-bg);}';},
  669. pager: {
  670. type: 1,
  671. nextLink: '//a[@class="next page-numbers"][@href]',
  672. pageElement: 'css;article[id^="post-"]',
  673. insertPosition: ['css;nav.paging-navigation', 1],
  674. replaceE: 'css;nav.paging-navigation',
  675. scrollDelta: 2000
  676. }
  677. },
  678. fitgirl: {
  679. SiteTypeID: 0,
  680. host: 'fitgirl-repacks.site',
  681. pager: {
  682. type: 1,
  683. nextLink: '//a[@class="next page-numbers"][@href]',
  684. pageElement: 'css;article[id^="post-"]',
  685. insertPosition: ['css;nav.paging-navigation', 1],
  686. replaceE: 'css;nav.paging-navigation',
  687. scrollDelta: 2000
  688. }
  689. },
  690. mypianku: { // 片库
  691. SiteTypeID: 0,
  692. host: 'www.mypianku.net',
  693. pager: {
  694. type: 1,
  695. nextLink: 'css;a.a1[href]',
  696. pageElement: 'css;.content-list > li',
  697. insertPosition: ['css;.content-list', 3],
  698. replaceE: 'css;.pages',
  699. scrollDelta: 1500
  700. },
  701. function: {
  702. before: mypianku_functionBefore
  703. }
  704. },
  705. yinfans: { // 音范丝
  706. SiteTypeID: 0,
  707. host: 'www.yinfans.net',
  708. pager: {
  709. type: 1,
  710. nextLink: 'css;a.next[href]',
  711. pageElement: 'css;#post_container > li',
  712. insertPosition: ['css;#post_container', 3],
  713. replaceE: 'css;.pagination',
  714. scrollDelta: 1500
  715. }
  716. },
  717. btbtt: { // BT 之家
  718. SiteTypeID: 0,
  719. host: 'btbtt',
  720. pager: {
  721. type: 1,
  722. nextLink: '//div[@class="page"]/a[contains(text(), "▶") or contains(text(), "下一页")]',
  723. pageElement: 'css;#threadlist > table, #threadlist > hr',
  724. insertPosition: ['css;#threadlist', 3],
  725. replaceE: 'css;.page',
  726. scrollDelta: 2000
  727. }
  728. },
  729. gaoqing_fm: { // 高清电台
  730. SiteTypeID: 0,
  731. host: 'gaoqing.fm',
  732. pager: {
  733. type: 2,
  734. nextLink: '.col-md-12 > a[href], #loadmore > a[href]',
  735. intervals: 1500,
  736. scrollDelta: 1000
  737. }
  738. },
  739. kisssub: { // 爱恋动漫
  740. SiteTypeID: 0,
  741. host: 'www.kisssub.org',
  742. pager: {
  743. type: 1,
  744. nextLink: 'css;a.nextprev',
  745. pageElement: 'css;#data_list > tr',
  746. insertPosition: ['css;#data_list', 3],
  747. replaceE: 'css;.pages',
  748. scrollDelta: 2500
  749. }
  750. },
  751. nyaa: { // Nyaa
  752. SiteTypeID: 0,
  753. host: 'nyaa.si',
  754. pager: {
  755. type: 1,
  756. nextLink: '//a[@rel="next"][@href] | //li[@class="next"]/a[@href]',
  757. pageElement: 'css;table.torrent-list > tbody > tr',
  758. insertPosition: ['css;table.torrent-list > tbody', 3],
  759. replaceE: 'css;ul.pagination',
  760. scrollDelta: 2000
  761. }
  762. },
  763. skrbtba: { // SkrBT
  764. SiteTypeID: 0,
  765. host: 'skrbtca.xyz',
  766. functionStart: function() {if (location.pathname === '/search') curSite = DBSite.skrbtba;},
  767. pager: {
  768. type: 1,
  769. nextLink: '//a[@aria-label="Next"]',
  770. pageElement: 'css;div[class="row"] > .col-md-6 > ul',
  771. insertPosition: ['css;nav[aria-label*="Page"]', 1],
  772. replaceE: 'css;ul.pagination',
  773. scrollDelta: 900
  774. }
  775. },
  776. rarbgprx: { // RARBG
  777. SiteTypeID: 0,
  778. host: 'rarbgprx.org',
  779. pager: {
  780. type: 1,
  781. nextLink: '(//a[@title="next page"])[1][@href]',
  782. pageElement: 'css;table.lista2t tr.lista2',
  783. insertPosition: ['css;table.lista2t > tbody', 3],
  784. replaceE: 'css;#pager_links',
  785. scrollDelta: 900
  786. }
  787. },
  788. baoshuu: { // 宝书网(小说)
  789. SiteTypeID: 0,
  790. host: 'www.baoshuu.com',
  791. functionStart: function() {if (location.pathname.indexOf('/TXT/list') > -1) curSite = DBSite.baoshuu;},
  792. pager: {
  793. type: 1,
  794. nextLink: '//div[@class="listl2"]//a[@href][text()="下一页"]',
  795. pageElement: 'css;.listl2 > ul > li',
  796. insertPosition: ['css;.listl2 > ul', 3],
  797. replaceE: 'css;listl2 > dl',
  798. mimeType: 'text/html; charset=gb2312',
  799. scrollDelta: 900
  800. }
  801. },
  802. baoshuu_m: { // 宝书网(小说)- 手机版
  803. SiteTypeID: 0,
  804. host: 'm.baoshuu.com',
  805. functionStart: function() {if (location.pathname.indexOf('/TXT/list') > -1) curSite = DBSite.baoshuu_m;},
  806. pager: {
  807. type: 1,
  808. nextLink: '//div[@class="man_first"]//a[@href][text()="下一页"]',
  809. pageElement: 'css;.man_first > ul > li',
  810. insertPosition: ['css;.man_first > ul', 3],
  811. replaceE: 'css;.man_first > dl',
  812. mimeType: 'text/html; charset=gb2312',
  813. scrollDelta: 900
  814. }
  815. },
  816. _423down: {
  817. SiteTypeID: 0,
  818. host: 'www.423down.com',
  819. functionStart: function() {if (location.pathname.indexOf('.html') === -1) curSite = DBSite._423down;},
  820. pager: {
  821. type: 1,
  822. nextLink: '//div[@class="paging"]//a[contains(text(),"下一页")][@href]',
  823. pageElement: 'css;div.content-wrap ul.excerpt > li',
  824. insertPosition: ['css;div.content-wrap ul.excerpt', 3],
  825. replaceE: 'css;div.paging',
  826. scrollDelta: 1500
  827. }
  828. },
  829. iao_su: { // 不死鸟
  830. SiteTypeID: 0,
  831. host: 'iao.su',
  832. pager: {
  833. type: 1,
  834. nextLink: '//li[@class="btn btn-primary next"]//a[@href]',
  835. pageElement: 'css;#index > article, #archive > article',
  836. insertPosition: ['css;ol.page-navigator', 1],
  837. replaceE: 'css;ol.page-navigator',
  838. scrollDelta: 1000
  839. },
  840. function: {
  841. before: iao_su_functionBefore
  842. }
  843. },
  844. appinn: { // 小众软件
  845. SiteTypeID: 0,
  846. host: 'www.appinn.com',
  847. pager: {
  848. type: 1,
  849. nextLink: '//a[@class="next page-numbers"][@href]',
  850. pageElement: 'css;section#latest-posts > article',
  851. insertPosition: ['css;nav.navigation.pagination', 1],
  852. replaceE: 'css;div.nav-links',
  853. scrollDelta: 1500
  854. }
  855. },
  856. chrome_zzzmh: { // 极简插件
  857. SiteTypeID: 0,
  858. host: 'chrome.zzzmh.cn',
  859. pager: {
  860. type: 2,
  861. nextLink: 'button.more-btn',
  862. intervals: 1000,
  863. scrollDelta: 1500
  864. }
  865. },
  866. isharepc: { // 乐软博客
  867. SiteTypeID: 0,
  868. host: 'www.isharepc.com',
  869. pager: {
  870. type: 1,
  871. nextLink: 'css;a.next[href]',
  872. pageElement: 'css;.content > div',
  873. insertPosition: ['css;nav.pagination', 1],
  874. replaceE: 'css;nav.pagination',
  875. scrollDelta: 1000
  876. }
  877. },
  878. pc521: { // 不忘初心
  879. SiteTypeID: 0,
  880. host: 'www.pc521.net',
  881. functionStart: function() {if (location.search.slice(0,3) === '?s=') {curSite = DBSite.pc521_search;} else {curSite = DBSite.pc521;}},
  882. pager: {
  883. type: 2,
  884. nextLink: 'div[id^="ias_trigger_"]',
  885. intervals: 1000,
  886. scrollDelta: 1000
  887. }
  888. },
  889. pc521_search: { // 不忘初心 - 搜索页
  890. SiteTypeID: 0,
  891. pager: {
  892. type: 1,
  893. nextLink: 'css;a.next[href]',
  894. pageElement: 'css;#main > ul > li',
  895. insertPosition: ['css;#main > ul', 3],
  896. replaceE: 'css;nav.pagination',
  897. scrollDelta: 1500
  898. }
  899. },
  900. ghxi: { // 果核剥壳 - 首页
  901. SiteTypeID: 0,
  902. host: 'www.ghxi.com',
  903. functionStart: function() {if (location.pathname === '/' && !location.search) {curSite = DBSite.ghxi;} else {curSite = DBSite.ghxi_postlist;}},
  904. pager: {
  905. type: 2,
  906. nextLink: '.load-more',
  907. intervals: 1000,
  908. scrollDelta: 5000
  909. }
  910. },
  911. ghxi_postlist: { // 果核剥壳 - 分类/搜索页
  912. SiteTypeID: 0,
  913. pager: {
  914. type: 1,
  915. nextLink: 'css;a.next[href]',
  916. pageElement: 'css;ul.post-loop > li',
  917. insertPosition: ['css;ul.post-loop', 3],
  918. replaceE: 'css;ul.pagination',
  919. scrollDelta: 1500
  920. },
  921. function: {
  922. before: ghxi_postlist_functionBefore
  923. }
  924. },
  925. sixyin: { // 六音软件 - 首页
  926. SiteTypeID: 0,
  927. host: 'www.sixyin.com',
  928. functionStart: function() {if (location.pathname === '/' && location.search === '') { // 首页
  929. curSite = DBSite.sixyin;
  930. } else if (location.pathname.indexOf('.html') === -1) { // 分类页
  931. curSite = DBSite.sixyin_postlist;
  932. }},
  933. pager: {
  934. type: 2,
  935. nextLink: '.load-more',
  936. nextHTML: '点击查看更多',
  937. scrollDelta: 1500
  938. }
  939. },
  940. sixyin_postlist: { // 六音软件 - 分类页
  941. SiteTypeID: 0,
  942. pager: {
  943. type: 1,
  944. nextLink: '//a[@class="next"][@href]',
  945. pageElement: 'css;ul.post-loop > li',
  946. insertPosition: ['css;ul.post-loop', 3],
  947. replaceE: 'css;ul.pagination',
  948. scrollDelta: 1500
  949. }
  950. },
  951. weidown: { // 微当下载
  952. SiteTypeID: 0,
  953. host: 'www.weidown.com',
  954. functionStart: function() {if (location.pathname.indexOf('/search/') > -1) { //搜索页
  955. curSite = DBSite.weidown_search;
  956. } else if (location.pathname.indexOf('/special/') > -1) { // 专题页
  957. curSite = DBSite.weidown_special;
  958. } else {
  959. curSite = DBSite.weidown;
  960. }},
  961. pager: {
  962. type: 1,
  963. nextLink: '//a[@class="nextpage"][@href]',
  964. pageElement: 'css;.articleWrapper > .itemArticle, .articleWrapper > .richTextItem.search',
  965. insertPosition: ['css;.articleWrapper', 3],
  966. replaceE: 'css;#pageGroup',
  967. scrollDelta: 1500
  968. }
  969. },
  970. weidown_search: { // 微当下载 - 搜索页
  971. SiteTypeID: 0,
  972. pager: {
  973. type: 1,
  974. nextLink: '//a[@class="nextpage"][@href]',
  975. pageElement: 'css;.articleListWrapper > .richTextItem.search',
  976. insertPosition: ['css;#pageGroup', 1],
  977. replaceE: 'css;#pageGroup',
  978. scrollDelta: 700
  979. }
  980. },
  981. weidown_special: { // 微当下载 - 专题页
  982. SiteTypeID: 0,
  983. pager: {
  984. type: 1,
  985. nextLink: '//a[@class="nextpage"][@href]',
  986. pageElement: 'css;.special > .item',
  987. insertPosition: ['css;.special', 3],
  988. replaceE: 'css;#pageGroup',
  989. scrollDelta: 700
  990. }
  991. },
  992. th_sjy: { // th-sjy 汉化
  993. SiteTypeID: 0,
  994. host: 'www.th-sjy.com',
  995. pager: {
  996. type: 1,
  997. nextLink: 'css;li.next-page > a',
  998. pageElement: 'css;.content > article',
  999. insertPosition: ['css;.pagination', 1],
  1000. replaceE: 'css;.pagination',
  1001. scrollDelta: 2000
  1002. }
  1003. },
  1004. iplaysoft_postslist: { // 异次元软件世界
  1005. SiteTypeID: 0,
  1006. host: 'www.iplaysoft.com',
  1007. functionStart: function() {if (location.pathname.indexOf('.html') > -1 || location.pathname.indexOf('/p/') > -1) { // 文章内
  1008. curSite = DBSite.iplaysoft_postcomments;
  1009. } else { // 其他页面
  1010. curSite = DBSite.iplaysoft_postslist;
  1011. }},
  1012. pager: {
  1013. type: 1,
  1014. nextLink: '//div[@class="pagenavi"]//a[@title="下一页"][@href]',
  1015. pageElement: 'css;#postlist > div.entry',
  1016. insertPosition: ['css;#postlist > .pagenavi-button', 1],
  1017. replaceE: 'css;.pagenavi-button, .pagenavi',
  1018. scrollDelta: 1200
  1019. },
  1020. function: {
  1021. before: iplaysoft_postslist_functionBefore
  1022. }
  1023. },
  1024. iplaysoft_postcomments: { // 异次元软件世界 - 评论
  1025. SiteTypeID: 0,
  1026. pager: {
  1027. type: 2,
  1028. nextLink: '#loadHistoryComments',
  1029. nextTextOf: '展开后面',
  1030. scrollDelta: 1200
  1031. }
  1032. },
  1033. mpyit: { // 老殁 | 殁漂遥
  1034. SiteTypeID: 0,
  1035. host: 'www.mpyit.com',
  1036. functionStart: function() {if (location.pathname === '/' && !location.search) {
  1037. curSite = DBSite.mpyit;
  1038. } else if (location.pathname.indexOf('/category/') > -1 || location.search.indexOf('?s=') > -1) { // 搜索页 / 分类页
  1039. curSite = DBSite.mpyit_category;
  1040. }},
  1041. pager: {
  1042. type: 1,
  1043. nextLink: '//a[@class="page-numbers"][@title="下一页"][@href]',
  1044. pageElement: 'css;#post > div[id^="post-"]',
  1045. insertPosition: ['css;#post > #pagenavi', 1],
  1046. replaceE: 'css;#post > #pagenavi',
  1047. scrollDelta: 1700
  1048. }
  1049. },
  1050. mpyit_category: { // 老殁 | 殁漂遥 - 搜索页/分类页
  1051. SiteTypeID: 0,
  1052. pager: {
  1053. type: 1,
  1054. nextLink: '//a[@class="page-numbers"][@title="下一页"][@href]',
  1055. pageElement: 'css;#content > div[class^="entry_box"]',
  1056. insertPosition: ['css;#content > #pagenavi', 1],
  1057. replaceE: 'css;#content > #pagenavi',
  1058. scrollDelta: 1700
  1059. }
  1060. },
  1061. yxssp: { // 异星软件空间
  1062. SiteTypeID: 0,
  1063. host: 'www.yxssp.com',
  1064. pager: {
  1065. type: 1,
  1066. nextLink: '//div[@class="page-nav td-pb-padding-side"]/a[last()][@href]',
  1067. pageElement: 'css;.td-modules-container.td-module-number4 > div',
  1068. insertPosition: ['css;.td-modules-container.td-module-number4', 3],
  1069. replaceE: 'css;.page-nav.td-pb-padding-side',
  1070. scrollDelta: 1000
  1071. }
  1072. },
  1073. sordum: {
  1074. SiteTypeID: 0,
  1075. host: 'www.sordum.org',
  1076. pager: {
  1077. type: 1,
  1078. nextLink: '//a[@class="next page-numbers"][@href]',
  1079. pageElement: 'css;.article > article',
  1080. insertPosition: ['css;nav.navigation.posts-navigation', 1],
  1081. replaceE: 'css;nav.navigation.posts-navigation',
  1082. scrollDelta: 1500
  1083. }
  1084. },
  1085. winaero: {
  1086. SiteTypeID: 0,
  1087. host: 'winaero.com',
  1088. functionStart: function() {if (location.pathname === '/blog/' || location.pathname.indexOf('/category/') > -1) curSite = DBSite.winaero;},
  1089. pager: {
  1090. type: 1,
  1091. nextLink: 'css;.nav-previous > a',
  1092. pageElement: 'css;#content > article',
  1093. insertPosition: ['css;#nav-below', 1],
  1094. replaceE: 'css;#nav-below',
  1095. scrollDelta: 1500
  1096. }
  1097. },
  1098. thewindowsclub: {
  1099. SiteTypeID: 0,
  1100. host: 'www.thewindowsclub.com',
  1101. functionStart: function() {curSite = DBSite.thewindowsclub; if (location.pathname === '/') {curSite.pager.scrollDelta = 2000;}},
  1102. pager: {
  1103. type: 1,
  1104. nextLink: 'css;li.pagination-next > a',
  1105. pageElement: 'css;#genesis-content > article',
  1106. insertPosition: ['css;.pagination', 1],
  1107. replaceE: 'css;.pagination',
  1108. scrollDelta: 1500
  1109. }
  1110. },
  1111. cartoonmad: { // 动漫狂
  1112. SiteTypeID: 0,
  1113. host: ['www.cartoonmad.com','www.cartoonmad.cc'],
  1114. functionStart: function() {if (location.pathname.indexOf('/comic/') > -1) {
  1115. document.lastElementChild.appendChild(document.createElement('style')).textContent = '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;}';
  1116. document.querySelector('body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child > a').href = 'javascript:void(0);'; // 清理图片上的链接
  1117. curSite = DBSite.cartoonmad;
  1118. }},
  1119. pager: {
  1120. type: 1,
  1121. nextLink: cartoonmad_functionNext,
  1122. pageElement: 'css;body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child img',
  1123. insertPosition: ['css;body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child > a', 3],
  1124. replaceE: 'css;body > table > tbody > tr:nth-child(2), body > table > tbody > tr:nth-child(5)',
  1125. mimeType: 'text/html; charset=big5',
  1126. scrollDelta: 2000
  1127. }
  1128. },
  1129. manhuadb: { // 漫画 DB
  1130. SiteTypeID: 0,
  1131. host: 'www.manhuadb.com',
  1132. functionStart: function() {if (location.pathname.indexOf('/manhua/') > -1 && location.pathname.indexOf('.html') > -1) {
  1133. document.lastElementChild.appendChild(document.createElement('style')).textContent = '.row.m-0.pt-3.ad_2_wrap, .row.m-0.ad_1_wrap, .pagination.justify-content-center, #left, #right {display: none !important;}';
  1134. document.querySelector('img.img-fluid.show-pic').style.display = 'none'; // 隐藏第一个图片(避免重复)
  1135. setTimeout(manhuadb_init, 100);
  1136. curSite = DBSite.manhuadb;
  1137. }},
  1138. pager: {
  1139. type: 4,
  1140. nextLink: manhuadb_functionNext,
  1141. pageElement: 'css;body > script:not([type]):not([src]), .vg-r-data, ol.links-of-books.num_div',
  1142. insertPosition: ['css;.pjax-container', 3],
  1143. insertElement: manhuadb_insertElement,
  1144. intervals: 5000,
  1145. scrollDelta: 3000
  1146. }
  1147. },
  1148. hicomic: { // 嗨漫画
  1149. SiteTypeID: 0,
  1150. host: 'www.hicomic.net',
  1151. functionStart: function() {if (location.pathname.indexOf('/chapters/') > -1) {
  1152. document.lastElementChild.appendChild(document.createElement('style')).textContent = '.content {height: auto !important;} .footer, .left_cursor, .right_cursor, .finish {display: none !important;} .content > img {display: block !important;margin: 0 auto !important;}';
  1153. setTimeout(hicomic_init, 100);
  1154. curSite = DBSite.hicomic;
  1155. }},
  1156. pager: {
  1157. type: 4,
  1158. nextLink: hicomic_functionNext,
  1159. insertPosition: ['css;.content', 3],
  1160. insertElement: hicomic_insertElement,
  1161. intervals: 5000,
  1162. scrollDelta: 3000
  1163. }
  1164. },
  1165. gufengmh8: { // 古风漫画网
  1166. SiteTypeID: 0,
  1167. host: 'www.gufengmh8.com',
  1168. functionStart: function() {if (location.pathname.indexOf('.html') > -1) {
  1169. let chapterScroll = document.getElementById('chapter-scroll') // 强制为 [下拉阅读] 模式
  1170. if (chapterScroll && chapterScroll.className === '') {chapterScroll.click();}
  1171. curSite = DBSite.gufengmh8; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'p.img_info {display: none !important;}'; // 隐藏中间的页数信息
  1172. }},
  1173. pager: {
  1174. type: 4,
  1175. nextLink: gufengmh8_functionNext,
  1176. pageElement: 'css;body > script:first-child',
  1177. insertPosition: ['css;#images', 3],
  1178. insertElement: gufengmh8_insertElement,
  1179. intervals: 5000,
  1180. scrollDelta: 4000
  1181. }
  1182. },
  1183. szcdmj: { // 砂之船动漫家
  1184. SiteTypeID: 0,
  1185. host: 'www.szcdmj.com',
  1186. functionStart: function() {if (location.pathname.indexOf('/szcchapter/') > -1) {curSite = DBSite.szcdmj; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.header {opacity: 0.3 !important;}';}},
  1187. pager: {
  1188. type: 1,
  1189. nextLink: '//div[@class="fanye"][1]/a[@href][text()="下一页" or text()="下一话"]',
  1190. pageElement: 'css;.comicpage > div,title',
  1191. insertPosition: ['css;.comicpage', 3],
  1192. replaceE: 'css;.fanye,h1.title',
  1193. scrollDelta: 2000
  1194. },
  1195. function: {
  1196. before: szcdmj_functionBefore
  1197. }
  1198. },
  1199. netbian: { // 彼岸图网
  1200. SiteTypeID: 0,
  1201. host: 'pic.netbian.com',
  1202. functionStart: function() {curSite = DBSite.netbian; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'li.nextpage {display: none !important;}';},
  1203. pager: {
  1204. type: 1,
  1205. nextLink: '//div[@class="page"]/a[contains(text(),"下一页")]',
  1206. pageElement: 'css;.slist ul > li:not(.nextpage)',
  1207. insertPosition: ['css;.slist ul', 3],
  1208. replaceE: 'css;.page',
  1209. mimeType: 'text/html; charset=gbk',
  1210. scrollDelta: 1000
  1211. }
  1212. },
  1213. pubmed: { // 学术
  1214. SiteTypeID: 0,
  1215. host: 'pubmed.ncbi.nlm.nih.gov',
  1216. pager: {
  1217. type: 2,
  1218. nextLink: 'button.load-button.next-page',
  1219. nextText: 'Show more',
  1220. scrollDelta: 1500
  1221. }
  1222. },
  1223. wikihow: { // 指南
  1224. SiteTypeID: 0,
  1225. host: ['www.wikihow.com', 'zh.wikihow.com'],
  1226. functionStart: function() {if (location.pathname.indexOf('/Category:') > -1) {
  1227. curSite = DBSite.wikihow;
  1228. } else if (location.pathname.indexOf('/wikiHowTo') > -1 && location.search.indexOf('?search=') > -1) {
  1229. curSite = DBSite.wikihow_search;
  1230. }},
  1231. pager: {
  1232. type: 1,
  1233. nextLink: 'css;a.pag_next',
  1234. pageElement: 'css;#cat_all > .cat_grid > div',
  1235. insertPosition: ['css;#cat_all > .cat_grid', 3],
  1236. replaceE: 'css;#large_pagination',
  1237. scriptType: 3,
  1238. scrollDelta: 2000
  1239. }
  1240. },
  1241. wikihow_search: { // 指南
  1242. SiteTypeID: 0,
  1243. pager: {
  1244. type: 1,
  1245. nextLink: 'css;#searchresults_footer > a.buttonright',
  1246. pageElement: 'css;#searchresults_list > a',
  1247. insertPosition: ['css;#searchresults_list', 3],
  1248. replaceE: 'css;#searchresults_footer',
  1249. scrollDelta: 3000
  1250. }
  1251. },
  1252. afreecatv: { // 直播
  1253. SiteTypeID: 0,
  1254. host: 'www.afreecatv.com',
  1255. pager: {
  1256. type: 2,
  1257. nextLink: '.btn-more > button',
  1258. intervals: 2000,
  1259. scrollDelta: 1000
  1260. }
  1261. },
  1262. greasyfork: { // 脚本
  1263. SiteTypeID: 0,
  1264. host: 'greasyfork.org',
  1265. functionStart: function() {if (location.pathname.indexOf('/scripts') + 8 === location.pathname.length) {
  1266. curSite = DBSite.greasyfork;
  1267. } else if (location.pathname.lastIndexOf('/feedback') + 9 === location.pathname.length) {
  1268. curSite = DBSite.greasyfork_feedback;
  1269. } else if (location.pathname.lastIndexOf('/discussions') + 12 === location.pathname.length) {
  1270. curSite = DBSite.greasyfork_discussions;
  1271. }},
  1272. pager: {
  1273. type: 1,
  1274. nextLink: '//a[@class="next_page"][@href]',
  1275. pageElement: 'css;ol#browse-script-list > li',
  1276. insertPosition: ['css;ol#browse-script-list', 3],
  1277. replaceE: 'css;.pagination',
  1278. scrollDelta: 1000
  1279. }
  1280. },
  1281. greasyfork_feedback: { // 反馈页
  1282. SiteTypeID: 0,
  1283. pager: {
  1284. type: 1,
  1285. nextLink: '//a[@class="next_page"][@href]',
  1286. pageElement: 'css;.script-discussion-list > div',
  1287. insertPosition: ['css;.script-discussion-list', 3],
  1288. replaceE: 'css;.pagination',
  1289. scrollDelta: 1500
  1290. }
  1291. },
  1292. greasyfork_discussions: { // 讨论页
  1293. SiteTypeID: 0,
  1294. pager: {
  1295. type: 1,
  1296. nextLink: '//a[@class="next_page"][@href]',
  1297. pageElement: 'css;.discussion-list > div',
  1298. insertPosition: ['css;.discussion-list', 3],
  1299. replaceE: 'css;.pagination',
  1300. scrollDelta: 1000
  1301. }
  1302. },
  1303. ruyile_xuexiao: { // 如意了教育 - 学校名录
  1304. SiteTypeID: 0,
  1305. host: 'www.ruyile.com',
  1306. functionStart: function() {
  1307. if (location.pathname === '/xuexiao/') {
  1308. curSite = DBSite.ruyile_xuexiao;
  1309. } else if (location.pathname === '/data/') {
  1310. curSite = DBSite.ruyile_data;
  1311. } else if (location.pathname === '/shijuan/') {
  1312. curSite = DBSite.ruyile_shijuan;
  1313. }},
  1314. pager: {
  1315. type: 1,
  1316. nextLink: '//div[@class="fy"]/a[contains(text(), "下一页")][@href]',
  1317. pageElement: 'css;.xxlb > .sk',
  1318. insertPosition: ['css;.xxlb', 3],
  1319. replaceE: 'css;.fy',
  1320. scrollDelta: 1000
  1321. }
  1322. },
  1323. ruyile_data: { // 如意了教育 - 数据
  1324. SiteTypeID: 0,
  1325. pager: {
  1326. type: 1,
  1327. nextLink: '//div[@class="fy"]/a[contains(text(), "下一页")][@href]',
  1328. pageElement: 'css;.m1_z > .lbk',
  1329. insertPosition: ['css;.page', 1],
  1330. replaceE: 'css;.fy',
  1331. scrollDelta: 1000
  1332. }
  1333. },
  1334. ruyile_shijuan: { // 如意了教育 - 试卷
  1335. SiteTypeID: 0,
  1336. pager: {
  1337. type: 1,
  1338. nextLink: '//div[@class="fy"]/a[contains(text(), "下一页")][@href]',
  1339. pageElement: 'css;.m1_z > .m2_lb',
  1340. insertPosition: ['css;.page', 1],
  1341. replaceE: 'css;.fy',
  1342. scrollDelta: 1000
  1343. }
  1344. }
  1345. };
  1346. // 生成 SiteTypeID
  1347. generateID();
  1348. // 用于脚本判断(针对部分特殊的网站)
  1349. SiteType = {
  1350. BAIDU_TIEBA: DBSite.baidu_tieba.SiteTypeID,
  1351. GAMERSKY_GL: DBSite.gamersky_gl.SiteTypeID
  1352. };
  1353. }
  1354.  
  1355.  
  1356. // < 所有 Discuz!论坛 >
  1357. if (webType != 1) {
  1358. if (webType === 2) {
  1359. if (location.pathname.indexOf('.html') > -1) { // 判断是不是静态网页(.html 结尾)
  1360. if (location.pathname.indexOf('/forum-') > -1) { // < 各版块帖子列表 >
  1361. if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮
  1362. curSite = DBSite.discuz_forum;
  1363. } else {
  1364. curSite = DBSite.discuz_guide;
  1365. }
  1366. } else if (location.pathname.indexOf('/thread-') > -1) { // < 帖子内 >
  1367. if (GM_getValue('menu_discuz_thread_page')) {
  1368. curSite = DBSite.discuz_thread;
  1369. hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮
  1370. }
  1371. } else if(location.pathname.indexOf('search') > -1) { // < 搜索结果 >
  1372. curSite = DBSite.discuz_search;
  1373. }
  1374. } else {
  1375. if (location.search.indexOf('mod=forumdisplay') > -1 || location.pathname.indexOf('forumdisplay.php') > -1) { // < 各版块帖子列表 >
  1376. if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮
  1377. curSite = DBSite.discuz_forum;
  1378. } else {
  1379. curSite = DBSite.discuz_guide;
  1380. }
  1381. } else if (location.search.indexOf('mod=viewthread') > -1 || location.pathname.indexOf('viewthread.php') > -1) { // < 帖子内 >
  1382. if (GM_getValue('menu_discuz_thread_page')) {
  1383. curSite = DBSite.discuz_thread;
  1384. hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮
  1385. }
  1386. } else if (location.search.indexOf('mod=guide') > -1) { // < 导读帖子列表 >
  1387. curSite = DBSite.discuz_guide;
  1388. } else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复
  1389. curSite = DBSite.discuz_youspace;
  1390. } else if (location.search.indexOf('mod=collection') > -1) { // < 淘贴列表 >
  1391. curSite = DBSite.discuz_collection;
  1392. } else if (location.pathname.indexOf('search') > -1) { // < 搜索结果 >
  1393. curSite = DBSite.discuz_search;
  1394. } else { // < 考虑到部分论坛的部分板块帖子列表 URL 是自定义的 >
  1395. curSite = DBSite.discuz_forum;
  1396. }
  1397. }
  1398. // < 所有 Flarum 论坛 >
  1399. } else if (webType === 3) {
  1400. curSite = DBSite.flarum;
  1401. // < 所有使用 WordPress DUX 主题的网站 >
  1402. } else if (webType === 4) {
  1403. if (location.pathname.indexOf('.html') === -1) curSite = DBSite.dux;
  1404. if (location.host === 'apphot.cc') curSite.pager.scrollDelta = 2500; // 对于速度慢的网站,需要增加翻页敏感度
  1405. }
  1406. }
  1407.  
  1408. pausePageEvent(); // 左键双击网页空白处暂停翻页
  1409. curSite.pageUrl = ''; // 下一页URL
  1410. //console.log(curSite);
  1411. pageLoading(); // 自动无缝翻页
  1412.  
  1413.  
  1414. // 隐藏帖子内的 [下一页] 按钮(Discuz! 论坛)
  1415. function hidePgbtn() {
  1416. document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}';
  1417. }
  1418.  
  1419.  
  1420. // dux 的插入前函数(加载图片)
  1421. function dux_functionBefore(pageElems) {
  1422. pageElems.forEach(function (one) {
  1423. let now = one.querySelector('img.thumb[data-src]')
  1424. if (now) {now.src = now.dataset.src;}
  1425. });
  1426. return pageElems
  1427. }
  1428.  
  1429.  
  1430. // 百度贴吧(发帖按钮点击事件)
  1431. function baidu_tieba_1() {
  1432. let button = document.querySelector('.tbui_aside_fbar_button.tbui_fbar_post > a');
  1433. if (button) {
  1434. button.remove();
  1435. document.querySelector('li.tbui_aside_fbar_button.tbui_fbar_down').insertAdjacentHTML(addTo(4), '<li class="tbui_aside_fbar_button tbui_fbar_post"><a href="javascript:void(0);" title="因为 [自动无缝翻页] 的原因,请点击该按钮发帖!"></a></li>')
  1436. button = document.querySelector('.tbui_aside_fbar_button.tbui_fbar_post > a');
  1437. if (button) {
  1438. button.onclick = function(){
  1439. let button2 = document.querySelector('div.edui-btn.edui-btn-fullscreen.edui-btn-name-portrait');
  1440. if (button2) {
  1441. button2.click();
  1442. } else {
  1443. alert('提示:登录后才能发帖!');
  1444. }
  1445. return false;
  1446. }
  1447. }
  1448. }
  1449. }
  1450. // 百度贴吧 的插入前函数(加载图片)
  1451. function baidu_tieba_functionBefore(pageElems) {
  1452. pageElems.forEach(function (one) {
  1453. one.querySelectorAll('img.threadlist_pic[data-original]').forEach(function (now) {
  1454. now.src = now.dataset.original;
  1455. now.style.display = 'inline';
  1456. })
  1457. });
  1458. return pageElems
  1459. }
  1460. // 百度贴吧 获取下一页地址
  1461. function baidu_tieba_functionNext() {
  1462. let next = document.querySelector('a.next.pagination-item[href]');
  1463. if (next != null && next.nodeType === 1 && next.href && next.href.slice(0,4) === 'http') {
  1464. var url = next.href + '&pagelets=frs-list%2Fpagelet%2Fthread&pagelets_stamp=' + new Date().getTime();
  1465. if (url === curSite.pageUrl) return
  1466. curSite.pageUrl = url;
  1467. getPageElems(curSite.pageUrl);
  1468. };
  1469. }
  1470. // 百度贴吧 插入数据
  1471. function baidu_tieba_insertElement(newBody, type) {
  1472. if (!newBody) return
  1473. let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody),
  1474. toElement = getAllElements(curSite.pager.insertPosition[0])[0];
  1475. if (pageElems.length >= 0) {
  1476. // 执行插入前函数
  1477. pageElems = curSite.function.before(pageElems);
  1478. // 插入位置
  1479. let addTo1 = addTo(curSite.pager.insertPosition[1]);
  1480. // 获取 <script> 内容
  1481. const scriptElems = getAllElements('//script', newBody, newBody);
  1482. let scriptText = '';
  1483. for (let i = 0; i < scriptElems.length; i++) {
  1484. if (scriptElems[i].textContent.indexOf('Bigpipe.register("frs-list/pagelet/thread_list"') > -1) {
  1485. scriptText = scriptElems[i].textContent.replace('Bigpipe.register("frs-list/pagelet/thread_list", ','');
  1486. break
  1487. }
  1488. }
  1489. if (scriptText) {
  1490. scriptText = scriptText.slice(0, scriptText.indexOf(').')) // 获取主体内容
  1491. let scriptJSON = JSON.parse(scriptText).content; // 字符串转 JSON
  1492. var temp_baidu_tieba = document.createElement('div'); temp_baidu_tieba.innerHTML = scriptJSON; // 字符串转 Element 元素
  1493. pageElems = curSite.function.before(getAllElements(curSite.pager.pageElement, temp_baidu_tieba, temp_baidu_tieba)); // 插入前执行函数
  1494. pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);}); // 插入元素
  1495. // 替换元素
  1496. let oriE = document.querySelectorAll(curSite.pager.pageElement.replace('css;', '')),
  1497. repE = getAllElements(curSite.pager.replaceE, temp_baidu_tieba, temp_baidu_tieba);
  1498. if (oriE.length === repE.length) {
  1499. for (let i = 0; i < oriE.length; i++) {
  1500. oriE[i].outerHTML = repE[i].outerHTML;
  1501. }
  1502. }
  1503. }
  1504. }
  1505. }
  1506.  
  1507.  
  1508. // NGA 的插入后函数(加载各版块帖子列表样式)
  1509. function nga_thread_functionAfter() {
  1510. document.body.appendChild(document.createElement('script')).textContent = 'commonui.topicArg.loadAll();';
  1511. }
  1512.  
  1513. // V2EX 的插入后函数(新标签页打开链接)
  1514. function v2ex_functionAfter(css) {
  1515. let links = document.querySelectorAll(css);if (!links) return
  1516. links.forEach(function (_this) {_this.target = '_blank';});
  1517. }
  1518.  
  1519.  
  1520. // 58pic 的插入前函数(加载图片)
  1521. function _58pic_functionBefore(pageElems) {
  1522. let is_one = document.querySelector('.qtw-card.place-box.is-one');
  1523. if (is_one && is_one.style.display != 'none') {is_one.style.display = 'none';}
  1524. pageElems.forEach(function (one) {
  1525. let now = one.querySelector('img.lazy')
  1526. if (now && now.getAttribute('src') != now.dataset.original) {
  1527. now.src = now.dataset.original;
  1528. now.style.display = 'block';
  1529. }
  1530. });
  1531. return pageElems
  1532. }
  1533.  
  1534.  
  1535. // Pixabay 的插入前函数(加载图片)
  1536. function pixabay_functionBefore(pageElems) {
  1537. pageElems.forEach(function (one) {
  1538. let now = one.querySelector('img[data-lazy-src]')
  1539. if (now) {
  1540. now.src = now.dataset.lazySrc;
  1541. now.removeAttribute('data-lazy-src')
  1542. now.removeAttribute('data-lazy-srcset')
  1543. }
  1544. });
  1545. return pageElems
  1546. }
  1547.  
  1548.  
  1549. // 游民星空攻略 的插入前函数(移除下一页底部的 "更多相关内容请关注:xxx" 文字)
  1550. function gamersky_gl_functionBefore(pageElems) {
  1551. pageElems.forEach(function (one) {
  1552. if (one.tagName === 'P' && one.textContent.indexOf('更多相关内容请关注') > -1) {one.style.display = 'none';}
  1553. });
  1554. return pageElems
  1555. }
  1556.  
  1557.  
  1558. // NexusMods 获取下一页地址
  1559. function nexusmods_functionNext() {
  1560. if (document.querySelector('.nexus-ui-blocker')) return
  1561. let out_items = JSON.stringify(RH_ModList.out_items).replace(/{|}|"/g,''),
  1562. nextNum = getElementByXpath('id("mod-list")/div[contains(@class, "pagenav")][1]//a[contains(@class, "page-selected")]/parent::li/following-sibling::li/a'),
  1563. categories = RH_ModList.out_items.categories, categoriesUrl = '';
  1564. var url = '';
  1565. if (nextNum && nextNum.innerText) {
  1566. nextNum = nextNum.innerText;
  1567. if (out_items.indexOf('page:') > -1) {
  1568. out_items = out_items.replace(/page:\d+/, `page:${nextNum}`)
  1569. } else {
  1570. out_items += `,page:${nextNum}`;
  1571. }
  1572. if (categories && categories != []) {
  1573. for (let i = 0; i < categories.length; i++) {
  1574. categoriesUrl += `,categories[]:${categories[i]}`
  1575. }
  1576. categoriesUrl = categoriesUrl.replace(/,/,'');
  1577. if (out_items.indexOf('categories:') > -1) {
  1578. out_items = out_items.replace(/categories:\[.*\]/, categoriesUrl)
  1579. }
  1580. }
  1581. url = 'https://www.nexusmods.com' + RH_ModList.uri + '?RH_ModList=' + out_items
  1582. //console.log(nextNum, url, curSite.pageUrl, out_items)
  1583. if (url === curSite.pageUrl) return
  1584. curSite.pageUrl = url;
  1585. //console.log(nextNum, curSite.pageUrl, out_items)
  1586. getPageElems(curSite.pageUrl)
  1587. }
  1588. }
  1589. // NexusMods 插入数据
  1590. function nexusmods_insertElement(newBody, type) {
  1591. if (!newBody) return
  1592. let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody), // 主体元素
  1593. toElement = getAllElements(curSite.pager.insertPosition[0])[0], // 插入位置的元素
  1594. addTo1 = addTo(curSite.pager.insertPosition[1]); // 插入位置
  1595. // 添加下载数据
  1596. pageElems.forEach(function (one) {
  1597. let now = one.querySelector('.mod-tile-left');
  1598. if (now) {
  1599. let downloadCount = now.querySelector('.downloadcount > span.flex-label');
  1600. if (downloadCount) {
  1601. downloadCount.textContent = shortFormat(parseInt(GlobalModStats[now.dataset.gameId][now.dataset.modId].total));
  1602. }
  1603. }
  1604. });
  1605. // 插入网页
  1606. pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);});
  1607. // 替换元素
  1608. let oriE = document.querySelectorAll(curSite.pager.replaceE.replace('css;', '')),
  1609. repE = getAllElements(curSite.pager.replaceE, newBody, newBody);
  1610. if (oriE.length === repE.length) {
  1611. for (let i = 0; i < oriE.length; i++) {
  1612. oriE[i].outerHTML = repE[i].outerHTML;
  1613. }
  1614. }
  1615. }
  1616.  
  1617.  
  1618. // 片库 的插入前函数(加载图片)
  1619. function mypianku_functionBefore(pageElems) {
  1620. pageElems.forEach(function (one) {
  1621. let now = one.querySelector('img')
  1622. if (now) {
  1623. now.src = now.dataset.src;
  1624. }
  1625. });
  1626. return pageElems
  1627. }
  1628.  
  1629.  
  1630. // iao.su 的插入前函数(加载图片)
  1631. function iao_su_functionBefore(pageElems) {
  1632. pageElems.forEach(function (one) {
  1633. let now = one.getElementsByClassName('post-card')[0]
  1634. if (now) {
  1635. now.getElementsByClassName('blog-background')[0].style.backgroundImage = 'url("' + now.getElementsByTagName('script')[0].textContent.split("'")[1] + '")';
  1636. //now.getElementsByClassName('blog-background')[0].style.backgroundImage = 'url("' + RegExp("(?<=loadBannerDirect\\(').*(?=', '',)").exec(now.getElementsByTagName('script')[0].textContent)[0]; + '")';
  1637. }
  1638. });
  1639. return pageElems
  1640. }
  1641.  
  1642.  
  1643. // 果核剥壳 的插入前函数(加载图片)
  1644. function ghxi_postlist_functionBefore(pageElems) {
  1645. pageElems.forEach(function (one) {
  1646. let now = one.querySelector('img')
  1647. if (now) {
  1648. now.src = now.dataset.original;
  1649. }
  1650. });
  1651. return pageElems
  1652. }
  1653.  
  1654.  
  1655. // iplaysoft 的插入前函数(加载图片)
  1656. function iplaysoft_postslist_functionBefore(pageElems) {
  1657. pageElems.forEach(function (one) {
  1658. let now = one.querySelector('img.lazyload')
  1659. if (now && !now.src) {
  1660. now.src = now.dataset.src;
  1661. now.setAttribute('srcset', now.dataset.src)
  1662. now.setAttribute('class', 'lazyloaded')
  1663. }
  1664. });
  1665. return pageElems
  1666. }
  1667.  
  1668.  
  1669. // cs_rin_ru 各版块帖子列表的插入前函数(过滤置顶帖子)
  1670. function cs_rin_ru_functionBefore(pageElems) {
  1671. for (let i = 0; i < pageElems.length; i++) {
  1672. if (pageElems[i].textContent.replace(/\n| /g,'') === 'Topics') {
  1673. pageElems.splice(0,i+1);
  1674. break;
  1675. }
  1676. }
  1677. return pageElems
  1678. }
  1679.  
  1680.  
  1681. // 漫画狂 获取下一页地址
  1682. function cartoonmad_functionNext() {
  1683. let nextXPAHT = '//a[@class="pages"][contains(text(),"下一頁")]',
  1684. nextPXPATH = '//a[@class="pages"][contains(string(),"下一話")]'
  1685. let url = getElementByXpath(nextXPAHT);
  1686. if (url) {
  1687. if (url.getAttribute('href') === 'thend.asp') {
  1688. url = getElementByXpath(nextPXPATH)
  1689. if (url) return url.href;
  1690. pausePage = false;
  1691. GM_notification({text: `注意:该网站早期漫画(如海贼王、柯南)因为网站自身问题而无法翻至下一话(仅限于显示为 [第 X 卷]/[下一卷] 的)。\n因此需要手动去 [目录页] 进入下一卷!`, timeout: 10000});
  1692. } else {
  1693. return url.href;
  1694. }
  1695. }
  1696. return '';
  1697. }
  1698.  
  1699.  
  1700. // manhuadb 初始化(将本话其余图片插入网页中)
  1701. function manhuadb_init() {
  1702. let _img = '',
  1703. data = document.querySelector('.vg-r-data'), imgDate;
  1704. if (!data) return
  1705. document.querySelectorAll(curSite.pager.pageElement.replace('css;', '')).forEach(function (one) {
  1706. if (one.tagName === 'SCRIPT' && one.textContent.indexOf('var img_data =') > -1) {
  1707. let json = JSON.parse(window.atob(one.textContent.split("'")[1]));
  1708. if (json) {
  1709. let _img = '';
  1710. for (let i = 0; i < json.length; i++) { // 遍历图片文件名数组,组合为 img 标签
  1711. let src = data.dataset.host + data.dataset.img_pre + json[i].img;
  1712. _img += `<img class="img-fluid show-pic" src="${src}">`
  1713. }
  1714. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  1715. }
  1716. }
  1717. })
  1718. }
  1719. // manhuadb 获取下一页地址
  1720. function manhuadb_functionNext() {
  1721. let nextArr = document.querySelectorAll('a.fixed-a-es'), next;
  1722. var url = '';
  1723. if (nextArr.length == 0) return
  1724. for (let i = 0; i < nextArr.length; i++) {
  1725. if (nextArr[i].className.indexOf('active') > -1) {
  1726. if (nextArr[i+1]) url = nextArr[i+1].href;
  1727. break;
  1728. }
  1729. }
  1730. if (url === curSite.pageUrl) return
  1731. curSite.pageUrl = url
  1732. getPageElems(curSite.pageUrl);
  1733. }
  1734. // manhuadb 插入数据
  1735. function manhuadb_insertElement(pageElems, type) {
  1736. if (!pageElems) return
  1737. let oriE = document.querySelectorAll(curSite.pager.pageElement.replace('css;', '')),
  1738. repE = getAllElements(curSite.pager.pageElement, pageElems, pageElems);
  1739. if (oriE.length === repE.length) {
  1740. for (let i = 0; i < oriE.length; i++) {
  1741. oriE[i].outerHTML = repE[i].outerHTML;
  1742. }
  1743. manhuadb_init(); // 将刚刚替换的图片插入网页中
  1744. }
  1745. }
  1746.  
  1747.  
  1748. // hicomic 初始化(将本话其余图片插入网页中)
  1749. function hicomic_init() {
  1750. let _img = '';
  1751. document.querySelectorAll('.chapter > section:not(:first-child) > section[val]').forEach(function (one) {
  1752. let src = one.getAttribute('val');
  1753. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h'
  1754. _img += `<img src="${src}">`
  1755. })
  1756. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  1757. window.document.title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${document.querySelector('.chapter_name').textContent}) - HiComic`); // 修改网页标题(加上 第 X 话)
  1758. }
  1759. // hicomic 获取下一页地址
  1760. function hicomic_functionNext() {
  1761. let nextId;
  1762. nextId = document.querySelector('.next_chapter:not(.end)')
  1763. if (nextId && nextId.id && nextId.id != 'None') {
  1764. curSite.pageUrl = location.href;
  1765. getPageElems(`https://www.hicomic.net/api/web/chapter/${nextId.id}/contents`, 'json');
  1766. }
  1767. }
  1768. // hicomic 插入数据
  1769. function hicomic_insertElement(pageElems, type) {
  1770. if (!pageElems || pageElems.code != 200) return
  1771. if (pageElems.results.chapter.next) { // 写入下一页的 UUID
  1772. document.querySelector('.next_chapter').id = pageElems.results.chapter.next;
  1773. } else {
  1774. document.querySelector('.next_chapter').id = 'None';
  1775. document.querySelector('.next_chapter').classList.add('end');
  1776. }
  1777. document.querySelector('.chapter_name').textContent = pageElems.results.chapter.name; // 修改漫画标题
  1778. let title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${pageElems.results.chapter.name}) - HiComic`)
  1779. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, curSite.pageUrl); // 添加历史记录
  1780. window.document.title = title; // 修改当前网页标题为下一话的标题
  1781. let _img = '';
  1782. for (let i = 0; i < pageElems.results.chapter.contents.length; i++) { // 遍历图片文件名数组,组合为 img 标签
  1783. let src = pageElems.results.chapter.contents[i].url;
  1784. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h';
  1785. _img += `<img src="${src}">`
  1786. }
  1787. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  1788. }
  1789.  
  1790.  
  1791. // gufengmh8 获取下一页地址
  1792. function gufengmh8_functionNext() {
  1793. let pageElems = document.querySelector(curSite.pager.pageElement.replace('css;', '')); // 寻找数据所在元素
  1794. if (pageElems) {
  1795. let comicUrl, nextId;
  1796. var url = '';
  1797. pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历
  1798. //console.log(one)
  1799. if (one.indexOf('comicUrl') > -1) { // 下一页 URL 前半部分
  1800. comicUrl = one.split('"')[1];
  1801. } else if (one.indexOf('nextChapterData') > -1) { // 下一页 URL 的后半部分 ID
  1802. nextId = one.split('"id":')[1].split(',')[0];
  1803. }
  1804. })
  1805. if (comicUrl && nextId && nextId != 'null') { // 组合到一起就是下一页 URL
  1806. url = comicUrl + nextId + '.html'
  1807. if (url === curSite.pageUrl) return
  1808. curSite.pageUrl = url
  1809. getPageElems(curSite.pageUrl); // 访问下一页 URL 获取
  1810. }
  1811. }
  1812. }
  1813. // gufengmh8 插入数据
  1814. function gufengmh8_insertElement(pageElems, type) {
  1815. if (pageElems) {
  1816. let url = curSite.pageUrl;
  1817. pageElems = getAllElements(curSite.pager.pageElement, pageElems, pageElems)[0];
  1818. let chapterImages, chapterPath;
  1819. document.querySelector(curSite.pager.pageElement.replace('css;', '')).innerText = pageElems.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL
  1820. pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历
  1821. //console.log(one)
  1822. if (one.indexOf('chapterImages') > -1) { // 图片文件名数组
  1823. chapterImages = one.replace(/^.+\[/, '').replace(']', '').replaceAll('"', '').split(',')
  1824. } else if (one.indexOf('chapterPath') > -1) { // 图片文件路径
  1825. chapterPath = one.split('"')[1];
  1826. } else if (one.indexOf('pageTitle') > -1) { // 网页标题
  1827. let title = one.split('"')[1];
  1828. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, url); // 添加历史记录
  1829. window.document.title = title; // 修改当前网页标题为下一页的标题
  1830. }
  1831. })
  1832. if (chapterImages && chapterPath) {
  1833. let _img = '';
  1834. chapterImages.forEach(function (one2){ // 遍历图片文件名数组,组合为 img 标签
  1835. _img += '<img src="https://res.xiaoqinre.com/' + chapterPath + one2 + '" data-index="0" style="display: inline-block;">'
  1836. })
  1837. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  1838. }
  1839. }
  1840. }
  1841.  
  1842.  
  1843. // szcdmj 的插入前函数(加载图片)
  1844. function szcdmj_functionBefore(pageElems) {
  1845. pageElems.forEach(function (one) {
  1846. if (one.tagName === 'TITLE') {
  1847. let title = one.textContent;
  1848. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, curSite.pageUrl); // 添加历史记录
  1849. window.document.title = title; // 修改当前网页标题为下一页的标题
  1850. one.style.display = 'none';
  1851. } else {
  1852. let now = one.querySelector('img[data-original]')
  1853. if (now) {
  1854. now.src = now.dataset.original;
  1855. now.style.display = 'inline';
  1856. }
  1857. }
  1858. });
  1859. return pageElems
  1860. }
  1861.  
  1862.  
  1863. // 自动无缝翻页
  1864. function pageLoading() {
  1865. if (curSite.SiteTypeID > 0) {
  1866. windowScroll(function (direction, e) {
  1867. if (direction === 'down' && pausePage === true) { // 下滑/没有暂停翻页时,才准备翻页
  1868. let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
  1869. scrollHeight = window.innerHeight || document.documentElement.clientHeight,
  1870. scrollDelta = curSite.pager.scrollDelta;
  1871. if (curSite.pager.type === 3) { // <<<<< 翻页类型 3(依靠元素距离可视区域底部的距离来触发翻页)>>>>>
  1872. let scrollElement = document.querySelector(curSite.pager.scrollElement);
  1873. //console.log(scrollElement.offsetTop - (scrollTop + scrollHeight), scrollDelta, curSite.SiteTypeID)
  1874. if (scrollElement.offsetTop - (scrollTop + scrollHeight) <= scrollDelta) {
  1875. if (curSite.SiteTypeID === SiteType.GAMERSKY_GL) curSite.pager.scrollDelta -= 800 // 游民星空 gl 的比较奇葩,需要特殊处理下
  1876. ShowPager.loadMorePage();
  1877. }
  1878. } else {
  1879. if (document.documentElement.scrollHeight <= scrollHeight + scrollTop + scrollDelta) {
  1880. if (curSite.pager.type === 2) { // <<<<< 翻页类型 2(网站自带了自动无缝翻页功能,只需要点击下一页按钮即可)>>>>>
  1881. if (curSite.SiteTypeID > 0) { // 如果指定了间隔时间,那么就依靠这个判断时间到了没有~
  1882. let autopbn = document.querySelector(curSite.pager.nextLink);
  1883. if (autopbn) { // 寻找下一页链接
  1884. // 避免重复点击翻页按钮
  1885. if (curSite.pager.nextText) { // 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页
  1886. if (autopbn.innerText === curSite.pager.nextText) autopbn.click();
  1887. } else if (curSite.pager.nextTextOf) { // 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页
  1888. if (autopbn.innerText.indexOf(curSite.pager.nextTextOf) > -1) autopbn.click();
  1889. } else if (curSite.pager.nextHTML) { // 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页
  1890. if (autopbn.innerHTML === curSite.pager.nextHTML) autopbn.click();
  1891. } else { // 如果没有指定按钮文字就直接点击
  1892. autopbn.click();
  1893. // 对于没有按钮文字变化的按钮,可以手动指定间隔时间
  1894. if (curSite.pager.intervals) {
  1895. let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0;
  1896. setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals)
  1897. }
  1898. }
  1899. }
  1900. }
  1901. } else if (curSite.pager.type === 1) { // <<<<< 翻页类型 1(由脚本实现自动无缝翻页)>>>>>
  1902. ShowPager.loadMorePage();
  1903. } else if (curSite.pager.type === 4) { // <<<<< 翻页类型 4(部分简单的动态加载类网站)>>>>>
  1904. if (curSite.SiteTypeID > 0) {
  1905. // 为百度贴吧的发帖考虑...
  1906. if (!(document.documentElement.scrollHeight <= scrollHeight + scrollTop + 200 && curSite.SiteTypeID === SiteType.BAIDU_TIEBA)) {
  1907. curSite.pager.nextLink();
  1908. }
  1909. if (curSite.pager.intervals) {
  1910. let _SiteTypeID = curSite.SiteTypeID;
  1911. curSite.SiteTypeID = 0;
  1912. setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals)
  1913. }
  1914. }
  1915. }
  1916. }
  1917. }
  1918. }
  1919. });
  1920. }
  1921. }
  1922.  
  1923.  
  1924. // 启用/禁用 (当前网站)
  1925. function menu_disable(type) {
  1926. switch(type) {
  1927. case 'check':
  1928. if(check()) {return true;} else {return false;}; break;
  1929. case 'add':
  1930. add(); break;
  1931. case 'del':
  1932. del(); break;
  1933. }
  1934.  
  1935. function check() { // 存在返回真,不存在返回假
  1936. let list = GM_getValue('menu_disable'); // 读取网站列表
  1937. if (list.indexOf(location.host) === -1) return false // 不存在返回假
  1938. return true
  1939. }
  1940.  
  1941. function add() {
  1942. if (check()) return
  1943. let list = GM_getValue('menu_disable'); // 读取网站列表
  1944. list.push(location.host); // 追加网站域名
  1945. GM_setValue('menu_disable', list); // 写入配置
  1946. location.reload(); // 刷新网页
  1947. }
  1948.  
  1949. function del() {
  1950. if (!check()) return
  1951. let list = GM_getValue('menu_disable'), // 读取网站列表
  1952. index = list.indexOf(location.host);
  1953. list.splice(index, 1); // 删除网站域名
  1954. GM_setValue('menu_disable', list); // 写入配置
  1955. location.reload(); // 刷新网页
  1956. }
  1957. }
  1958.  
  1959.  
  1960. // 左键双击网页空白处暂停翻页
  1961. function pausePageEvent() {
  1962. if (!GM_getValue('menu_pause_page')) return
  1963. if (curSite.SiteTypeID === 0) return
  1964. document.body.addEventListener('dblclick', function (e) {
  1965. if (pausePage) {
  1966. pausePage = false;
  1967. GM_notification({text: `❌ 已暂停本页 [自动无缝翻页]\n (再次双击可恢复)`, timeout: 2500});
  1968. } else {
  1969. pausePage = true;
  1970. GM_notification({text: `✅ 已恢复本页 [自动无缝翻页]\n (再次双击可暂停)`, timeout: 2500});
  1971. }
  1972. });
  1973. }
  1974.  
  1975.  
  1976. // 菜单开关
  1977. function menu_switch(menu_status, Name, Tips) {
  1978. if (menu_status === true){
  1979. GM_setValue(`${Name}`, false);
  1980. } else {
  1981. GM_setValue(`${Name}`, true);
  1982. }
  1983. location.reload();
  1984. };
  1985.  
  1986.  
  1987. // 生成 ID
  1988. function generateID() {
  1989. let num = 0
  1990. for (let val in DBSite) {
  1991. DBSite[val].SiteTypeID = num = num + 1;
  1992. }
  1993. }
  1994.  
  1995.  
  1996. // 判断是支持
  1997. function doesItSupport() {
  1998. setDBSite(); // 配置 DBSite 变量对象
  1999.  
  2000. // 遍历判断是否是某个已支持的网站,顺便直接赋值
  2001. let support = false;
  2002. for (let now in DBSite) { // 遍历对象
  2003. if (!DBSite[now].host) continue; // 如果不存在则继续下一个循环
  2004. if (Array.isArray(DBSite[now].host)) { // 如果是数组
  2005. for (let i of DBSite[now].host) { // 遍历数组
  2006. if (i === location.host) {
  2007. if (DBSite[now].functionStart) {
  2008. DBSite[now].functionStart();
  2009. } else {
  2010. curSite = DBSite[now];
  2011. }
  2012. support = true; break; // 如果找到了就退出循环
  2013. }
  2014. }
  2015. } else if (DBSite[now].host === location.host) {
  2016. if (DBSite[now].functionStart) {
  2017. DBSite[now].functionStart();
  2018. } else {
  2019. curSite = DBSite[now];
  2020. }
  2021. support = true; break; // 如果找到了就退出循环
  2022. }
  2023. }
  2024.  
  2025. if (!support) { // 部分域名额外判断一下
  2026. if (location.host.indexOf(DBSite.btbtt.host) > -1) { // < BT 之家 >
  2027. curSite = DBSite.btbtt;
  2028. support = true;
  2029. }
  2030. }
  2031.  
  2032. if (support) {
  2033. console.info('[自动无缝翻页] - 其他网站(独立规则)'); return 1;
  2034. } else if (document.querySelector('meta[name="author"][content*="Discuz!"], meta[name="generator"][content*="Discuz!"]') || document.getElementById('ft') && document.getElementById('ft').textContent.indexOf('Discuz!') > -1) {
  2035. console.info('[自动无缝翻页] - Discuz! 论坛'); return 2;
  2036. } else if (document.getElementById('flarum-loading')) {
  2037. console.info('[自动无缝翻页] - Flarum 论坛'); return 3;
  2038. } else if (document.querySelector('link[href*="themes/dux" i], script[src*="themes/dux" i]')) {
  2039. console.info('[自动无缝翻页] - 使用 WordPress DUX 主题的网站'); return 4;
  2040. } else if (location.host === 'www.flyert.com') {
  2041. console.info('[自动无缝翻页] - 部分內嵌的 Discuz! 论坛'); return 2;
  2042. }
  2043. return 0;
  2044. }
  2045.  
  2046.  
  2047. // 类型 4 专用
  2048. function getPageElems(url, type = 'text', method = 'GET', data = '', type2) {
  2049. //console.log(url, data)
  2050. let mimeType = '';
  2051. if (curSite.pager.mimeType) mimeType = curSite.pager.mimeType;
  2052. GM_xmlhttpRequest({
  2053. url: url,
  2054. method: method,
  2055. data: data,
  2056. responseType: type,
  2057. overrideMimeType: mimeType,
  2058. headers: {
  2059. "Referer": location.href,
  2060. 'Content-Type': (method === 'POST') ? 'application/x-www-form-urlencoded':''
  2061. },
  2062. timeout: 5000,
  2063. onload: function (response) {
  2064. try {
  2065. //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  2066. switch (type) {
  2067. case 'json':
  2068. curSite.pager.insertElement(response.response, type2);
  2069. break;
  2070. default:
  2071. curSite.pager.insertElement(ShowPager.createDocumentByString(response.responseText), type2)
  2072. }
  2073. } catch (e) {
  2074. console.log(e);
  2075. }
  2076. }
  2077. });
  2078. }
  2079.  
  2080.  
  2081. // 插入位置
  2082. function addTo(num) {
  2083. switch (num) {
  2084. case 1:
  2085. return 'beforebegin'; break;
  2086. case 2:
  2087. return 'afterbegin'; break;
  2088. case 3:
  2089. return 'beforeend'; break;
  2090. case 4:
  2091. return 'afterend'; break;
  2092. }
  2093. }
  2094.  
  2095.  
  2096. // 滚动条事件
  2097. function windowScroll(fn1) {
  2098. var beforeScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  2099. fn = fn1 || function () {};
  2100. setTimeout(function () { // 延时 1 秒执行,避免刚载入到页面就触发翻页事件
  2101. window.addEventListener('scroll', function (e) {
  2102. var afterScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  2103. delta = afterScrollTop - beforeScrollTop;
  2104. if (delta == 0) return false;
  2105. fn(delta > 0 ? 'down' : 'up', e);
  2106. beforeScrollTop = afterScrollTop;
  2107. }, false);
  2108. }, 1000)
  2109. }
  2110.  
  2111.  
  2112. // 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader
  2113. var ShowPager = {
  2114. getFullHref: function (e) {
  2115. if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
  2116. return '';
  2117. },
  2118. createDocumentByString: function (e) {
  2119. if (e) {
  2120. if ('HTML' !== document.documentElement.nodeName) return (new DOMParser).parseFromString(e, 'application/xhtml+xml');
  2121. var t;
  2122. try { t = (new DOMParser).parseFromString(e, 'text/html');} catch (e) {}
  2123. if (t) return t;
  2124. if (document.implementation.createHTMLDocument) {
  2125. t = document.implementation.createHTMLDocument('ADocument');
  2126. } else {
  2127. 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) {}
  2128. }
  2129. if (t) {
  2130. var r = document.createRange(),
  2131. n = r.createContextualFragment(e);
  2132. r.selectNodeContents(document.body);
  2133. t.body.appendChild(n);
  2134. 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);
  2135. return t;
  2136. }
  2137. } else console.error('没有找到要转成 DOM 的字符串');
  2138. },
  2139. loadMorePage: function () {
  2140. if (curSite.pager) {
  2141. var url;
  2142. if (typeof curSite.pager.nextLink == 'function') {
  2143. url = curSite.pager.nextLink();
  2144. } else {
  2145. if (curSite.pager.nextLink.slice(0,4) === 'css;') {
  2146. url = this.getFullHref(getElementByCSS(curSite.pager.nextLink.slice(4)));
  2147. } else {
  2148. url = this.getFullHref(getElementByXpath(curSite.pager.nextLink));
  2149. }
  2150. }
  2151. //console.log(url, curSite.pageUrl);
  2152. if (url === '') return;
  2153. if (curSite.pageUrl === url) return;// 避免重复加载相同的页面
  2154. curSite.pageUrl = url;
  2155. let mimeType = '';
  2156. if (curSite.pager.mimeType) mimeType = curSite.pager.mimeType;
  2157. // 读取下一页的数据
  2158. GM_xmlhttpRequest({
  2159. url: url,
  2160. method: 'GET',
  2161. overrideMimeType: mimeType,
  2162. headers: {
  2163. "Referer": location.href
  2164. },
  2165. timeout: 5000,
  2166. onload: function (response) {
  2167. try {
  2168. //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  2169. var newBody = ShowPager.createDocumentByString(response.responseText);
  2170. let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody),
  2171. toElement = getAllElements(curSite.pager.insertPosition[0])[0];
  2172. //console.log(curSite.pager.pageElement, pageElems)
  2173.  
  2174. if (pageElems.length >= 0) {
  2175. // 如果有插入前函数就执行函数
  2176. if (curSite.function && curSite.function.before) {
  2177. if (curSite.function.parameter) { // 如果指定了参数
  2178. pageElems = curSite.function.before(curSite.function.parameter);
  2179. } else {
  2180. pageElems = curSite.function.before(pageElems);
  2181. }
  2182. }
  2183.  
  2184. // 插入位置
  2185. let addTo1 = addTo(curSite.pager.insertPosition[1]);
  2186.  
  2187. // 插入新页面元素
  2188. pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);});
  2189.  
  2190. // 插入 <script> 标签
  2191. if (curSite.pager.scriptType) {
  2192. let scriptText = '';
  2193. if (curSite.pager.scriptType === 1) { // 下一页的所有 <script> 标签
  2194. const scriptElems = getAllElements('//script', newBody, newBody);
  2195. scriptElems.forEach(function (one) {scriptText += ';' + one.textContent;});
  2196. toElement.appendChild(document.createElement('script')).textContent = scriptText;
  2197. } else if (curSite.pager.scriptType === 2) { // 下一页主体元素同级 <script> 标签
  2198. pageElems.forEach(function (one) {if (one.tagName === 'SCRIPT') {scriptText += ';' + one.textContent;}});
  2199. if (scriptText) toElement.appendChild(document.createElement('script')).textContent = scriptText;
  2200. } else if (curSite.pager.scriptType === 3) { // 下一页主体元素子元素 <script> 标签
  2201. pageElems.forEach(function (one) {
  2202. const scriptElems = one.querySelectorAll('script');
  2203. scriptElems.forEach(function (script) {scriptText += ';' + script.textContent;});
  2204. });
  2205. if (scriptText) toElement.appendChild(document.createElement('script')).textContent = scriptText;
  2206. }
  2207. }
  2208.  
  2209. // 替换待替换元素
  2210. try {
  2211. let oriE = getAllElements(curSite.pager.replaceE),
  2212. repE = getAllElements(curSite.pager.replaceE, newBody, newBody);
  2213. if (oriE.length === repE.length) {
  2214. for (let i = 0; i < oriE.length; i++) {
  2215. oriE[i].outerHTML = repE[i].outerHTML;
  2216. }
  2217. }
  2218. } catch (e) {
  2219. console.log(e);
  2220. }
  2221. // 如果有插入后函数就执行函数
  2222. if (curSite.function && curSite.function.after) {
  2223. if (curSite.function.parameter) { // 如果指定了参数
  2224. curSite.function.after(curSite.function.parameter);
  2225. } else {
  2226. curSite.function.after();
  2227. }
  2228. }
  2229. }
  2230. } catch (e) {
  2231. console.log(e);
  2232. }
  2233. }
  2234. });
  2235. }
  2236. },
  2237. };
  2238. function getElementByCSS(css, contextNode = document) {
  2239. return contextNode.querySelector(css);
  2240. }
  2241. function getAllElementsByCSS(css, contextNode = document) {
  2242. return [].slice.call(contextNode.querySelectorAll(css));
  2243. }
  2244. function getElementByXpath(xpath, contextNode, doc = document) {
  2245. contextNode = contextNode || doc;
  2246. try {
  2247. const result = doc.evaluate(xpath, contextNode, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  2248. // 应该总是返回一个元素节点
  2249. return result.singleNodeValue && result.singleNodeValue.nodeType === 1 && result.singleNodeValue;
  2250. } catch (err) {
  2251. throw new Error(`Invalid xpath: ${xpath}`);
  2252. }
  2253. }
  2254. function getAllElementsByXpath(xpath, contextNode, doc = document) {
  2255. contextNode = contextNode || doc;
  2256. const result = [];
  2257. try {
  2258. const query = doc.evaluate(xpath, contextNode, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  2259. for (let i = 0; i < query.snapshotLength; i++) {
  2260. const node = query.snapshotItem(i);
  2261. // 如果是 Element 节点
  2262. if (node.nodeType === 1) result.push(node);
  2263. }
  2264. } catch (err) {
  2265. throw new Error(`无效 Xpath: ${xpath}`);
  2266. }
  2267. return result;
  2268. }
  2269. function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) {
  2270. if (!selector) return [];
  2271. contextNode = contextNode || doc;
  2272. if (typeof selector === 'string') {
  2273. if (selector.search(/^css;/i) === 0) {
  2274. return getAllElementsByCSS(selector.slice(4), contextNode);
  2275. } else {
  2276. return getAllElementsByXpath(selector, contextNode, doc);
  2277. }
  2278. } else {
  2279. const query = selector(doc, win, _cplink);
  2280. if (!Array.isArray(query)) {
  2281. throw new Error('getAllElements 返回错误类型');
  2282. } else {
  2283. return query;
  2284. }
  2285. }
  2286. }
  2287. })();