自动无缝翻页

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

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

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