自动无缝翻页

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

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

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