自动无缝翻页

无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条、360、微信、贴吧、豆瓣、微博、NGA、V2EX、起点小说、煎蛋网、超能网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、小霸王其乐无穷、CS.RIN.RU、FitGirl、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、片库、音范丝、BT之家、爱恋动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、小众软件、极简插件、异次元软件、异星软件空间、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork(以上仅一部分,更多的写不下了...

当前为 2021-09-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 自动无缝翻页
  3. // @version 2.1.1
  4. // @author X.I.U
  5. // @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条、360、微信、贴吧、豆瓣、微博、NGA、V2EX、起点小说、煎蛋网、超能网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、小霸王其乐无穷、CS.RIN.RU、FitGirl、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、片库、音范丝、BT之家、爱恋动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、小众软件、极简插件、异次元软件、异星软件空间、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork(以上仅一部分,更多的写不下了...
  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_unregisterMenuCommand
  12. // @grant GM_openInTab
  13. // @grant GM_getValue
  14. // @grant GM_setValue
  15. // @grant GM_notification
  16. // @grant unsafeWindow
  17. // @noframes
  18. // @license GPL-3.0 License
  19. // @run-at document-end
  20. // @namespace https://github.com/XIU2/UserScript
  21. // @supportURL https://github.com/XIU2/UserScript
  22. // @homepageURL https://github.com/XIU2/UserScript
  23. // ==/UserScript==
  24.  
  25. (function() {
  26. 'use strict';
  27. var menuAll = [
  28. ['menu_disable', '✅ 已启用 (点击对当前网站禁用)', '❌ 已禁用 (点击对当前网站启用)', []],
  29. ['menu_discuz_thread_page', '帖子内自动翻页 (仅论坛)', '帖子内自动翻页 (仅论坛)', true],
  30. ['menu_page_number', '显示当前页码及点击暂停翻页', '显示当前页码及点击暂停翻页', true],
  31. ['menu_pause_page', '左键双击网页空白处暂停翻页', '左键双击网页空白处暂停翻页', false]
  32. ], menuId = [], webType = 0, curSite = {SiteTypeID: 0}, DBSite, SiteType, pausePage = true, pageNum = {now: 1, _now: 1}, forumWebsite = ['cs.rin.ru', 'www.flyert.com', 'bbs.pediy.com'];
  33. for (let i=0;i<menuAll.length;i++){ // 如果读取到的值为 null 就写入默认值
  34. if (GM_getValue(menuAll[i][0]) == null){GM_setValue(menuAll[i][0], menuAll[i][3])};
  35. }
  36. registerMenuCommand();
  37. if (menuId.length < 2) {return}
  38. // 注册脚本菜单
  39. function registerMenuCommand() {
  40. if (menuId.length != []){
  41. for (let i=0;i<menuId.length;i++){
  42. GM_unregisterMenuCommand(menuId[i]);
  43. }
  44. }
  45. for (let i=0;i<menuAll.length;i++) { // 循环注册脚本菜单
  46. menuAll[i][3] = GM_getValue(menuAll[i][0]);
  47. if (menuAll[i][0] === 'menu_disable') { // 启用/禁用
  48.  
  49. if (menu_disable('check')) { // 当前网站在禁用列表中
  50. menuId[i] = GM_registerMenuCommand(`${menuAll[i][2]}`, function(){menu_disable('del')});
  51. return
  52. } else { // // 不在禁用列表中
  53. webType = doesItSupport(); // 判断网站类型(即是否支持),顺便直接赋值
  54. if (webType === 0) {
  55. 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});});
  56. console.info('[自动无缝翻页] - 不支持当前网站,欢迎申请支持:https://github.com/XIU2/UserScript / https://greasyfork.org/zh-CN/scripts/96880/feedback');
  57. return
  58. }
  59. menuId[i] = GM_registerMenuCommand(`${menuAll[i][1]}`, function(){menu_disable('add')});
  60. }
  61.  
  62. } else if (menuAll[i][0] === 'menu_discuz_thread_page') { // 帖子内自动翻页 (仅论坛)
  63.  
  64. if (webType === 2 || forumWebsite.indexOf(location.host) > -1) {
  65. menuId[i] = GM_registerMenuCommand(`${menuAll[i][3]?'✅':'❌'} ${menuAll[i][1]}`, function(){menu_switch(menuAll[i][3], menuAll[i][0], menuAll[i][2])});
  66. }
  67.  
  68. } else {
  69. menuId[i] = GM_registerMenuCommand(`${menuAll[i][3]?'✅':'❌'} ${menuAll[i][1]}`, function(){menu_switch(menuAll[i][3], menuAll[i][0], menuAll[i][2])});
  70. }
  71. }
  72. menuId[menuId.length] = GM_registerMenuCommand('💬 反馈 & 欢迎申请支持', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});});
  73. }
  74.  
  75. // 网站规则
  76. function setDBSite() {
  77. /*
  78. 自动翻页规则
  79. type:
  80. 1 = 由脚本实现自动无缝翻页
  81. 2 = 网站自带了自动无缝翻页功能,只需要点击下一页按钮即可
  82. nextText: 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页)
  83. nextTextOf: 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页)
  84. nextHTML: 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页(避免一瞬间加载太多次下一页)
  85. intervals: 点击间隔时间,对于没有按钮文字变化的按钮,可以手动指定间隔时间,单位:ms
  86. 3 = 依靠元素距离可视区域底部的距离来触发翻页
  87. 4 = 部分简单的动态加载类网站(暂时)
  88. insertPosition:
  89. 1 = 插入该元素本身的前面;
  90. 2 = 插入该元素当中,第一个子元素前面;
  91. 3 = 插入该元素当中,最后一个子元素后面;
  92. 4 = 插入该元素本身的后面;
  93. mimeType: 网站编码
  94. scriptType: 单独插入 <script> 标签
  95. 1 = 下一页的所有 <script> 标签
  96. 2 = 下一页主体元素同级 <script> 标签
  97. 3 = 下一页主体元素同级 <script> 标签(远程文件)
  98. 4 = 下一页主体元素子元素 <script> 标签
  99. scrollDelta:数值越大,滚动条触发点越靠上(越早开始翻页),一般是访问网页速度越慢,该值就需要越大(如果 Type = 3,则相反)
  100. function:
  101. before = 插入前执行函数;
  102. after = 插入后执行函数;
  103. parameter = 参数
  104. */
  105. DBSite = {
  106. discuz_forum: {
  107. SiteTypeID: 0,
  108. pager: {
  109. type: 2,
  110. nextLink: '#autopbn',
  111. nextTextOf: '下一页',
  112. scrollDelta: 1500
  113. }
  114. }, // Discuz! - 各版块帖子列表(自带无缝加载下一页按钮的)
  115. discuz_guide: {
  116. SiteTypeID: 0,
  117. pager: {
  118. type: 1,
  119. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  120. pageElement: 'css;#threadlist table > tbody[id^="normalthread_"]',
  121. insertPosition: ['id("threadlist")//table/tbody[starts-with(@id, "normalthread_")]/parent::table', 3],
  122. replaceE: 'css;.pg, .pages',
  123. scrollDelta: 1000
  124. }
  125. }, // Discuz! - 导读页 及 各版块帖子列表(不带无缝加载下一页按钮的)
  126. discuz_waterfall: {
  127. SiteTypeID: 0,
  128. pager: {
  129. type: 1,
  130. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  131. pageElement: 'css;#waterfall > li',
  132. insertPosition: ['css;#waterfall', 3],
  133. replaceE: 'css;.pg, .pages',
  134. scrollDelta: 1000
  135. }
  136. }, // Discuz! - 图片模式的各版块帖子列表(不带无缝加载下一页按钮的)
  137. discuz_thread: {
  138. SiteTypeID: 0,
  139. pager: {
  140. type: 1,
  141. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  142. pageElement: 'css;#postlist > div[id^="post_"]',
  143. insertPosition: ['css;#postlist', 3],
  144. replaceE: 'css;.pg, .pages',
  145. scrollDelta: 1000
  146. },
  147. function: {
  148. before: discuz_thread_functionBefore
  149. }
  150. }, // Discuz! - 帖子内
  151. discuz_search: {
  152. SiteTypeID: 0,
  153. pager: {
  154. type: 1,
  155. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  156. pageElement: 'css;#threadlist > ul',
  157. insertPosition: ['css;#threadlist', 3],
  158. replaceE: 'css;.pg, .pages',
  159. scrollDelta: 1000
  160. }
  161. }, // Discuz! - 搜索页
  162. discuz_youspace: {
  163. SiteTypeID: 0,
  164. pager: {
  165. type: 1,
  166. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  167. pageElement: 'css;tbody > tr:not(.th)',
  168. insertPosition: ['css;tbody', 3],
  169. replaceE: 'css;.pg, .pages',
  170. scrollDelta: 1000
  171. }
  172. }, // Discuz! - 回复页、主题页(别人的)
  173. discuz_collection: {
  174. SiteTypeID: 0,
  175. pager: {
  176. type: 1,
  177. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
  178. pageElement: 'css;#ct .bm_c table > tbody',
  179. insertPosition: ['css;#ct .bm_c table', 3],
  180. replaceE: 'css;.pg, .pages',
  181. scrollDelta: 1000
  182. }
  183. }, // Discuz! - 淘帖页
  184. flarum: {
  185. SiteTypeID: 0,
  186. pager: {
  187. type: 2,
  188. nextLink: '.DiscussionList-loadMore > button[title]',
  189. scrollDelta: 1000
  190. }
  191. },
  192. dux: {
  193. SiteTypeID: 0,
  194. pager: {
  195. type: 1,
  196. nextLink: '//li[@class="next-page"]/a[@href]',
  197. pageElement: 'css;.content > article',
  198. insertPosition: ['css;.content > .pagination', 1],
  199. replaceE: 'css;.content > .pagination',
  200. scrollDelta: 1500
  201. },
  202. function: {
  203. before: dux_functionBefore
  204. }
  205. }, // 一种 WordPress 主题
  206. baidu: {
  207. SiteTypeID: 0,
  208. host: 'www.baidu.com',
  209. 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;}';},
  210. pager: {
  211. type: 1,
  212. nextLink: 'id("page")//a[contains(text(),"下一页")][@href]',
  213. pageElement: 'css;#content_left > *',
  214. insertPosition: ['css;#content_left', 3],
  215. replaceE: 'css;#page',
  216. scrollDelta: 1200
  217. }
  218. }, // 百度搜素
  219. google: {
  220. SiteTypeID: 0,
  221. host: 'www.google.com',
  222. functionStart: function() {if (location.pathname === '/search') curSite = DBSite.google;},
  223. pager: {
  224. type: 1,
  225. nextLink: 'id("pnnext")[@href]',
  226. pageElement: 'css;#res > *',
  227. insertPosition: ['css;#res', 3],
  228. replaceE: 'id("navcnt") | id("rcnt")//div[@role="navigation"]',
  229. scriptType: 1,
  230. scrollDelta: 3000
  231. }
  232. }, // 谷歌搜索
  233. bing: {
  234. SiteTypeID: 0,
  235. host: ['www.bing.com','cn.bing.com'],
  236. functionStart: function() {if (location.pathname === '/search') {curSite = DBSite.bing; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.b_imagePair.square_mp > .inner {display: none;}';}},
  237. pager: {
  238. type: 1,
  239. nextLink: '//a[contains(@class,"sb_pagN")][@href]',
  240. pageElement: 'css;#b_results > li:not(.b_msg):not(.b_pag):not(#mfa_root)',
  241. insertPosition: ['css;#b_results > .b_pag', 1],
  242. replaceE: 'css;#b_results > .b_pag',
  243. scrollDelta: 1500
  244. }
  245. }, // 必应搜索
  246. toutiao: {
  247. SiteTypeID: 0,
  248. host: ['www.toutiao.com', 'so.toutiao.com'],
  249. functionStart: function() {if (location.hostname != 'www.toutiao.com') {if (location.pathname === '/search') {curSite = DBSite.toutiao;}}},
  250. pager: {
  251. type: 1,
  252. nextLink: '//div[contains(@class, "-pagination")]/a[contains(string(), "下一页")]',
  253. pageElement: 'css;div[class*="-result-list"] > .result-content[data-i]',
  254. insertPosition: ['css;div[class*="-result-list"] > .result-content:not([data-i]):last-child', 1],
  255. replaceE: 'css;div[class*="-pagination"]',
  256. scrollDelta: 1200
  257. },
  258. function: {
  259. before: toutiao_functionBefore
  260. }
  261. }, // 头条搜索
  262. sogou: {
  263. SiteTypeID: 0,
  264. host: 'www.sogou.com',
  265. functionStart: function() {if (location.pathname != '/') {curSite = DBSite.sogou;}},
  266. pager: {
  267. type: 1,
  268. nextLink: 'css;#sogou_next',
  269. pageElement: 'css;.results > *',
  270. insertPosition: ['css;.results', 3],
  271. replaceE: 'css;#pagebar_container',
  272. scriptType: 4,
  273. scrollDelta: 1200
  274. }
  275. }, // 搜狗搜索
  276. sogou_weixin: {
  277. SiteTypeID: 0,
  278. host: 'weixin.sogou.com',
  279. functionStart: function() {if (location.pathname === '/') {
  280. curSite = DBSite.sogou_weixin;
  281. } else if (location.pathname === '/weixin') {
  282. curSite = DBSite.sogou_weixin_search;
  283. }},
  284. pager: {
  285. type: 2,
  286. nextLink: '#look-more',
  287. intervals: 1000,
  288. scrollDelta: 1000
  289. }
  290. }, // 搜狗微信 - 首页
  291. sogou_weixin_search: {
  292. SiteTypeID: 0,
  293. pager: {
  294. type: 1,
  295. nextLink: 'css;#sogou_next',
  296. pageElement: 'css;.news-box > ul[class*="news-list"] > li',
  297. insertPosition: ['css;.news-box > ul[class*="news-list"]', 3],
  298. replaceE: 'css;#pagebar_container',
  299. scrollDelta: 1000
  300. }
  301. }, //搜狗微信 - 搜索
  302. so: {
  303. SiteTypeID: 0,
  304. host: 'www.so.com',
  305. functionStart: function() {if (location.pathname != '/') {curSite = DBSite.so;}},
  306. pager: {
  307. type: 1,
  308. nextLink: 'css;#snext[href]',
  309. pageElement: 'css;ul.result > li, style:not(src)',
  310. insertPosition: ['css;ul.result', 3],
  311. replaceE: 'css;#page',
  312. scrollDelta: 1200
  313. },
  314. function: {
  315. before: so_functionBefore
  316. }
  317. }, // 360 搜索
  318. magi: {
  319. SiteTypeID: 0,
  320. host: 'magi.com',
  321. functionStart: function() {if (location.pathname === '/search') {curSite = DBSite.magi;}},
  322. pager: {
  323. type: 2,
  324. nextLink: '.card[data-type="next"]',
  325. nextText: '加载更多',
  326. scrollDelta: 1500
  327. }
  328. }, // Magi搜索
  329. baidu_tieba: {
  330. SiteTypeID: 0,
  331. host: 'tieba.baidu.com',
  332. functionStart: function() {if (location.pathname === '/f') { // 帖子列表
  333. baidu_tieba_1(); // 右侧悬浮发帖按钮点击事件(解决自动翻页导致无法发帖的问题)
  334. curSite = DBSite.baidu_tieba; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'img.j_retract {margin-top: 0 !important;margin-bottom: 0 !important;}'; // 修复帖子列表中预览图片,在切换下一个/上一个图片时,多出来的图片上下边距
  335. } else if (location.pathname === '/f/search/res') { // 吧内搜索/全吧搜索
  336. curSite = DBSite.baidu_tieba_search;
  337. }},
  338. pager: {
  339. type: 4,
  340. nextLink: baidu_tieba_functionNext,
  341. pageElement: 'css;#thread_list > li',
  342. insertPosition: ['css;#thread_list', 3],
  343. insertElement: baidu_tieba_insertElement,
  344. replaceE: 'css;#frs_list_pager',
  345. intervals: 3000,
  346. scrollDelta: 2000
  347. },
  348. function: {
  349. before: baidu_tieba_functionBefore
  350. }
  351. }, // 百度贴吧 - 帖子列表
  352. baidu_tieba_post: {
  353. SiteTypeID: 0,
  354. pager: {
  355. type: 1,
  356. nextLink: '//li[contains(@class,"pb_list_pager")]/a[contains(text(),"下一页")][@href]',
  357. pageElement: 'css;#j_p_postlist > div',
  358. insertPosition: ['css;#j_p_postlist', 3],
  359. replaceE: 'css;li.pb_list_pager',
  360. scrollDelta: 1000
  361. }
  362. }, // 百度贴吧 - 帖子内
  363. baidu_tieba_search: {
  364. SiteTypeID: 0,
  365. pager: {
  366. type: 1,
  367. nextLink: '//a[@class="next"][@href]',
  368. pageElement: 'css;.s_post_list > .s_post',
  369. insertPosition: ['css;.s_post_list', 3],
  370. replaceE: 'css;.pager.pager-search',
  371. scrollDelta: 1000
  372. }
  373. }, // 百度贴吧 - 搜索页
  374. douban_subject_comments: {
  375. SiteTypeID: 0,
  376. host: 'movie.douban.com',
  377. functionStart: function() {if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/comments') > -1) { // 短评列表
  378. curSite = DBSite.douban_subject_comments;
  379. } else if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/reviews') > -1) { // 影评列表
  380. curSite = DBSite.douban_subject_reviews;
  381. } else if(location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/episode') > -1) { // 电视剧每集评论
  382. curSite = DBSite.douban_subject_episode;
  383. }},
  384. pager: {
  385. type: 1,
  386. nextLink: '//a[@class="next"][@href]',
  387. pageElement: 'css;#comments > .comment-item',
  388. insertPosition: ['css;#paginator', 1],
  389. replaceE: 'css;#paginator',
  390. scrollDelta: 1000
  391. }
  392. }, // 豆瓣 - 短评
  393. douban_subject_reviews: {
  394. SiteTypeID: 0,
  395. pager: {
  396. type: 1,
  397. nextLink: '//link[@rel="next"][@href]',
  398. pageElement: 'css;.review-list > div',
  399. insertPosition: ['css;.review-list', 3],
  400. replaceE: 'css;.paginator',
  401. scrollDelta: 1000
  402. }
  403. }, // 豆瓣 - 影评
  404. douban_subject_episode: {
  405. SiteTypeID: 0,
  406. pager: {
  407. type: 1,
  408. nextLink: '//link[@rel="next"][@href]',
  409. pageElement: 'css;#comments > div',
  410. insertPosition: ['css;#comments', 3],
  411. replaceE: 'css;.paginator',
  412. scrollDelta: 1000
  413. }
  414. }, // 豆瓣 - 剧评
  415. douban_group: {
  416. SiteTypeID: 0,
  417. host: 'www.douban.com',
  418. functionStart: function() {if (location.pathname.indexOf('/group/topic/') > -1) {
  419. curSite = DBSite.douban_group_topic;
  420. } else if (location.pathname.indexOf('/group/explore') > -1) {
  421. curSite = DBSite.douban_group_explore;
  422. } else if (location.pathname.indexOf('/group/') > -1 && location.pathname.indexOf('/discussion') > -1) {
  423. curSite = DBSite.douban_group;
  424. }},
  425. pager: {
  426. type: 1,
  427. nextLink: 'css;span.next > a',
  428. pageElement: 'css;table.olt > tbody > tr:not(.th)',
  429. insertPosition: ['css;table.olt > tbody', 3],
  430. replaceE: 'css;.paginator',
  431. scrollDelta: 1000
  432. }
  433. }, // 豆瓣 - 小组
  434. douban_group_explore: {
  435. SiteTypeID: 0,
  436. pager: {
  437. type: 1,
  438. nextLink: 'css;span.next > a',
  439. pageElement: 'css;#content .article > div > .channel-item',
  440. insertPosition: ['css;#content .article > div', 3],
  441. replaceE: 'css;.paginator',
  442. scrollDelta: 1000
  443. }
  444. }, // 豆瓣 - 小组讨论精选
  445. douban_group_topic: {
  446. SiteTypeID: 0,
  447. pager: {
  448. type: 1,
  449. nextLink: 'css;span.next > a',
  450. pageElement: 'css;#comments > li',
  451. insertPosition: ['css;#comments', 3],
  452. replaceE: 'css;.paginator',
  453. scrollDelta: 1000
  454. }
  455. }, // 豆瓣 - 小组帖子内
  456. weibo_comment: {
  457. SiteTypeID: 0,
  458. host: 'weibo.com',
  459. pager: {
  460. type: 2,
  461. nextLink: 'a[action-type="click_more_comment"]',
  462. nextText: '查看更多c',
  463. scrollDelta: 1000
  464. }
  465. }, // 微博评论
  466. nga_thread: {
  467. SiteTypeID: 0,
  468. host: 'bbs.nga.cn',
  469. functionStart: function() {if (location.pathname === '/thread.php') { // 帖子列表
  470. curSite = DBSite.nga_thread;
  471. } else if (location.pathname === '/read.php') { // 帖子内
  472. curSite = DBSite.nga_read;
  473. }},
  474. pager: {
  475. type: 1,
  476. nextLink: 'css;#pagebbtm a[title="下一页"][href]',
  477. pageElement: 'css;#topicrows > tbody, #topicrows > script',
  478. insertPosition: ['css;#topicrows', 3],
  479. replaceE: 'css;div[name="pageball"]',
  480. scriptType: 2,
  481. scrollDelta: 1000
  482. },
  483. function: {
  484. after: nga_thread_functionAfter
  485. }
  486. }, // NGA - 各版块帖子列表
  487. nga_read: {
  488. SiteTypeID: 0,
  489. pager: {
  490. type: 1,
  491. nextLink: 'css;#pagebbtm a[title="下一页"][href]',
  492. pageElement: 'id("m_posts_c")/table | id("m_posts_c")/script | //script[contains(text(), "commonui.userInfo.setAll")]',
  493. insertPosition: ['css;#m_posts_c', 3],
  494. replaceE: 'css;div[name="pageball"]',
  495. scriptType: 2,
  496. scrollDelta: 1000
  497. }
  498. }, // NGA - 帖子内
  499. v2ex_recent: {
  500. SiteTypeID: 0,
  501. host: ['v2ex.com', 'www.v2ex.com'],
  502. functionStart: function() {if (location.pathname === '/') { // 首页
  503. v2ex_functionAfter('#Main a.topic-link:not([target])');
  504. } else if (location.pathname === '/recent') { // 最近主题页
  505. curSite = DBSite.v2ex_recent;
  506. v2ex_functionAfter('#Main a.topic-link:not([target])');
  507. } else if (location.pathname === '/notifications') { // 提醒消息页
  508. curSite = DBSite.v2ex_notifications;
  509. v2ex_functionAfter('#Main a[href^="/t/"]:not([target])');
  510. } else if (location.pathname === '/balance') { // 账户余额页
  511. curSite = DBSite.v2ex_balance;
  512. } else if (location.pathname.indexOf('/go/') > -1) { // 分类主题页
  513. curSite = DBSite.v2ex_go;
  514. v2ex_functionAfter('#Main a.topic-link:not([target])');
  515. } else if (location.pathname.indexOf('/replies') > -1) { // 用户回复页
  516. curSite = DBSite.v2ex_replies;
  517. v2ex_functionAfter('#Main a[href^="/t/"]:not([target])');
  518. }},
  519. pager: {
  520. type: 1,
  521. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  522. pageElement: 'css;.cell.item',
  523. insertPosition: ['//div[@id="Main"]//div[@class="box"]//div[@class="cell"][last()]', 1],
  524. replaceE: 'css;#Main > .box > .cell[style]:not(.item) > table',
  525. scrollDelta: 1500
  526. },
  527. function: {
  528. after: v2ex_functionAfter,
  529. parameter: '#Main a.topic-link:not([target])'
  530. }
  531. }, // V2EX - 最近主题页
  532. v2ex_notifications: {
  533. SiteTypeID: 0,
  534. pager: {
  535. type: 1,
  536. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  537. pageElement: 'css;#notifications > div',
  538. insertPosition: ['css;#notifications', 3],
  539. replaceE: 'css;#Main > .box > .cell[style] > table',
  540. scrollDelta: 1500
  541. },
  542. function: {
  543. after: v2ex_functionAfter,
  544. parameter: '#Main a[href^="/t/"]:not([target])'
  545. }
  546. }, // V2EX - 提醒消息页
  547. v2ex_replies: {
  548. SiteTypeID: 0,
  549. pager: {
  550. type: 1,
  551. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  552. 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]',
  553. insertPosition: ['//div[@id="Main"]//div[@class="box"]//div[@class="cell"][last()]', 1],
  554. replaceE: 'css;#Main > .box > .cell[style] > table',
  555. scrollDelta: 1500
  556. },
  557. function: {
  558. after: v2ex_functionAfter,
  559. parameter: '#Main a[href^="/t/"]:not([target])'
  560. }
  561. }, // V2EX - 用户回复页
  562. v2ex_go: {
  563. SiteTypeID: 0,
  564. pager: {
  565. type: 1,
  566. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  567. pageElement: 'css;#TopicsNode > div',
  568. insertPosition: ['css;#TopicsNode', 3],
  569. replaceE: 'css;#Main > .box > .cell[style] > table',
  570. scrollDelta: 1500
  571. },
  572. function: {
  573. after: v2ex_functionAfter,
  574. parameter: '#Main a.topic-link:not([target])'
  575. }
  576. }, // V2EX - 分类主题页
  577. v2ex_balance: {
  578. SiteTypeID: 0,
  579. pager: {
  580. type: 1,
  581. nextLink: '//a[@class="page_current"]/following-sibling::a[1][@href]',
  582. pageElement: 'css;#Main .box > div:not(.cell) > table > tbody > tr:not(:first-child)',
  583. insertPosition: ['css;#Main .box > div:not(.cell) > table > tbody', 3],
  584. replaceE: 'css;#Main > .box > .cell[style] > table',
  585. scrollDelta: 1000
  586. }
  587. }, // V2EX - 账户余额页
  588. pediy_forum: {
  589. SiteTypeID: 0,
  590. host: 'bbs.pediy.com',
  591. functionStart: function() {if (location.pathname.indexOf('/forum-') > -1) {
  592. curSite = DBSite.pediy_forum;
  593. } else if (location.pathname.indexOf('/thread-') > -1) {
  594. if (GM_getValue('menu_discuz_thread_page')) {curSite = DBSite.pediy_thread;}
  595. }},
  596. pager: {
  597. type: 1,
  598. nextLink: '//ul[contains(@class, "pagination")]//a[contains(text(), "▶")]',
  599. pageElement: 'css;table.threadlist > tbody > tr',
  600. insertPosition: ['css;table.threadlist > tbody', 3],
  601. replaceE: 'css;ul.pagination',
  602. scrollDelta: 1500
  603. }
  604. }, // 看雪论坛 - 各版块帖子列表
  605. pediy_thread: {
  606. SiteTypeID: 0,
  607. pager: {
  608. type: 1,
  609. nextLink: '//ul[contains(@class, "pagination")]//a[contains(text(), "▶")]',
  610. pageElement: 'css;table.postlist > tbody > tr[data-pid]',
  611. insertPosition: ['css;table.postlist > tbody > tr:not([data-pid])', 1],
  612. replaceE: 'css;ul.pagination',
  613. scrollDelta: 1500
  614. }
  615. }, // 看雪论坛 - 帖子内
  616. lkong: {
  617. SiteTypeID: 0,
  618. host: 'www.lkong.com',
  619. functionStart: function() {if (location.pathname.indexOf('/forum/') > -1) {
  620. curSite = DBSite.lkong;
  621. } else if (location.pathname.indexOf('/thread/') > -1) {
  622. curSite = DBSite.lkong_thread;
  623. }},
  624. pager: {
  625. type: 1,
  626. nextLink: lkong_functionNext,
  627. pageElement: '//div[@class="main-title"]/parent::div/parent::div | //head/style[@data-emotion-css]',
  628. insertPosition: ['//div[@class="main-title"][1]/parent::div/parent::div/parent::div', 3],
  629. replaceE: 'css;ul.ant-pagination',
  630. intervals: 500,
  631. scrollDelta: 1200
  632. }
  633. }, // 龙的天空 - 各版块帖子列表
  634. lkong_thread: {
  635. SiteTypeID: 0,
  636. pager: {
  637. type: 1,
  638. nextLink: lkong_functionNext,
  639. pageElement: '//div[@class="main-content"]/parent::div | //head/style[@data-emotion-css]',
  640. insertPosition: ['//div[@class="main-content"][1]/parent::div/parent::div', 3],
  641. replaceE: 'css;ul.ant-pagination',
  642. intervals: 500,
  643. scrollDelta: 1200
  644. }
  645. }, // 龙的天空 - 帖子内
  646. xcar_forumdisplay: {
  647. SiteTypeID: 0,
  648. host: 'www.xcar.com.cn',
  649. functionStart: function() {if (location.pathname === '/bbs/forumdisplay.php') {curSite = DBSite.xcar_forumdisplay}},
  650. pager: {
  651. type: 1,
  652. nextLink: 'css;a.page_down',
  653. pageElement: 'css;.table-section > dl:not(.table_head)',
  654. insertPosition: ['css;.table-section', 3],
  655. replaceE: 'css;.forumList_page',
  656. scrollDelta: 2000
  657. }
  658. }, // 爱卡汽车网论坛 - 各版块帖子列表
  659. flyert_forumdisplay: {
  660. SiteTypeID: 0,
  661. host: 'www.flyert.com',
  662. functionStart: function() {if (location.search.indexOf('mod=forumdisplay') > -1) {
  663. curSite = DBSite.flyert_forumdisplay;
  664. } else if (location.search.indexOf('mod=viewthread') > -1) {
  665. if (GM_getValue('menu_discuz_thread_page')) {curSite = DBSite.flyert_viewthread;}
  666. }},
  667. pager: {
  668. type: 1,
  669. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))]',
  670. pageElement: 'css;#threadlist table > tbody[id^="normalthread_"]',
  671. insertPosition: ['id("threadlist")//table/tbody[starts-with(@id, "normalthread_")]/parent::table', 3],
  672. replaceE: 'css;.pg',
  673. scrollDelta: 2500
  674. }
  675. }, // 飞客网论坛 - 各版块帖子列表
  676. flyert_viewthread: {
  677. SiteTypeID: 0,
  678. pager: {
  679. type: 1,
  680. nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))]',
  681. pageElement: 'css;#postlist > .comiis_viewbox',
  682. insertPosition: ['css;#postlist', 3],
  683. replaceE: 'css;.comiis_pgs > .pg',
  684. scrollDelta: 3000
  685. }
  686. }, // 飞客网论坛 - 帖子内
  687. zhutix: {
  688. SiteTypeID: 0,
  689. host: 'zhutix.com',
  690. functionStart: function() {if (document.getElementById('primary-home')) {
  691. curSite = DBSite.zhutix_postlist;
  692. } else {
  693. curSite = DBSite.zhutix;
  694. }},
  695. pager: {
  696. type: 1,
  697. nextLink: '//li[@class="next-page"]/a | //div[@class="btn-pager"]/a[contains(text(), "❯")]',
  698. pageElement: 'css;#post-list > ul > li',
  699. insertPosition: ['css;#post-list > ul', 3],
  700. replaceE: 'css;.pagination, .b2-pagenav.post-nav',
  701. scrollDelta: 1500
  702. }
  703. }, // 致美化
  704. zhutix_postlist: {
  705. SiteTypeID: 0,
  706. pager: {
  707. type: 1,
  708. nextLink: '//li[@class="next-page"]/a',
  709. pageElement: 'css;#primary-home > div:not(.pagination)',
  710. insertPosition: ['css;.pagination', 1],
  711. replaceE: 'css;.pagination',
  712. scrollDelta: 1500
  713. }
  714. }, // 致美化 - 文章列表
  715. jandan: {
  716. SiteTypeID: 0,
  717. host: 'jandan.net',
  718. functionStart: function() {if (location.pathname === '/' || location.pathname.indexOf('/page/') > -1) {
  719. curSite = DBSite.jandan;
  720. } else if (location.pathname === '/dzh') {
  721. curSite = DBSite.jandan_dzh;
  722. } else {
  723. curSite = DBSite.jandan_comment;
  724. }},
  725. pager: {
  726. type: 1,
  727. nextLink: '//div[@class="wp-pagenavi"]/a[contains(text(), "下一页") or contains(text(), "更多文章")]',
  728. pageElement: 'css;#content > .list-post',
  729. insertPosition: ['css;.wp-pagenavi', 1],
  730. replaceE: 'css;.wp-pagenavi, #nav_prev',
  731. scrollDelta: 1500
  732. },
  733. function: {
  734. before: src_original_functionBefore
  735. }
  736. }, // 煎蛋网
  737. jandan_comment: {
  738. SiteTypeID: 0,
  739. pager: {
  740. type: 1,
  741. nextLink: 'css;a.previous-comment-page',
  742. pageElement: 'css;ol.commentlist > li[id^="comment-"], script[src^="//cdn.jandan.net/static/min/"]',
  743. insertPosition: ['css;ol.commentlist', 3],
  744. replaceE: 'css;.cp-pagenavi, #nav_prev',
  745. scriptType: 3,
  746. scrollDelta: 1500
  747. }
  748. }, // 煎蛋网
  749. jandan_dzh: {
  750. SiteTypeID: 0,
  751. pager: {
  752. type: 2,
  753. nextLink: '.show_more',
  754. intervals: 1500,
  755. scrollDelta: 1500
  756. }
  757. }, // 煎蛋网 - 大杂烩
  758. expreview: {
  759. SiteTypeID: 0,
  760. host: 'www.expreview.com',
  761. pager: {
  762. type: 2,
  763. nextLink: '#show_article_red_1SHOW',
  764. intervals: 1500,
  765. scrollDelta: 1500
  766. }
  767. }, // 超能网
  768. landian: {
  769. SiteTypeID: 0,
  770. host: 'www.landian.vip',
  771. pager: {
  772. type: 2,
  773. nextLink: '.load-more > button',
  774. nextText: '加载更多',
  775. scrollDelta: 1300
  776. }
  777. }, // 蓝点网
  778. ithome: {
  779. SiteTypeID: 0,
  780. host: 'www.ithome.com',
  781. pager: {
  782. type: 2,
  783. nextLink: 'a.more',
  784. intervals: 1500,
  785. scrollDelta: 1500
  786. }
  787. }, // IT 之家
  788. puxiang: {
  789. SiteTypeID: 0,
  790. host: 'www.puxiang.com',
  791. functionStart: function() {if (location.pathname === '/search/favorite') {
  792. curSite = DBSite.puxiang_collect;
  793. } else if (location.pathname === '/search/puxiang' || location.pathname === '/list' || location.pathname === '/galleries' || location.pathname === '/articles') {
  794. curSite = DBSite.puxiang;
  795. } else if (location.pathname === '/') {
  796. curSite = DBSite.puxiang; curSite.pager.scrollDelta = 4000;
  797. }},
  798. pager: {
  799. type: 1,
  800. nextLink: 'css;li.next > a[href]',
  801. pageElement: 'css;.work-list > div',
  802. insertPosition: ['css;.work-list', 3],
  803. replaceE: 'css;.pagerbar',
  804. scrollDelta: 1500
  805. }
  806. }, // 普象网 - 作品集/搜索页
  807. puxiang_collect: {
  808. SiteTypeID: 0,
  809. pager: {
  810. type: 1,
  811. nextLink: 'css;li.next > a[href]',
  812. pageElement: 'css;.collect-list > div',
  813. insertPosition: ['css;.collect-list', 3],
  814. replaceE: 'css;.pagerbar',
  815. scrollDelta: 1500
  816. }
  817. }, // 普象网 - 收藏夹
  818. _58pic: {
  819. SiteTypeID: 0,
  820. host: 'www.58pic.com',
  821. functionStart: function() {if (location.pathname.indexOf('/tupian/') > -1) {
  822. curSite = DBSite._58pic; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.qtw-card.place-box.is-two {display: none !important;}'; // 隐藏末尾很大的 [下一页] 按钮
  823. } else if (location.pathname.indexOf('/c/') > -1) {
  824. curSite = DBSite._58pic_c;
  825. }},
  826. pager: {
  827. type: 1,
  828. nextLink: '//div[contains(@class,"page-box")]//a[text()="下一页"][@href]',
  829. pageElement: 'css;.pic-box > .qtw-card',
  830. insertPosition: ['css;.pic-box', 3],
  831. replaceE: 'css;.page-box',
  832. scrollDelta: 2000
  833. },
  834. function: {
  835. before: _58pic_functionBefore
  836. }
  837. }, // 千图网 - 分类/搜索页
  838. _58pic_c: {
  839. SiteTypeID: 0,
  840. pager: {
  841. type: 1,
  842. nextLink: '//div[contains(@class,"page-box")]//a[text()="下一页"][@href]',
  843. pageElement: 'css;.list-box > .qtw-card',
  844. insertPosition: ['css;.list-box', 3],
  845. replaceE: 'css;.page-box',
  846. scrollDelta: 4000
  847. },
  848. function: {
  849. before: _58pic_functionBefore
  850. }
  851. }, // 千图网 - 专题/收藏夹
  852. pixabay: {
  853. SiteTypeID: 0,
  854. host: 'pixabay.com',
  855. pager: {
  856. type: 1,
  857. nextLink: '//a[text()="Next page"][@href]',
  858. pageElement: 'css;[class^="results"] > [class^="container"] > div',
  859. insertPosition: ['css;[class^="results"] > [class^="container"]', 3],
  860. replaceE: '//a[text()="Next page"][@href]',
  861. scrollDelta: 2000
  862. },
  863. function: {
  864. before: pixabay_functionBefore
  865. }
  866. },
  867. _3dmgame: {
  868. SiteTypeID: 0,
  869. host: 'www.3dmgame.com',
  870. pager: {
  871. type: 3,
  872. nextLink: '//li[@class="next"]/a[@href]',
  873. pageElement: 'css;.news_warp_center > *',
  874. insertPosition: ['css;.news_warp_center', 3],
  875. replaceE: 'css;.pagewrap',
  876. scrollElement: '.pagewrap',
  877. scrollDelta: 400
  878. }
  879. },
  880. ali213_www: {
  881. SiteTypeID: 0,
  882. host: 'www.ali213.net',
  883. pager: {
  884. type: 3,
  885. nextLink: 'id("after_this_page")[@href]',
  886. pageElement: 'css;#Content >*:not(.news_ding):not(.page_fenye)',
  887. insertPosition: ['css;.page_fenye', 1],
  888. replaceE: 'css;.page_fenye',
  889. scrollElement: '.page_fenye',
  890. scrollDelta: 400
  891. }
  892. }, // 游侠网
  893. ali213_gl: {
  894. SiteTypeID: 0,
  895. host: 'gl.ali213.net',
  896. functionStart: function() {curSite = DBSite.ali213_gl; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.n_show_b {display: none !important;}';},
  897. pager: {
  898. type: 3,
  899. nextLink: '//a[@class="next n"][@href]',
  900. pageElement: 'css;.c-detail >*',
  901. insertPosition: ['css;.c-detail', 3],
  902. replaceE: 'css;.page_fenye',
  903. scrollElement: '.page_fenye',
  904. scrollDelta: 400
  905. }
  906. }, // 游侠网 - 攻略
  907. ali213_pic: {
  908. SiteTypeID: 0,
  909. host: 'pic.ali213.net',
  910. functionStart: function() {curSite = DBSite.ali213_pic; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'a.prev, a.next {display: none !important;}';},
  911. pager: {
  912. type: 1,
  913. nextLink: 'css;a.next[href]',
  914. pageElement: 'css;#image-show > img',
  915. insertPosition: ['css;#image-show', 3],
  916. replaceE: 'css;#image-show > a',
  917. scrollDelta: 1200
  918. }
  919. }, // 游侠网 - 图库
  920. gamersky_ent: {
  921. SiteTypeID: 0,
  922. host: 'www.gamersky.com',
  923. functionStart: function() {if (location.pathname.indexOf('/ent/') > -1) {curSite = DBSite.gamersky_ent;} else {curSite = DBSite.gamersky_gl;}},
  924. pager: {
  925. type: 3,
  926. nextLink: '//div[@class="page_css"]/a[text()="下一页"][@href]',
  927. pageElement: 'css;.Mid2L_con > *:not(.gs_nc_editor):not(.pagecss):not(.page_css):not(.gs_ccs_solve):not(.post_ding)',
  928. insertPosition: ['css;.page_css', 1],
  929. replaceE: 'css;.page_css',
  930. scrollElement: '.page_css',
  931. scrollDelta: 100
  932. }
  933. }, // 游民星空
  934. gamersky_gl: {
  935. SiteTypeID: 0,
  936. pager: {
  937. type: 3,
  938. nextLink: '//div[@class="page_css"]/a[text()="下一页"][@href]',
  939. pageElement: 'css;.Mid2L_con > *:not(.gs_nc_editor):not(.pagecss):not(.gs_ccs_solve):not(.post_ding)',
  940. insertPosition: ['css;.gs_nc_editor', 1],
  941. replaceE: 'css;.page_css',
  942. scrollElement: '.pagecss',
  943. scrollDelta: -1000
  944. },
  945. function: {
  946. before: gamersky_gl_functionBefore
  947. }
  948. }, // 游民星空 - 攻略
  949. nexusmods: {
  950. SiteTypeID: 0,
  951. host: 'www.nexusmods.com',
  952. pager: {
  953. type: 4,
  954. nextLink: nexusmods_functionNext,
  955. pageElement: 'css;#mod-list > ul.tiles > li',
  956. insertPosition: ['css;#mod-list > ul.tiles', 3],
  957. insertElement: nexusmods_insertElement,
  958. replaceE: 'css;#mod-list .pagination',
  959. scrollDelta: 3000
  960. }
  961. }, // NexusMods
  962. steamcommunity: {
  963. SiteTypeID: 0,
  964. host: 'steamcommunity.com',
  965. pager: {
  966. type: 1,
  967. nextLink: '//a[@class="pagebtn"][last()][@href]',
  968. pageElement: 'css;.workshopBrowseItems > *',
  969. insertPosition: ['css;.workshopBrowseItems', 3],
  970. replaceE: 'css;.workshopBrowsePaging',
  971. scriptType: 2,
  972. scrollDelta: 1500
  973. }
  974. }, // 创意工坊 - 项目列表
  975. yikm: {
  976. SiteTypeID: 0,
  977. host: 'www.yikm.net',
  978. pager: {
  979. type: 1,
  980. nextLink: '//ul[@class="pager"]//a[text()="下一页"]',
  981. pageElement: '//h2[contains(text(), "所有游戏") or contains(text(), "搜索结果")]/following-sibling::div[1]/div',
  982. insertPosition: ['//h2[contains(text(), "所有游戏") or contains(text(), "搜索结果")]/following-sibling::div[1]', 3],
  983. replaceE: 'css;ul.pager',
  984. scrollDelta: 1500
  985. }
  986. }, // 小霸王其乐无穷
  987. cs_rin_ru: {
  988. SiteTypeID: 0,
  989. host: 'cs.rin.ru',
  990. functionStart: function() {if (location.pathname === '/forum/viewforum.php') { // 版块帖子列表
  991. curSite = DBSite.cs_rin_ru;
  992. } else if (location.pathname === '/forum/viewtopic.php') { // 帖子内
  993. if (GM_getValue('menu_discuz_thread_page')) curSite = DBSite.cs_rin_ru_viewtopic;
  994. } else if (location.pathname === '/forum/search.php') { // 搜索结果
  995. curSite = DBSite.cs_rin_ru_search;
  996. }},
  997. pager: {
  998. type: 1,
  999. nextLink: '//td[@class="gensmall"][@align="right"]//a[text()="Next"][@href]',
  1000. pageElement: 'css;#pagecontent > table.tablebg > tbody > tr:not([align])',
  1001. insertPosition: ['css;#pagecontent > table.tablebg > tbody > tr[align]', 1],
  1002. replaceE: 'css;#pagecontent > table:first-child',
  1003. scrollDelta: 1500
  1004. },
  1005. function: {
  1006. before: cs_rin_ru_functionBefore
  1007. }
  1008. }, // 各版块帖子列表
  1009. cs_rin_ru_viewtopic: {
  1010. SiteTypeID: 0,
  1011. pager: {
  1012. type: 1,
  1013. nextLink: 'id("pageheader")/p[@class="gensmall"]//a[text()="Next"][@href]',
  1014. pageElement: 'css;#pagecontent > table.tablebg:not(:nth-last-child(2)):not(:nth-child(2))',
  1015. insertPosition: ['css;#pagecontent > table.tablebg:nth-last-child(2)', 1],
  1016. replaceE: 'css;#pagecontent >table:not(.tablebg), #pageheader p.gensmall',
  1017. scrollDelta: 1500
  1018. }
  1019. }, // 帖子内
  1020. cs_rin_ru_search: {
  1021. SiteTypeID: 0,
  1022. pager: {
  1023. type: 1,
  1024. nextLink: 'id("wrapcentre")/div[@class="nav"]//a[text()="Next"]',
  1025. pageElement: 'css;#wrapcentre > form > table.tablebg > tbody > tr[valign]',
  1026. insertPosition: ['css;#wrapcentre > form > table.tablebg > tbody > tr:last-child', 1],
  1027. replaceE: 'css;#wrapcentre > div',
  1028. scrollDelta: 1500
  1029. }
  1030. }, // 搜索页
  1031. crackhub: {
  1032. SiteTypeID: 0,
  1033. host: 'crackhub.site',
  1034. 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);}';},
  1035. pager: {
  1036. type: 1,
  1037. nextLink: '//a[@class="next page-numbers"][@href]',
  1038. pageElement: 'css;article[id^="post-"]',
  1039. insertPosition: ['css;nav.paging-navigation', 1],
  1040. replaceE: 'css;nav.paging-navigation',
  1041. scrollDelta: 2000
  1042. }
  1043. },
  1044. fitgirl: {
  1045. SiteTypeID: 0,
  1046. host: 'fitgirl-repacks.site',
  1047. pager: {
  1048. type: 1,
  1049. nextLink: '//a[@class="next page-numbers"][@href]',
  1050. pageElement: 'css;article[id^="post-"]',
  1051. insertPosition: ['css;nav.paging-navigation', 1],
  1052. replaceE: 'css;nav.paging-navigation',
  1053. scrollDelta: 2000
  1054. }
  1055. },
  1056. cupfox: {
  1057. SiteTypeID: 0,
  1058. host: 'www.cupfox.com',
  1059. functionStart: function() {if (location.pathname === '/search') {curSite = DBSite.cupfox;}},
  1060. pager: {
  1061. type: 2,
  1062. nextLink: '.load-more',
  1063. nextText: '点击加载更多',
  1064. scrollDelta: 700
  1065. }
  1066. }, // 茶杯狐
  1067. novipnoad: {
  1068. SiteTypeID: 0,
  1069. host: 'www.novipnoad.com',
  1070. functionStart: function() {if (location.pathname != '/' && location.pathname.indexOf('.html') === -1) {curSite = DBSite.novipnoad;}},
  1071. pager: {
  1072. type: 1,
  1073. nextLink: 'css;a.nextpostslink',
  1074. pageElement: 'css;.video-listing-content .row > div',
  1075. insertPosition: ['css;.video-listing-content .row', 3],
  1076. replaceE: 'css;.wp-pagenavi',
  1077. scrollDelta: 1500
  1078. },
  1079. function: {
  1080. before: src_original_functionBefore
  1081. }
  1082. }, // NO视频
  1083. nfmovies: {
  1084. SiteTypeID: 0,
  1085. host: 'www.nfmovies.com',
  1086. functionStart: function() {if (location.pathname === '/search.php' || location.pathname.indexOf('/list/') > -1) {curSite = DBSite.nfmovies;}},
  1087. pager: {
  1088. type: 1,
  1089. nextLink: '//ul[contains(@class, "myui-page")]/li/a[contains(text(), "下一页")]',
  1090. pageElement: 'css;ul.myui-vodlist > li',
  1091. insertPosition: ['css;ul.myui-vodlist', 3],
  1092. replaceE: 'css;ul.myui-page',
  1093. scrollDelta: 1500
  1094. },
  1095. function: {
  1096. before: nfmovies_functionBefore
  1097. }
  1098. }, // 奈菲影视
  1099. ddrk: {
  1100. SiteTypeID: 0,
  1101. host: 'ddrk.me',
  1102. functionStart: function() {if (location.pathname === '/' || location.pathname.indexOf('/category/') > -1 || location.pathname.indexOf('/tag/') > -1) {curSite = DBSite.ddrk;}},
  1103. pager: {
  1104. type: 1,
  1105. nextLink: 'css;a.next',
  1106. pageElement: 'css;.post-box-list > article',
  1107. insertPosition: ['css;.post-box-list', 3],
  1108. replaceE: 'css;.pagination_wrap',
  1109. scrollDelta: 1500
  1110. }
  1111. }, // 低端影视
  1112. zhenbuka: {
  1113. SiteTypeID: 0,
  1114. host: ['www.zhenbuka3.com', 'www.zhenbuka5.com'],
  1115. functionStart: function() {if (location.pathname.indexOf('/vodtype/') > -1) {curSite = DBSite.zhenbuka;}},
  1116. pager: {
  1117. type: 1,
  1118. nextLink: '//ul[contains(@class, "stui-page")]/li/a[contains(text(), "下一页")]',
  1119. pageElement: 'css;ul.stui-vodlist > li',
  1120. insertPosition: ['css;ul.stui-vodlist', 3],
  1121. replaceE: 'css;ul.stui-page',
  1122. scrollDelta: 1500
  1123. },
  1124. function: {
  1125. before: nfmovies_functionBefore
  1126. }
  1127. }, // 真不卡影院
  1128. _91mjw: {
  1129. SiteTypeID: 0,
  1130. host: '91mjw.com',
  1131. functionStart: function() {if (location.pathname.indexOf('/video/') === -1 || location.pathname.indexOf('/vplay/') === -1) {curSite = DBSite._91mjw;}},
  1132. pager: {
  1133. type: 1,
  1134. nextLink: 'css;.next-page > a',
  1135. pageElement: 'css;.m-movies > article',
  1136. insertPosition: ['css;.pagination', 1],
  1137. replaceE: 'css;.pagination',
  1138. scrollDelta: 1500
  1139. },
  1140. function: {
  1141. before: src_original_functionBefore
  1142. }
  1143. }, // 91 美剧网
  1144. mypianku: {
  1145. SiteTypeID: 0,
  1146. host: 'www.mypianku.net',
  1147. pager: {
  1148. type: 1,
  1149. nextLink: 'css;a.a1[href]',
  1150. pageElement: 'css;.content-list > li',
  1151. insertPosition: ['css;.content-list', 3],
  1152. replaceE: 'css;.pages',
  1153. scrollDelta: 1500
  1154. },
  1155. function: {
  1156. before: mypianku_functionBefore
  1157. }
  1158. }, // 片库
  1159. yinfans: {
  1160. SiteTypeID: 0,
  1161. host: 'www.yinfans.net',
  1162. pager: {
  1163. type: 1,
  1164. nextLink: 'css;a.next[href]',
  1165. pageElement: 'css;#post_container > li',
  1166. insertPosition: ['css;#post_container', 3],
  1167. replaceE: 'css;.pagination',
  1168. scrollDelta: 1500
  1169. }
  1170. }, // 音范丝
  1171. btbtt: {
  1172. SiteTypeID: 0,
  1173. host: 'btbtt',
  1174. pager: {
  1175. type: 1,
  1176. nextLink: '//div[@class="page"]/a[contains(text(), "▶") or contains(text(), "下一页")]',
  1177. pageElement: 'css;#threadlist > table, #threadlist > hr',
  1178. insertPosition: ['css;#threadlist', 3],
  1179. replaceE: 'css;.page',
  1180. scrollDelta: 2000
  1181. }
  1182. }, // BT 之家
  1183. gaoqing_fm: {
  1184. SiteTypeID: 0,
  1185. host: 'gaoqing.fm',
  1186. pager: {
  1187. type: 2,
  1188. nextLink: '.col-md-12 > a[href], #loadmore > a[href]',
  1189. intervals: 1500,
  1190. scrollDelta: 1000
  1191. }
  1192. }, // 高清电台
  1193. kisssub: {
  1194. SiteTypeID: 0,
  1195. host: 'www.kisssub.org',
  1196. pager: {
  1197. type: 1,
  1198. nextLink: 'css;a.nextprev',
  1199. pageElement: 'css;#data_list > tr',
  1200. insertPosition: ['css;#data_list', 3],
  1201. replaceE: 'css;.pages',
  1202. scrollDelta: 2500
  1203. }
  1204. }, // 爱恋动漫
  1205. nyaa: {
  1206. SiteTypeID: 0,
  1207. host: 'nyaa.si',
  1208. pager: {
  1209. type: 1,
  1210. nextLink: '//a[@rel="next"][@href] | //li[@class="next"]/a[@href]',
  1211. pageElement: 'css;table.torrent-list > tbody > tr',
  1212. insertPosition: ['css;table.torrent-list > tbody', 3],
  1213. replaceE: 'css;ul.pagination',
  1214. scrollDelta: 2000
  1215. }
  1216. }, // Nyaa
  1217. skrbtba: {
  1218. SiteTypeID: 0,
  1219. host: 'skrbtca.xyz',
  1220. functionStart: function() {if (location.pathname === '/search') curSite = DBSite.skrbtba;},
  1221. pager: {
  1222. type: 1,
  1223. nextLink: '//a[@aria-label="Next"]',
  1224. pageElement: 'css;div[class="row"] > .col-md-6 > ul',
  1225. insertPosition: ['css;nav[aria-label*="Page"]', 1],
  1226. replaceE: 'css;ul.pagination',
  1227. scrollDelta: 900
  1228. }
  1229. }, // SkrBT
  1230. rarbgprx: {
  1231. SiteTypeID: 0,
  1232. host: 'rarbgprx.org',
  1233. pager: {
  1234. type: 1,
  1235. nextLink: '(//a[@title="next page"])[1][@href]',
  1236. pageElement: 'css;table.lista2t tr.lista2',
  1237. insertPosition: ['css;table.lista2t > tbody', 3],
  1238. replaceE: 'css;#pager_links',
  1239. scrollDelta: 1000
  1240. }
  1241. }, // RARBG
  1242. subhd: {
  1243. SiteTypeID: 0,
  1244. host: 'subhd.tv',
  1245. functionStart: function() {if (location.pathname === '/forum/forum') {
  1246. curSite = DBSite.subhd_forum;
  1247. } else if (location.pathname != '/' && location.pathname != '/zu' && location.pathname.indexOf('/a/') === -1 && location.pathname.indexOf('/d/') === -1 && location.pathname.indexOf('/forum/') === -1) {
  1248. curSite = DBSite.subhd;
  1249. }},
  1250. pager: {
  1251. type: 1,
  1252. nextLink: '//a[@class="page-link"][contains(text(), "下一页")]',
  1253. pageElement: 'css;.bg-white.shadow-sm.rounded-3',
  1254. insertPosition: ['css;nav.clearfix', 1],
  1255. replaceE: 'css;nav.clearfix',
  1256. scrollDelta: 1000
  1257. }
  1258. }, // SubHD
  1259. subhd_forum: {
  1260. SiteTypeID: 0,
  1261. pager: {
  1262. type: 1,
  1263. nextLink: '//a[@class="page-link"][contains(text(), "下一页")]',
  1264. pageElement: 'css;.bg-white.shadow-sm.rounded-3 > div',
  1265. insertPosition: ['css;.bg-white.shadow-sm.rounded-3', 3],
  1266. replaceE: 'css;nav.clearfix',
  1267. scrollDelta: 800
  1268. }
  1269. }, // SubHD - forum
  1270. baoshuu: {
  1271. SiteTypeID: 0,
  1272. host: 'www.baoshuu.com',
  1273. functionStart: function() {if (location.pathname.indexOf('/TXT/list') > -1) curSite = DBSite.baoshuu;},
  1274. pager: {
  1275. type: 1,
  1276. nextLink: '//div[@class="listl2"]//a[@href][text()="下一页"]',
  1277. pageElement: 'css;.listl2 > ul > li',
  1278. insertPosition: ['css;.listl2 > ul', 3],
  1279. replaceE: 'css;listl2 > dl',
  1280. mimeType: 'text/html; charset=gb2312',
  1281. scrollDelta: 900
  1282. }
  1283. }, // 宝书网(小说)
  1284. baoshuu_m: {
  1285. SiteTypeID: 0,
  1286. host: 'm.baoshuu.com',
  1287. functionStart: function() {if (location.pathname.indexOf('/TXT/list') > -1) curSite = DBSite.baoshuu_m;},
  1288. pager: {
  1289. type: 1,
  1290. nextLink: '//div[@class="man_first"]//a[@href][text()="下一页"]',
  1291. pageElement: 'css;.man_first > ul > li',
  1292. insertPosition: ['css;.man_first > ul', 3],
  1293. replaceE: 'css;.man_first > dl',
  1294. mimeType: 'text/html; charset=gb2312',
  1295. scrollDelta: 900
  1296. }
  1297. }, // 宝书网(小说)- 手机版
  1298. qidian: {
  1299. SiteTypeID: 0,
  1300. host: 'www.qidian.com',
  1301. functionStart: function() {if (location.pathname.indexOf('/all/') > -1) {curSite = DBSite.qidian;}},
  1302. pager: {
  1303. type: 1,
  1304. nextLink: 'css;a[class*="pagination-next"][href]',
  1305. pageElement: 'css;ul.all-img-list > li',
  1306. insertPosition: ['css;ul.all-img-list', 3],
  1307. replaceE: 'css;#page-container',
  1308. scrollDelta: 900
  1309. }
  1310. }, // 起点小说
  1311. qidian_read: {
  1312. SiteTypeID: 0,
  1313. host: 'read.qidian.com',
  1314. functionStart: function() {if (location.pathname.indexOf('/chapter/') > -1) {curSite = DBSite.qidian_read; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.admire-wrap {display: none !important;}';}},
  1315. pager: {
  1316. type: 1,
  1317. nextLink: 'css;a[id$="chapterNext"][href]',
  1318. pageElement: 'css;.main-text-wrap > div:not(.admire-wrap)',
  1319. insertPosition: ['css;.main-text-wrap', 3],
  1320. replaceE: 'css;.chapter-control, title',
  1321. history: true,
  1322. scrollDelta: 900
  1323. }
  1324. }, // 起点小说 - 阅读页
  1325. _423down: {
  1326. SiteTypeID: 0,
  1327. host: 'www.423down.com',
  1328. functionStart: function() {if (location.pathname.indexOf('.html') === -1) curSite = DBSite._423down;},
  1329. pager: {
  1330. type: 1,
  1331. nextLink: '//div[@class="paging"]//a[contains(text(),"下一页")][@href]',
  1332. pageElement: 'css;div.content-wrap ul.excerpt > li',
  1333. insertPosition: ['css;div.content-wrap ul.excerpt', 3],
  1334. replaceE: 'css;div.paging',
  1335. scrollDelta: 1500
  1336. }
  1337. },
  1338. iao_su: {
  1339. SiteTypeID: 0,
  1340. host: 'iao.su',
  1341. pager: {
  1342. type: 1,
  1343. nextLink: '//li[@class="btn btn-primary next"]//a[@href]',
  1344. pageElement: 'css;#index > article, #archive > article',
  1345. insertPosition: ['css;ol.page-navigator', 1],
  1346. replaceE: 'css;ol.page-navigator',
  1347. scrollDelta: 1000
  1348. },
  1349. function: {
  1350. before: iao_su_functionBefore
  1351. }
  1352. }, // 不死鸟
  1353. appinn: {
  1354. SiteTypeID: 0,
  1355. host: 'www.appinn.com',
  1356. pager: {
  1357. type: 1,
  1358. nextLink: '//a[@class="next page-numbers"][@href]',
  1359. pageElement: 'css;section#latest-posts > article',
  1360. insertPosition: ['css;nav.navigation.pagination', 1],
  1361. replaceE: 'css;div.nav-links',
  1362. scrollDelta: 1500
  1363. }
  1364. }, // 小众软件
  1365. chrome_zzzmh: {
  1366. SiteTypeID: 0,
  1367. host: 'chrome.zzzmh.cn',
  1368. pager: {
  1369. type: 2,
  1370. nextLink: 'button.more-btn',
  1371. intervals: 1000,
  1372. scrollDelta: 1500
  1373. }
  1374. }, // 极简插件
  1375. isharepc: {
  1376. SiteTypeID: 0,
  1377. host: 'www.isharepc.com',
  1378. pager: {
  1379. type: 1,
  1380. nextLink: 'css;a.next[href]',
  1381. pageElement: 'css;.content > div',
  1382. insertPosition: ['css;nav.pagination', 1],
  1383. replaceE: 'css;nav.pagination',
  1384. scrollDelta: 1000
  1385. }
  1386. }, // 乐软博客
  1387. pc521: {
  1388. SiteTypeID: 0,
  1389. host: 'www.pc521.net',
  1390. functionStart: function() {if (location.search.slice(0,3) === '?s=') {curSite = DBSite.pc521_search;} else {curSite = DBSite.pc521;}},
  1391. pager: {
  1392. type: 2,
  1393. nextLink: 'div[id^="ias_trigger_"]',
  1394. intervals: 1000,
  1395. scrollDelta: 1000
  1396. }
  1397. }, // 不忘初心
  1398. pc521_search: {
  1399. SiteTypeID: 0,
  1400. pager: {
  1401. type: 1,
  1402. nextLink: 'css;a.next[href]',
  1403. pageElement: 'css;#main > ul > li',
  1404. insertPosition: ['css;#main > ul', 3],
  1405. replaceE: 'css;nav.pagination',
  1406. scrollDelta: 1500
  1407. }
  1408. }, // 不忘初心 - 搜索页
  1409. ghxi: {
  1410. SiteTypeID: 0,
  1411. host: 'www.ghxi.com',
  1412. functionStart: function() {if (location.pathname === '/' && !location.search) {curSite = DBSite.ghxi;} else {curSite = DBSite.ghxi_postlist;}},
  1413. pager: {
  1414. type: 2,
  1415. nextLink: '.load-more',
  1416. intervals: 1000,
  1417. scrollDelta: 5000
  1418. }
  1419. }, // 果核剥壳 - 首页
  1420. ghxi_postlist: {
  1421. SiteTypeID: 0,
  1422. pager: {
  1423. type: 1,
  1424. nextLink: 'css;a.next[href]',
  1425. pageElement: 'css;ul.post-loop > li',
  1426. insertPosition: ['css;ul.post-loop', 3],
  1427. replaceE: 'css;ul.pagination',
  1428. scrollDelta: 1500
  1429. },
  1430. function: {
  1431. before: src_original_functionBefore
  1432. }
  1433. }, // 果核剥壳 - 分类/搜索页
  1434. sixyin: {
  1435. SiteTypeID: 0,
  1436. host: 'www.sixyin.com',
  1437. functionStart: function() {if (location.pathname === '/' && location.search === '') { // 首页
  1438. curSite = DBSite.sixyin;
  1439. } else if (location.pathname.indexOf('.html') === -1) { // 分类页
  1440. curSite = DBSite.sixyin_postlist;
  1441. }},
  1442. pager: {
  1443. type: 2,
  1444. nextLink: '.load-more',
  1445. nextHTML: '点击查看更多',
  1446. scrollDelta: 1500
  1447. }
  1448. }, // 六音软件 - 首页
  1449. sixyin_postlist: {
  1450. SiteTypeID: 0,
  1451. pager: {
  1452. type: 1,
  1453. nextLink: '//a[@class="next"][@href]',
  1454. pageElement: 'css;ul.post-loop > li',
  1455. insertPosition: ['css;ul.post-loop', 3],
  1456. replaceE: 'css;ul.pagination',
  1457. scrollDelta: 1500
  1458. }
  1459. }, // 六音软件 - 分类页
  1460. weidown: {
  1461. SiteTypeID: 0,
  1462. host: 'www.weidown.com',
  1463. functionStart: function() {if (location.pathname.indexOf('/search/') > -1) { //搜索页
  1464. curSite = DBSite.weidown_search;
  1465. } else if (location.pathname.indexOf('/special/') > -1) { // 专题页
  1466. curSite = DBSite.weidown_special;
  1467. } else {
  1468. curSite = DBSite.weidown;
  1469. }},
  1470. pager: {
  1471. type: 1,
  1472. nextLink: '//a[@class="nextpage"][@href]',
  1473. pageElement: 'css;.articleWrapper > .itemArticle, .articleWrapper > .richTextItem.search',
  1474. insertPosition: ['css;.articleWrapper', 3],
  1475. replaceE: 'css;#pageGroup',
  1476. scrollDelta: 1500
  1477. }
  1478. }, // 微当下载
  1479. weidown_search: {
  1480. SiteTypeID: 0,
  1481. pager: {
  1482. type: 1,
  1483. nextLink: '//a[@class="nextpage"][@href]',
  1484. pageElement: 'css;.articleListWrapper > .richTextItem.search',
  1485. insertPosition: ['css;#pageGroup', 1],
  1486. replaceE: 'css;#pageGroup',
  1487. scrollDelta: 700
  1488. }
  1489. }, // 微当下载 - 搜索页
  1490. weidown_special: {
  1491. SiteTypeID: 0,
  1492. pager: {
  1493. type: 1,
  1494. nextLink: '//a[@class="nextpage"][@href]',
  1495. pageElement: 'css;.special > .item',
  1496. insertPosition: ['css;.special', 3],
  1497. replaceE: 'css;#pageGroup',
  1498. scrollDelta: 700
  1499. }
  1500. }, // 微当下载 - 专题页
  1501. th_sjy: {
  1502. SiteTypeID: 0,
  1503. host: 'www.th-sjy.com',
  1504. pager: {
  1505. type: 1,
  1506. nextLink: 'css;li.next-page > a',
  1507. pageElement: 'css;.content > article',
  1508. insertPosition: ['css;.pagination', 1],
  1509. replaceE: 'css;.pagination',
  1510. scrollDelta: 2000
  1511. }
  1512. }, // th-sjy 汉化
  1513. iplaysoft_postslist: {
  1514. SiteTypeID: 0,
  1515. host: 'www.iplaysoft.com',
  1516. functionStart: function() {if (location.pathname.indexOf('.html') > -1 || location.pathname.indexOf('/p/') > -1) { // 文章内
  1517. curSite = DBSite.iplaysoft_postcomments;
  1518. } else { // 其他页面
  1519. curSite = DBSite.iplaysoft_postslist;
  1520. }},
  1521. pager: {
  1522. type: 1,
  1523. nextLink: '//div[@class="pagenavi"]//a[@title="下一页"][@href]',
  1524. pageElement: 'css;#postlist > div.entry',
  1525. insertPosition: ['css;#postlist > .pagenavi-button', 1],
  1526. replaceE: 'css;.pagenavi-button, .pagenavi',
  1527. scrollDelta: 1200
  1528. },
  1529. function: {
  1530. before: iplaysoft_postslist_functionBefore
  1531. }
  1532. }, // 异次元软件世界
  1533. iplaysoft_postcomments: {
  1534. SiteTypeID: 0,
  1535. pager: {
  1536. type: 2,
  1537. nextLink: '#loadHistoryComments',
  1538. nextTextOf: '展开后面',
  1539. scrollDelta: 1200
  1540. }
  1541. }, // 异次元软件世界 - 评论
  1542. mpyit: {
  1543. SiteTypeID: 0,
  1544. host: 'www.mpyit.com',
  1545. functionStart: function() {if (location.pathname === '/' && !location.search) {
  1546. curSite = DBSite.mpyit;
  1547. } else if (location.pathname.indexOf('/category/') > -1 || location.search.indexOf('?s=') > -1) { // 搜索页 / 分类页
  1548. curSite = DBSite.mpyit_category;
  1549. }},
  1550. pager: {
  1551. type: 1,
  1552. nextLink: '//a[@class="page-numbers"][@title="下一页"][@href]',
  1553. pageElement: 'css;#post > div[id^="post-"]',
  1554. insertPosition: ['css;#post > #pagenavi', 1],
  1555. replaceE: 'css;#post > #pagenavi',
  1556. scrollDelta: 1700
  1557. }
  1558. }, // 老殁 | 殁漂遥
  1559. mpyit_category: {
  1560. SiteTypeID: 0,
  1561. pager: {
  1562. type: 1,
  1563. nextLink: '//a[@class="page-numbers"][@title="下一页"][@href]',
  1564. pageElement: 'css;#content > div[class^="entry_box"]',
  1565. insertPosition: ['css;#content > #pagenavi', 1],
  1566. replaceE: 'css;#content > #pagenavi',
  1567. scrollDelta: 1700
  1568. }
  1569. }, // 老殁 | 殁漂遥 - 搜索页/分类页
  1570. yxssp: {
  1571. SiteTypeID: 0,
  1572. host: 'www.yxssp.com',
  1573. pager: {
  1574. type: 1,
  1575. nextLink: '//div[@class="page-nav td-pb-padding-side"]/a[last()][@href]',
  1576. pageElement: 'css;.td-modules-container.td-module-number4 > div',
  1577. insertPosition: ['css;.td-modules-container.td-module-number4', 3],
  1578. replaceE: 'css;.page-nav.td-pb-padding-side',
  1579. scrollDelta: 1000
  1580. }
  1581. }, // 异星软件空间
  1582. sordum: {
  1583. SiteTypeID: 0,
  1584. host: 'www.sordum.org',
  1585. pager: {
  1586. type: 1,
  1587. nextLink: '//a[@class="next page-numbers"][@href]',
  1588. pageElement: 'css;.article > article',
  1589. insertPosition: ['css;nav.navigation.posts-navigation', 1],
  1590. replaceE: 'css;nav.navigation.posts-navigation',
  1591. scrollDelta: 1500
  1592. }
  1593. },
  1594. winaero: {
  1595. SiteTypeID: 0,
  1596. host: 'winaero.com',
  1597. functionStart: function() {if (location.pathname === '/blog/' || location.pathname.indexOf('/category/') > -1) curSite = DBSite.winaero;},
  1598. pager: {
  1599. type: 1,
  1600. nextLink: 'css;.nav-previous > a',
  1601. pageElement: 'css;#content > article',
  1602. insertPosition: ['css;#nav-below', 1],
  1603. replaceE: 'css;#nav-below',
  1604. scrollDelta: 1500
  1605. }
  1606. },
  1607. lrepacks: {
  1608. SiteTypeID: 0,
  1609. host: 'lrepacks.net',
  1610. functionStart: function() {if (location.pathname.indexOf('.html') === -1) curSite = DBSite.lrepacks;},
  1611. pager: {
  1612. type: 1,
  1613. nextLink: 'css;.page_next > a',
  1614. pageElement: 'css;#main .post-list article',
  1615. insertPosition: ['css;.page_nav', 1],
  1616. replaceE: 'css;.page_nav',
  1617. scrollDelta: 1500
  1618. },
  1619. function: {
  1620. before: lrepacks_functionBefore
  1621. }
  1622. },
  1623. thewindowsclub: {
  1624. SiteTypeID: 0,
  1625. host: 'www.thewindowsclub.com',
  1626. functionStart: function() {curSite = DBSite.thewindowsclub; if (location.pathname === '/') {curSite.pager.scrollDelta = 2000;}},
  1627. pager: {
  1628. type: 1,
  1629. nextLink: 'css;li.pagination-next > a',
  1630. pageElement: 'css;#genesis-content > article',
  1631. insertPosition: ['css;.pagination', 1],
  1632. replaceE: 'css;.pagination',
  1633. scrollDelta: 1500
  1634. }
  1635. },
  1636. cartoonmad: {
  1637. SiteTypeID: 0,
  1638. host: ['www.cartoonmad.com','www.cartoonmad.cc'],
  1639. functionStart: function() {if (location.pathname.indexOf('/comic/') > -1) {
  1640. 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;}';
  1641. document.querySelector('body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child > a').href = 'javascript:void(0);'; // 清理图片上的链接
  1642. curSite = DBSite.cartoonmad;
  1643. }},
  1644. pager: {
  1645. type: 1,
  1646. nextLink: cartoonmad_functionNext,
  1647. pageElement: 'css;body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child img',
  1648. insertPosition: ['css;body > table > tbody > tr:nth-child(4) > td > table > tbody > tr:first-child > td:first-child > a', 3],
  1649. replaceE: 'css;body > table > tbody > tr:nth-child(2), body > table > tbody > tr:nth-child(5)',
  1650. mimeType: 'text/html; charset=big5',
  1651. scrollDelta: 2000
  1652. }
  1653. }, // 动漫狂
  1654. manhuacat: {
  1655. SiteTypeID: 0,
  1656. host: 'www.manhuacat.com',
  1657. functionStart: function() {if (location.pathname.split('/').length === 4) {
  1658. if (getCookie('is_pull') == 'true') { // 强制关闭 [下拉] 模式
  1659. document.cookie='is_pull=false; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; // 写入 Cookie 关闭 [下拉] 模式
  1660. location.reload(); // 刷新网页
  1661. }
  1662. setTimeout(manhuacat_init, 100);
  1663. curSite = DBSite.manhuacat; document.lastElementChild.appendChild(document.createElement('style')).textContent = '#left, #right, #pull-load, .loading, .pagination, footer {display: none !important;} .img-content > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}'; // 隐藏不需要的元素,调整图片
  1664. }},
  1665. pager: {
  1666. type: 4,
  1667. nextLink: manhuacat_functionNext,
  1668. insertPosition: ['css;.img-content', 3],
  1669. insertElement: manhuacat_insertElement,
  1670. replaceE: 'css;.comic-detail > .breadcrumb-bar, .comic-detail >h2.h4, title, .vg-r-data, body > script:not([src])',
  1671. intervals: 2000,
  1672. scrollDelta: 3000
  1673. }
  1674. }, // 漫画猫
  1675. manhuadb: {
  1676. SiteTypeID: 0,
  1677. host: 'www.manhuadb.com',
  1678. functionStart: function() {if (location.pathname.indexOf('/manhua/') > -1 && location.pathname.indexOf('.html') > -1) {
  1679. 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;}';
  1680. document.querySelector('img.img-fluid.show-pic').style.display = 'none'; // 隐藏第一个图片(避免重复)
  1681. setTimeout(manhuadb_init, 100);
  1682. curSite = DBSite.manhuadb;
  1683. }},
  1684. pager: {
  1685. type: 4,
  1686. nextLink: manhuadb_functionNext,
  1687. pageElement: 'css;body > script:not([type]):not([src]), .vg-r-data, ol.links-of-books.num_div',
  1688. insertPosition: ['css;.pjax-container', 3],
  1689. insertElement: manhuadb_insertElement,
  1690. intervals: 5000,
  1691. scrollDelta: 3000
  1692. }
  1693. }, // 漫画 DB
  1694. hicomic: {
  1695. SiteTypeID: 0,
  1696. host: 'www.hicomic.net',
  1697. functionStart: function() {if (location.pathname.indexOf('/chapters/') > -1) {
  1698. 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;}';
  1699. setTimeout(hicomic_init, 100);
  1700. curSite = DBSite.hicomic;
  1701. }},
  1702. pager: {
  1703. type: 4,
  1704. nextLink: hicomic_functionNext,
  1705. insertPosition: ['css;.content', 3],
  1706. insertElement: hicomic_insertElement,
  1707. intervals: 5000,
  1708. scrollDelta: 3000
  1709. }
  1710. }, // 嗨漫画
  1711. dmzj: {
  1712. SiteTypeID: 0,
  1713. host: 'www.dmzj.com',
  1714. functionStart: function() {if (location.pathname.indexOf('/view/') > -1) {
  1715. if (getCookie('display_mode') != '1') { // 强制开启 [上下滚动阅读] 模式
  1716. document.cookie='display_mode=1; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; // 写入 Cookie 开启 [上下滚动阅读] 模式
  1717. location.reload(); // 刷新网页
  1718. }
  1719. setTimeout(dmzj_init, 100);
  1720. curSite = DBSite.dmzj; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'p.mh_curr_page, .btmBtnBox, .float_code, #floatCode {display: none !important;} .comic_wraCon > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}'; // 隐藏中间的页数信息
  1721. }},
  1722. pager: {
  1723. type: 4,
  1724. nextLink: dmzj_functionNext,
  1725. insertPosition: ['css;.comic_wraCon', 3],
  1726. insertElement: dmzj_insertElement,
  1727. replaceE: 'css;.wrap_last_mid, .wrap_last_head, title',
  1728. intervals: 2000,
  1729. scrollDelta: 3000
  1730. }
  1731. }, // 动漫之家 - 原创
  1732. dmzj_manhua: {
  1733. SiteTypeID: 0,
  1734. host: 'manhua.dmzj.com',
  1735. functionStart: function() {if (location.pathname.indexOf('.shtml') > -1) {
  1736. let chapterScroll = document.getElementById('qiehuan_txt') // 强制为 [上下滚动阅读] 模式
  1737. if (chapterScroll && chapterScroll.textContent === '切换到上下滚动阅读') {chapterScroll.click();}
  1738. setTimeout(dmzj_manhua_init, 100);
  1739. curSite = DBSite.dmzj_manhua; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'p.curr_page, .btmBtnBox, .float_code, #floatCode {display: none !important;} #center_box > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}'; // 隐藏中间的页数信息
  1740. }},
  1741. pager: {
  1742. type: 4,
  1743. nextLink: dmzj_manhua_functionNext,
  1744. insertPosition: ['css;#center_box', 3],
  1745. insertElement: dmzj_manhua_insertElement,
  1746. replaceE: 'css;.display_graybg, title',
  1747. intervals: 2000,
  1748. scrollDelta: 3000
  1749. }
  1750. }, // 动漫之家 - 日漫
  1751. copymanga: {
  1752. SiteTypeID: 0,
  1753. host: 'www.copymanga.com',
  1754. functionStart: function() {if (location.pathname.indexOf('/chapter/') > -1) {
  1755. curSite = DBSite.copymanga; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.upMember, .comicContainerAds, .footer {display: none !important;}';
  1756. }},
  1757. pager: {
  1758. type: 4,
  1759. nextLink: copymanga_functionNext,
  1760. insertPosition: ['css;ul.comicContent-image-list > li:first-child', 1],
  1761. insertElement: copymanga_insertElement,
  1762. replaceE: 'css;.disposableData, .disposablePass, .disposableUrlPrefix, .disposableUrlSuffix, .footer, h4.header, title',
  1763. intervals: 5000,
  1764. scrollDelta: 3000
  1765. }
  1766. }, // 拷贝漫画
  1767. gufengmh8: {
  1768. SiteTypeID: 0,
  1769. host: 'www.gufengmh8.com',
  1770. functionStart: function() {if (location.pathname.indexOf('.html') > -1) {
  1771. let chapterScroll = document.getElementById('chapter-scroll') // 强制为 [下拉阅读] 模式
  1772. if (chapterScroll && chapterScroll.className === '') {chapterScroll.click();}
  1773. curSite = DBSite.gufengmh8; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'p.img_info {display: none !important;}'; // 隐藏中间的页数信息
  1774. }},
  1775. pager: {
  1776. type: 4,
  1777. nextLink: gufengmh8_functionNext,
  1778. pageElement: 'css;body > script:first-child',
  1779. insertPosition: ['css;#images', 3],
  1780. insertElement: gufengmh8_insertElement,
  1781. intervals: 5000,
  1782. scrollDelta: 4000
  1783. }
  1784. }, // 古风漫画网
  1785. szcdmj: {
  1786. SiteTypeID: 0,
  1787. host: 'www.szcdmj.com',
  1788. functionStart: function() {if (location.pathname.indexOf('/szcchapter/') > -1) {curSite = DBSite.szcdmj; document.lastElementChild.appendChild(document.createElement('style')).textContent = '.header {opacity: 0.3 !important;}';}},
  1789. pager: {
  1790. type: 1,
  1791. nextLink: '//div[@class="fanye"][1]/a[@href][text()="下一页" or text()="下一话"]',
  1792. pageElement: 'css;.comicpage > div,title',
  1793. insertPosition: ['css;.comicpage', 3],
  1794. replaceE: 'css;.fanye,h1.title',
  1795. scrollDelta: 2000
  1796. },
  1797. function: {
  1798. before: szcdmj_functionBefore
  1799. }
  1800. }, // 砂之船动漫家
  1801. netbian: {
  1802. SiteTypeID: 0,
  1803. host: 'pic.netbian.com',
  1804. functionStart: function() {curSite = DBSite.netbian; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'li.nextpage {display: none !important;}';},
  1805. pager: {
  1806. type: 1,
  1807. nextLink: '//div[@class="page"]/a[contains(text(),"下一页")]',
  1808. pageElement: 'css;.slist ul > li:not(.nextpage)',
  1809. insertPosition: ['css;.slist ul', 3],
  1810. replaceE: 'css;.page',
  1811. mimeType: 'text/html; charset=gbk',
  1812. scrollDelta: 1000
  1813. }
  1814. }, // 彼岸图网
  1815. pubmed: {
  1816. SiteTypeID: 0,
  1817. host: 'pubmed.ncbi.nlm.nih.gov',
  1818. pager: {
  1819. type: 2,
  1820. nextLink: 'button.load-button.next-page',
  1821. nextText: 'Show more',
  1822. scrollDelta: 1500
  1823. }
  1824. }, // 学术
  1825. wikihow: {
  1826. SiteTypeID: 0,
  1827. host: ['www.wikihow.com', 'zh.wikihow.com'],
  1828. functionStart: function() {if (location.pathname.indexOf('/Category:') > -1) {
  1829. curSite = DBSite.wikihow;
  1830. } else if (location.pathname.indexOf('/wikiHowTo') > -1 && location.search.indexOf('?search=') > -1) {
  1831. curSite = DBSite.wikihow_search;
  1832. }},
  1833. pager: {
  1834. type: 1,
  1835. nextLink: 'css;a.pag_next',
  1836. pageElement: 'css;#cat_all > .cat_grid > div',
  1837. insertPosition: ['css;#cat_all > .cat_grid', 3],
  1838. replaceE: 'css;#large_pagination',
  1839. scriptType: 4,
  1840. scrollDelta: 2000
  1841. }
  1842. }, // 指南
  1843. wikihow_search: {
  1844. SiteTypeID: 0,
  1845. pager: {
  1846. type: 1,
  1847. nextLink: 'css;#searchresults_footer > a.buttonright',
  1848. pageElement: 'css;#searchresults_list > a',
  1849. insertPosition: ['css;#searchresults_list', 3],
  1850. replaceE: 'css;#searchresults_footer',
  1851. scrollDelta: 3000
  1852. }
  1853. }, // 指南 - 搜索页
  1854. afreecatv: {
  1855. SiteTypeID: 0,
  1856. host: 'www.afreecatv.com',
  1857. pager: {
  1858. type: 2,
  1859. nextLink: '.btn-more > button',
  1860. intervals: 2000,
  1861. scrollDelta: 1000
  1862. }
  1863. }, // 直播
  1864. greasyfork: {
  1865. SiteTypeID: 0,
  1866. host: 'greasyfork.org',
  1867. functionStart: function() {if (location.pathname.indexOf('/scripts') + 8 === location.pathname.length) {
  1868. curSite = DBSite.greasyfork;
  1869. } else if (location.pathname.lastIndexOf('/feedback') + 9 === location.pathname.length) {
  1870. curSite = DBSite.greasyfork_feedback;
  1871. } else if (location.pathname.lastIndexOf('/discussions') + 12 === location.pathname.length) {
  1872. curSite = DBSite.greasyfork_discussions;
  1873. }},
  1874. pager: {
  1875. type: 1,
  1876. nextLink: '//a[@class="next_page"][@href]',
  1877. pageElement: 'css;ol#browse-script-list > li',
  1878. insertPosition: ['css;ol#browse-script-list', 3],
  1879. replaceE: 'css;.pagination',
  1880. scrollDelta: 1000
  1881. }
  1882. }, // 脚本
  1883. greasyfork_feedback: {
  1884. SiteTypeID: 0,
  1885. pager: {
  1886. type: 1,
  1887. nextLink: '//a[@class="next_page"][@href]',
  1888. pageElement: 'css;.script-discussion-list > div',
  1889. insertPosition: ['css;.script-discussion-list', 3],
  1890. replaceE: 'css;.pagination',
  1891. scrollDelta: 1500
  1892. }
  1893. }, // 脚本 - 反馈页
  1894. greasyfork_discussions: {
  1895. SiteTypeID: 0,
  1896. pager: {
  1897. type: 1,
  1898. nextLink: '//a[@class="next_page"][@href]',
  1899. pageElement: 'css;.discussion-list > div',
  1900. insertPosition: ['css;.discussion-list', 3],
  1901. replaceE: 'css;.pagination',
  1902. scrollDelta: 1000
  1903. }
  1904. }, // 脚本 - 讨论页
  1905. ruyile_xuexiao: {
  1906. SiteTypeID: 0,
  1907. host: 'www.ruyile.com',
  1908. functionStart: function() {
  1909. if (location.pathname === '/xuexiao/') {
  1910. curSite = DBSite.ruyile_xuexiao;
  1911. } else if (location.pathname === '/data/') {
  1912. curSite = DBSite.ruyile_data;
  1913. } else if (location.pathname === '/shijuan/') {
  1914. curSite = DBSite.ruyile_shijuan;
  1915. }},
  1916. pager: {
  1917. type: 1,
  1918. nextLink: '//div[@class="fy"]/a[contains(text(), "下一页")][@href]',
  1919. pageElement: 'css;.xxlb > .sk',
  1920. insertPosition: ['css;.xxlb', 3],
  1921. replaceE: 'css;.fy',
  1922. scrollDelta: 1000
  1923. }
  1924. }, // 如意了教育 - 学校
  1925. ruyile_data: {
  1926. SiteTypeID: 0,
  1927. pager: {
  1928. type: 1,
  1929. nextLink: '//div[@class="fy"]/a[contains(text(), "下一页")][@href]',
  1930. pageElement: 'css;.m1_z > .lbk',
  1931. insertPosition: ['css;.page', 1],
  1932. replaceE: 'css;.fy',
  1933. scrollDelta: 1000
  1934. }
  1935. }, // 如意了教育 - 数据
  1936. ruyile_shijuan: {
  1937. SiteTypeID: 0,
  1938. pager: {
  1939. type: 1,
  1940. nextLink: '//div[@class="fy"]/a[contains(text(), "下一页")][@href]',
  1941. pageElement: 'css;.m1_z > .m2_lb',
  1942. insertPosition: ['css;.page', 1],
  1943. replaceE: 'css;.fy',
  1944. scrollDelta: 1000
  1945. }
  1946. }, // 如意了教育 - 试卷
  1947. kdslife: {
  1948. SiteTypeID: 0,
  1949. host: 'club.kdslife.com',
  1950. pager: {
  1951. type: 1,
  1952. nextLink: '//div[@class="fr i3_r"]/a[@href][contains(text(), "后一页")]',
  1953. pageElement: 'css;ul.main_List > li.i2:not(.h_bg)',
  1954. insertPosition: ['css;ul.main_List > li.i3', 1],
  1955. replaceE: 'css;ul.main_List > li.i3',
  1956. scrollDelta: 1000
  1957. }
  1958. }, // 宽带山论坛
  1959. libaclub: {
  1960. SiteTypeID: 0,
  1961. host: 'www.libaclub.com',
  1962. functionStart: function() {
  1963. if (location.pathname === '/' || location.pathname.indexOf('/date_') > -1) {
  1964. curSite = DBSite.libaclub;
  1965. } else if (location.pathname.indexOf('/f_') > -1) {
  1966. curSite = DBSite.libaclub_f;
  1967. } else if (location.pathname === '/facade.php') {
  1968. curSite = DBSite.libaclub_search;
  1969. }
  1970. document.lastElementChild.appendChild(document.createElement('style')).textContent = 'li.ui-list-merchant-ad, .ui-nav-appImage {display: none !important;}';},
  1971. pager: {
  1972. type: 1,
  1973. nextLink: '//div[@class="ui-crumbs-more"]/a[@class="fn-link"][1]',
  1974. pageElement: 'css;ul.ui-list > li:not(.ui-list-item-head):not(.ui-list-merchant-ad)',
  1975. insertPosition: ['css;ul.ui-list', 3],
  1976. replaceE: 'css;div.ui-crumbs-more',
  1977. scrollDelta: 1000
  1978. }
  1979. }, // 篱笆网论坛
  1980. libaclub_f: {
  1981. SiteTypeID: 0,
  1982. pager: {
  1983. type: 1,
  1984. nextLink: '//div[@class="ui-paging"]/a[@class="ui-paging-next"]',
  1985. pageElement: 'css;ul.ui-list > li:not(.ui-list-item-head):not(.ui-list-merchant-ad)',
  1986. insertPosition: ['css;ul.ui-list', 3],
  1987. replaceE: 'css;div.ui-paging',
  1988. scrollDelta: 1000
  1989. }
  1990. }, // 篱笆网论坛 - 各版块帖子列表
  1991. libaclub_search: {
  1992. SiteTypeID: 0,
  1993. pager: {
  1994. type: 1,
  1995. nextLink: '//div[@class="ui-page"]/a[contains(text(), "下一页")]',
  1996. pageElement: 'css;.ui-box-main > ul.ui-list > li',
  1997. insertPosition: ['css;.ui-box-main > ul.ui-list', 3],
  1998. replaceE: 'css;div.ui-page',
  1999. scrollDelta: 1000
  2000. }
  2001. } // 篱笆网论坛 - 搜索页
  2002. };
  2003. // 生成 SiteTypeID
  2004. generateID();
  2005. // 用于脚本判断(针对部分特殊的网站)
  2006. SiteType = {
  2007. BAIDU_TIEBA: DBSite.baidu_tieba.SiteTypeID,
  2008. GAMERSKY_GL: DBSite.gamersky_gl.SiteTypeID
  2009. };
  2010. }
  2011.  
  2012.  
  2013. if (webType != 1) {
  2014. // < 所有 Discuz!论坛 >
  2015. if (webType === 2) {
  2016. if (location.pathname.indexOf('.html') > -1) { // 判断是不是静态网页(.html 结尾)
  2017. if (location.pathname.indexOf('/forum-') > -1) { // < 各版块帖子列表 >
  2018. if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮
  2019. curSite = DBSite.discuz_forum;
  2020. } else if (document.getElementById('waterfall')) { // 判断是否为图片模式
  2021. curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理
  2022. } else {
  2023. curSite = DBSite.discuz_guide;
  2024. }
  2025. } else if (location.pathname.indexOf('/thread-') > -1) { // < 帖子内 >
  2026. if (GM_getValue('menu_discuz_thread_page')) {
  2027. curSite = DBSite.discuz_thread;
  2028. hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮
  2029. }
  2030. } else if(location.pathname.indexOf('search') > -1) { // < 搜索结果 >
  2031. curSite = DBSite.discuz_search;
  2032. }
  2033. }
  2034. // 如果没有匹配的则继续
  2035. if (curSite.SiteTypeID === 0) {
  2036. if (location.search.indexOf('mod=forumdisplay') > -1 || location.pathname.indexOf('forumdisplay.php') > -1) { // < 各版块帖子列表 >
  2037. if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮
  2038. curSite = DBSite.discuz_forum;
  2039. } else if (document.getElementById('waterfall')) { // 判断是否为图片模式
  2040. curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理
  2041. } else {
  2042. curSite = DBSite.discuz_guide;
  2043. }
  2044. } else if (location.search.indexOf('mod=viewthread') > -1 || location.pathname.indexOf('viewthread.php') > -1) { // < 帖子内 >
  2045. if (GM_getValue('menu_discuz_thread_page')) {
  2046. curSite = DBSite.discuz_thread;
  2047. hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮
  2048. }
  2049. } else if (location.search.indexOf('mod=guide') > -1) { // < 导读帖子列表 >
  2050. curSite = DBSite.discuz_guide;
  2051. } else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复
  2052. curSite = DBSite.discuz_youspace;
  2053. } else if (location.search.indexOf('mod=collection') > -1) { // < 淘贴列表 >
  2054. curSite = DBSite.discuz_collection;
  2055. } else if (location.pathname.indexOf('search') > -1) { // < 搜索结果 >
  2056. curSite = DBSite.discuz_search;
  2057. } else if (document.getElementById('threadlist')) { // < 部分论坛的各板块 URL 是自定义的 >
  2058. curSite = DBSite.discuz_forum;
  2059. } else if (document.getElementById('postlist')) { // < 部分论坛的帖子内 URL 是自定义的 >
  2060. if (GM_getValue('menu_discuz_thread_page')) {
  2061. curSite = DBSite.discuz_thread;
  2062. hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮
  2063. }
  2064. }
  2065. }
  2066. // < 所有 Flarum 论坛 >
  2067. } else if (webType === 3) {
  2068. curSite = DBSite.flarum;
  2069. // < 所有使用 WordPress DUX 主题的网站 >
  2070. } else if (webType === 4) {
  2071. if (location.pathname.indexOf('.html') === -1) curSite = DBSite.dux;
  2072. if (location.host === 'apphot.cc') curSite.pager.scrollDelta = 2500; // 对于速度慢的网站,需要增加翻页敏感度
  2073. }
  2074. }
  2075.  
  2076. if (GM_getValue('menu_page_number')) {pageNumber('add');} else {pageNumber('set');} // 显示页码
  2077. pausePageEvent(); // 左键双击网页空白处暂停翻页
  2078. curSite.pageUrl = ''; // 下一页URL
  2079. //console.log(curSite);
  2080. pageLoading(); // 自动无缝翻页
  2081.  
  2082.  
  2083. // [Discuz! 论坛] 隐藏帖子内的 [下一页] 按钮
  2084. function hidePgbtn() {
  2085. document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}';
  2086. }
  2087. // [Discuz! 论坛] 图片模式列表样式预处理
  2088. function waterfallStyle() {
  2089. let width = document.querySelector('#waterfall > li:first-child').style.width;
  2090. document.lastChild.appendChild(document.createElement('style')).textContent = `#waterfall {height: auto !important; width: 100% !important;} #waterfall > li {width: ${width} !important; float: left !important; position: inherit !important; left: auto !important; top: auto !important;}`;
  2091. }
  2092. // [Discuz! 论坛] 的插入前函数(加载图片,仅部分论坛)
  2093. function discuz_thread_functionBefore(pageElems) {
  2094. if (location.hostname === 'bbs.pcbeta.com') { // 仅部分论坛需要处理
  2095. pageElems.forEach(function (one) {
  2096. one.querySelectorAll('img[file]').forEach(function (now) {
  2097. now.src = now.getAttribute('file');
  2098. });
  2099. });
  2100. }
  2101. return pageElems
  2102. }
  2103.  
  2104.  
  2105. // 通用型插入前函数(加载图片 data-original => src)
  2106. function src_original_functionBefore(pageElems) {
  2107. pageElems.forEach(function (one) {
  2108. let now = one.querySelector('img[data-original]')
  2109. if (now) {
  2110. now.src = now.dataset.original;
  2111. }
  2112. });
  2113. return pageElems
  2114. }
  2115.  
  2116.  
  2117. // [DUX] 的插入前函数(加载图片)
  2118. function dux_functionBefore(pageElems) {
  2119. pageElems.forEach(function (one) {
  2120. let now = one.querySelector('img.thumb[data-src]')
  2121. if (now) {now.src = now.dataset.src;}
  2122. });
  2123. return pageElems
  2124. }
  2125.  
  2126.  
  2127. // [头条搜索] 的插入前函数(过滤相关搜索)
  2128. function toutiao_functionBefore(pageElems) {
  2129. for (let i = 0; i < pageElems.length; i++) {
  2130. let now = pageElems[i].querySelector('div[class*="-header"]')
  2131. if (now && now.textContent === '相关搜索') {
  2132. pageElems.splice(i,1)
  2133. }
  2134. }
  2135. return pageElems
  2136. }
  2137.  
  2138.  
  2139. // [360搜索] 的插入前函数(加载图片)
  2140. function so_functionBefore(pageElems) {
  2141. pageElems.forEach(function (one) {
  2142. one.querySelectorAll('img[data-isrc]').forEach(function (now) {
  2143. now.src = now.dataset.isrc;
  2144. now.className = now.className.replace('so-lazyimg','');
  2145. });
  2146. });
  2147. return pageElems
  2148. }
  2149.  
  2150.  
  2151. // [百度贴吧](发帖按钮点击事件)
  2152. function baidu_tieba_1() {
  2153. let button = document.querySelector('.tbui_aside_fbar_button.tbui_fbar_post > a');
  2154. if (button) {
  2155. button.remove();
  2156. 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>')
  2157. button = document.querySelector('.tbui_aside_fbar_button.tbui_fbar_post > a');
  2158. if (button) {
  2159. button.onclick = function(){
  2160. let button2 = document.querySelector('div.edui-btn.edui-btn-fullscreen.edui-btn-name-portrait');
  2161. if (button2) {
  2162. button2.click();
  2163. } else {
  2164. alert('提示:登录后才能发帖!');
  2165. }
  2166. return false;
  2167. }
  2168. }
  2169. }
  2170. }
  2171. // [百度贴吧] 的插入前函数(加载图片)
  2172. function baidu_tieba_functionBefore(pageElems) {
  2173. pageElems.forEach(function (one) {
  2174. one.querySelectorAll('img.threadlist_pic[data-original]').forEach(function (now) {
  2175. now.src = now.dataset.original;
  2176. now.style.display = 'inline';
  2177. })
  2178. });
  2179. return pageElems
  2180. }
  2181. // [百度贴吧] 获取下一页地址
  2182. function baidu_tieba_functionNext() {
  2183. let next = document.querySelector('a.next.pagination-item[href]');
  2184. if (next != null && next.nodeType === 1 && next.href && next.href.slice(0,4) === 'http') {
  2185. var url = next.href + '&pagelets=frs-list%2Fpagelet%2Fthread&pagelets_stamp=' + new Date().getTime();
  2186. if (url === curSite.pageUrl) return
  2187. curSite.pageUrl = url;
  2188. getPageElems(curSite.pageUrl);
  2189. };
  2190. }
  2191. // [百度贴吧] 插入数据
  2192. function baidu_tieba_insertElement(newBody, type) {
  2193. if (!newBody) return
  2194. let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody),
  2195. toElement = getAllElements(curSite.pager.insertPosition[0])[0];
  2196. if (pageElems.length >= 0) {
  2197. // 执行插入前函数
  2198. pageElems = curSite.function.before(pageElems);
  2199. // 插入位置
  2200. let addTo1 = addTo(curSite.pager.insertPosition[1]);
  2201. // 获取 <script> 内容
  2202. const scriptElems = getAllElements('//script', newBody, newBody);
  2203. let scriptText = '';
  2204. for (let i = 0; i < scriptElems.length; i++) {
  2205. if (scriptElems[i].textContent.indexOf('Bigpipe.register("frs-list/pagelet/thread_list"') > -1) {
  2206. scriptText = scriptElems[i].textContent.replace('Bigpipe.register("frs-list/pagelet/thread_list", ','');
  2207. break
  2208. }
  2209. }
  2210. if (scriptText) {
  2211. scriptText = scriptText.slice(0, scriptText.indexOf(').')) // 获取主体内容
  2212. let scriptJSON = JSON.parse(scriptText).content; // 字符串转 JSON
  2213. var temp_baidu_tieba = document.createElement('div'); temp_baidu_tieba.innerHTML = scriptJSON; // 字符串转 Element 元素
  2214. pageElems = curSite.function.before(getAllElements(curSite.pager.pageElement, temp_baidu_tieba, temp_baidu_tieba)); // 插入前执行函数
  2215. pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);}); // 插入元素
  2216. // 当前页码 + 1
  2217. pageNum.now = pageNum._now + 1
  2218. // 替换元素
  2219. let oriE = document.querySelectorAll(curSite.pager.pageElement.replace('css;', '')),
  2220. repE = getAllElements(curSite.pager.replaceE, temp_baidu_tieba, temp_baidu_tieba);
  2221. if (oriE.length === repE.length) {
  2222. for (let i = 0; i < oriE.length; i++) {
  2223. oriE[i].outerHTML = repE[i].outerHTML;
  2224. }
  2225. }
  2226. }
  2227. }
  2228. }
  2229.  
  2230.  
  2231. // [NGA(玩家社区)] 的插入后函数(加载各版块帖子列表样式)
  2232. function nga_thread_functionAfter() {
  2233. document.body.appendChild(document.createElement('script')).textContent = 'commonui.topicArg.loadAll();';
  2234. }
  2235.  
  2236. // [V2EX] 的插入后函数(新标签页打开链接)
  2237. function v2ex_functionAfter(css) {
  2238. let links = document.querySelectorAll(css);if (!links) return
  2239. links.forEach(function (_this) {_this.target = '_blank';});
  2240. }
  2241.  
  2242. // [龙的天空] 获取下一页地址
  2243. function lkong_functionNext() {
  2244. let next = document.querySelector('li.ant-pagination-next'), page;
  2245. if (next && next.getAttribute('aria-disabled') === 'false') {
  2246. page = document.querySelector('li.ant-pagination-item-active[title]');
  2247. if (page && page.title) {
  2248. if (curSite.pager.intervals) {
  2249. let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0;
  2250. setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals)
  2251. }
  2252. return (location.origin + location.pathname + '?page=' + ++page.title);
  2253. }
  2254. }
  2255. return '';
  2256. }
  2257.  
  2258. // [千图网] 的插入前函数(加载图片)
  2259. function _58pic_functionBefore(pageElems) {
  2260. let is_one = document.querySelector('.qtw-card.place-box.is-one');
  2261. if (is_one && is_one.style.display != 'none') {is_one.style.display = 'none';}
  2262. pageElems.forEach(function (one) {
  2263. let now = one.querySelector('img.lazy')
  2264. if (now && now.getAttribute('src') != now.dataset.original) {
  2265. now.src = now.dataset.original;
  2266. now.style.display = 'block';
  2267. }
  2268. });
  2269. return pageElems
  2270. }
  2271.  
  2272.  
  2273. // [Pixabay] 的插入前函数(加载图片)
  2274. function pixabay_functionBefore(pageElems) {
  2275. pageElems.forEach(function (one) {
  2276. let now = one.querySelector('img[data-lazy-src]')
  2277. if (now) {
  2278. now.src = now.dataset.lazySrc;
  2279. now.removeAttribute('data-lazy-src')
  2280. now.removeAttribute('data-lazy-srcset')
  2281. }
  2282. });
  2283. return pageElems
  2284. }
  2285.  
  2286.  
  2287. // [游民星空-攻略] 的插入前函数(移除下一页底部的 "更多相关内容请关注:xxx" 文字)
  2288. function gamersky_gl_functionBefore(pageElems) {
  2289. pageElems.forEach(function (one) {
  2290. if (one.tagName === 'P' && one.textContent.indexOf('更多相关内容请关注') > -1) {one.style.display = 'none';}
  2291. });
  2292. return pageElems
  2293. }
  2294.  
  2295.  
  2296. // [NexusMods] 获取下一页地址
  2297. function nexusmods_functionNext() {
  2298. if (document.querySelector('.nexus-ui-blocker')) return
  2299. let out_items = JSON.stringify(RH_ModList.out_items).replace(/{|}|"/g,''),
  2300. nextNum = getElementByXpath('id("mod-list")/div[contains(@class, "pagenav")][1]//a[contains(@class, "page-selected")]/parent::li/following-sibling::li/a'),
  2301. categories = RH_ModList.out_items.categories, categoriesUrl = '';
  2302. var url = '';
  2303. if (nextNum && nextNum.innerText) {
  2304. nextNum = nextNum.innerText;
  2305. if (out_items.indexOf('page:') > -1) {
  2306. out_items = out_items.replace(/page:\d+/, `page:${nextNum}`)
  2307. } else {
  2308. out_items += `,page:${nextNum}`;
  2309. }
  2310. if (categories && categories != []) {
  2311. for (let i = 0; i < categories.length; i++) {
  2312. categoriesUrl += `,categories[]:${categories[i]}`
  2313. }
  2314. categoriesUrl = categoriesUrl.replace(/,/,'');
  2315. if (out_items.indexOf('categories:') > -1) {
  2316. out_items = out_items.replace(/categories:\[.*\]/, categoriesUrl)
  2317. }
  2318. }
  2319. url = 'https://www.nexusmods.com' + RH_ModList.uri + '?RH_ModList=' + out_items
  2320. //console.log(nextNum, url, curSite.pageUrl, out_items)
  2321. if (url === curSite.pageUrl) return
  2322. curSite.pageUrl = url;
  2323. //console.log(nextNum, curSite.pageUrl, out_items)
  2324. getPageElems(curSite.pageUrl)
  2325. }
  2326. }
  2327. // [NexusMods] 插入数据
  2328. function nexusmods_insertElement(newBody, type) {
  2329. if (!newBody) return
  2330. let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody), // 主体元素
  2331. toElement = getAllElements(curSite.pager.insertPosition[0])[0], // 插入位置的元素
  2332. addTo1 = addTo(curSite.pager.insertPosition[1]); // 插入位置
  2333. // 添加下载数据
  2334. pageElems.forEach(function (one) {
  2335. let now = one.querySelector('.mod-tile-left');
  2336. if (now) {
  2337. let downloadCount = now.querySelector('.downloadcount > span.flex-label');
  2338. if (downloadCount) {
  2339. downloadCount.textContent = shortFormat(parseInt(GlobalModStats[now.dataset.gameId][now.dataset.modId].total));
  2340. }
  2341. }
  2342. });
  2343. // 插入网页
  2344. pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);});
  2345. // 当前页码 + 1
  2346. pageNum.now = pageNum._now + 1
  2347. // 替换元素
  2348. let oriE = document.querySelectorAll(curSite.pager.replaceE.replace('css;', '')),
  2349. repE = getAllElements(curSite.pager.replaceE, newBody, newBody);
  2350. if (oriE.length === repE.length) {
  2351. for (let i = 0; i < oriE.length; i++) {
  2352. oriE[i].outerHTML = repE[i].outerHTML;
  2353. }
  2354. }
  2355. }
  2356.  
  2357.  
  2358. // [cs_rin_ru] 各版块帖子列表的插入前函数(过滤置顶帖子)
  2359. function cs_rin_ru_functionBefore(pageElems) {
  2360. for (let i = 0; i < pageElems.length; i++) {
  2361. if (pageElems[i].textContent.replace(/\n| /g,'') === 'Topics') {
  2362. pageElems.splice(0,i+1);
  2363. break;
  2364. }
  2365. }
  2366. return pageElems
  2367. }
  2368.  
  2369.  
  2370. // [片库] 的插入前函数(加载图片)
  2371. function mypianku_functionBefore(pageElems) {
  2372. pageElems.forEach(function (one) {
  2373. let now = one.querySelector('img')
  2374. if (now) {
  2375. now.src = now.dataset.src;
  2376. }
  2377. });
  2378. return pageElems
  2379. }
  2380.  
  2381.  
  2382. // [奈菲影视/真不卡影院] 的插入前函数(加载图片)
  2383. function nfmovies_functionBefore(pageElems) {
  2384. pageElems.forEach(function (one) {
  2385. let now = one.querySelector('a.lazyload')
  2386. if (now) {
  2387. now.style.backgroundImage = 'url("' + now.dataset.original + '")';
  2388. }
  2389. });
  2390. return pageElems
  2391. }
  2392.  
  2393.  
  2394. // [不死鸟] 的插入前函数(加载图片)
  2395. function iao_su_functionBefore(pageElems) {
  2396. pageElems.forEach(function (one) {
  2397. let now = one.getElementsByClassName('post-card')[0]
  2398. if (now) {
  2399. now.getElementsByClassName('blog-background')[0].style.backgroundImage = 'url("' + now.getElementsByTagName('script')[0].textContent.split("'")[1] + '")';
  2400. //now.getElementsByClassName('blog-background')[0].style.backgroundImage = 'url("' + RegExp("(?<=loadBannerDirect\\(').*(?=', '',)").exec(now.getElementsByTagName('script')[0].textContent)[0]; + '")';
  2401. }
  2402. });
  2403. return pageElems
  2404. }
  2405.  
  2406.  
  2407. // [异次元软件世界] 的插入前函数(加载图片)
  2408. function iplaysoft_postslist_functionBefore(pageElems) {
  2409. pageElems.forEach(function (one) {
  2410. let now = one.querySelector('img.lazyload')
  2411. if (now && !now.src) {
  2412. now.src = now.dataset.src;
  2413. now.setAttribute('srcset', now.dataset.src)
  2414. now.setAttribute('class', 'lazyloaded')
  2415. }
  2416. });
  2417. return pageElems
  2418. }
  2419.  
  2420.  
  2421. // [LRepacks] 的插入前函数(调整 class)
  2422. function lrepacks_functionBefore(pageElems) {
  2423. pageElems.forEach(function (one) {
  2424. let now = one.querySelector('.slideUp, .elementFade')
  2425. if (now) {
  2426. now.className = now.className.replace('slideUp','slideUpRun').replace('elementFade','elementFadeRun');
  2427. }
  2428. });
  2429. return pageElems
  2430. }
  2431.  
  2432.  
  2433. // [漫画狂] 获取下一页地址
  2434. function cartoonmad_functionNext() {
  2435. let nextXPAHT = '//a[@class="pages"][contains(text(),"下一頁")]',
  2436. nextPXPATH = '//a[@class="pages"][contains(string(),"下一話")]'
  2437. let url = getElementByXpath(nextXPAHT);
  2438. if (url) {
  2439. if (url.getAttribute('href') === 'thend.asp') {
  2440. url = getElementByXpath(nextPXPATH)
  2441. if (url) return url.href;
  2442. pausePage = false;
  2443. GM_notification({text: `注意:该网站早期漫画(如海贼王、柯南)因为网站自身问题而无法翻至下一话(仅限于显示为 [第 X 卷]/[下一卷] 的)。\n因此需要手动去 [目录页] 进入下一卷!`, timeout: 10000});
  2444. } else {
  2445. return url.href;
  2446. }
  2447. }
  2448. return '';
  2449. }
  2450.  
  2451.  
  2452. // [漫画猫] 初始化(显示本话所以图片)
  2453. function manhuacat_init() {
  2454. let _img = '';
  2455. for (let now of img_data_arr) {
  2456. _img += `<img src="${asset_domain}${img_pre}${now}">`;
  2457. }
  2458. document.querySelector('.img-content > img').remove();
  2459. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2460.  
  2461. }
  2462. // [漫画猫] 获取下一页地址
  2463. function manhuacat_functionNext(pageElems, type) {
  2464. if (type === 'url') {
  2465. if(pageElems.code == '0000') {
  2466. if (pageElems.url === curSite.pageUrl) return
  2467. curSite.pageUrl = pageElems.url;
  2468. getPageElems(curSite.pageUrl); // 真正的下一页链接
  2469. }
  2470. } else {
  2471. let vg_r_data = document.querySelector('.vg-r-data');
  2472. if (vg_r_data) {
  2473. getPageElems(`https://${location.host}/chapter_num?chapter_id=${vg_r_data.dataset.chapter_num}&ctype=1&type=${vg_r_data.dataset.chapterType};`, 'json', 'GET', '', 'url');
  2474. }
  2475. }
  2476. }
  2477. // [漫画猫] 插入数据
  2478. function manhuacat_insertElement(pageElems, type) {
  2479. if (!pageElems) return
  2480. if (type === 'url') { // 获取下一页链接
  2481. manhuacat_functionNext(pageElems, type); return
  2482. }
  2483.  
  2484. // 添加历史记录
  2485. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
  2486.  
  2487. // 替换元素
  2488. let oriE = document.querySelectorAll(curSite.pager.replaceE.replace('css;', '')),
  2489. repE = getAllElements(curSite.pager.replaceE, pageElems, pageElems);
  2490. if (oriE.length === repE.length) {
  2491. for (let i = 0; i < oriE.length; i++) {
  2492. oriE[i].outerHTML = repE[i].outerHTML;
  2493. }
  2494. }
  2495.  
  2496. // 插入图片
  2497. let _img = '', _img_arr = LZString.decompressFromBase64(getElementByXpath('//body/script[not(@src)][contains(text(), "img_data")]').textContent.split('"')[1]).split(','), vg_r_data = document.querySelector('.vg-r-data');;
  2498. for (let now of _img_arr) {
  2499. _img += `<img src="${vg_r_data.dataset.chapterDomain}${img_pre}${now}">`;
  2500. }
  2501. if (_img) {
  2502. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2503. // 当前页码 + 1
  2504. pageNum.now = pageNum._now + 1
  2505. }
  2506. }
  2507.  
  2508.  
  2509. // [漫画DB] 初始化(将本话其余图片插入网页中)
  2510. function manhuadb_init() {
  2511. let _img = '',
  2512. data = document.querySelector('.vg-r-data'), imgDate;
  2513. if (!data) return
  2514. document.querySelectorAll(curSite.pager.pageElement.replace('css;', '')).forEach(function (one) {
  2515. if (one.tagName === 'SCRIPT' && one.textContent.indexOf('var img_data =') > -1) {
  2516. let json = JSON.parse(window.atob(one.textContent.split("'")[1]));
  2517. if (json) {
  2518. let _img = '';
  2519. for (let i = 0; i < json.length; i++) { // 遍历图片文件名数组,组合为 img 标签
  2520. let src = data.dataset.host + data.dataset.img_pre + json[i].img;
  2521. _img += `<img class="img-fluid show-pic" src="${src}">`
  2522. }
  2523. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2524. }
  2525. }
  2526. })
  2527. }
  2528. // [漫画DB] 获取下一页地址
  2529. function manhuadb_functionNext() {
  2530. let nextArr = document.querySelectorAll('a.fixed-a-es'), next;
  2531. var url = '';
  2532. if (nextArr.length == 0) return
  2533. for (let i = 0; i < nextArr.length; i++) {
  2534. if (nextArr[i].className.indexOf('active') > -1) {
  2535. if (nextArr[i+1]) url = nextArr[i+1].href;
  2536. break;
  2537. }
  2538. }
  2539. if (url === curSite.pageUrl) return
  2540. curSite.pageUrl = url
  2541. getPageElems(curSite.pageUrl);
  2542. }
  2543. // [漫画DB] 插入数据
  2544. function manhuadb_insertElement(pageElems, type) {
  2545. if (!pageElems) return
  2546. let oriE = document.querySelectorAll(curSite.pager.pageElement.replace('css;', '')),
  2547. repE = getAllElements(curSite.pager.pageElement, pageElems, pageElems);
  2548. if (oriE.length === repE.length) {
  2549. for (let i = 0; i < oriE.length; i++) {
  2550. oriE[i].outerHTML = repE[i].outerHTML;
  2551. }
  2552. // 当前页码 + 1
  2553. pageNum.now = pageNum._now + 1
  2554. manhuadb_init(); // 将刚刚替换的图片插入网页中
  2555. }
  2556. }
  2557.  
  2558.  
  2559. // [HiComic(嗨漫画)] 初始化(将本话其余图片插入网页中)
  2560. function hicomic_init() {
  2561. let _img = '';
  2562. document.querySelectorAll('.chapter > section:not(:first-child) > section[val]').forEach(function (one) {
  2563. let src = one.getAttribute('val');
  2564. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h'
  2565. _img += `<img src="${src}">`
  2566. })
  2567. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2568. window.document.title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${document.querySelector('.chapter_name').textContent}) - HiComic`); // 修改网页标题(加上 第 X 话)
  2569. }
  2570. // [HiComic(嗨漫画)] 获取下一页地址
  2571. function hicomic_functionNext() {
  2572. let nextId;
  2573. nextId = document.querySelector('.next_chapter:not(.end)')
  2574. if (nextId && nextId.id && nextId.id != 'None') {
  2575. curSite.pageUrl = location.href;
  2576. getPageElems(`https://www.hicomic.net/api/web/chapter/${nextId.id}/contents`, 'json');
  2577. }
  2578. }
  2579. // [HiComic(嗨漫画)] 插入数据
  2580. function hicomic_insertElement(pageElems, type) {
  2581. if (!pageElems || pageElems.code != 200) return
  2582. if (pageElems.results.chapter.next) { // 写入下一页的 UUID
  2583. document.querySelector('.next_chapter').id = pageElems.results.chapter.next;
  2584. } else {
  2585. document.querySelector('.next_chapter').id = 'None';
  2586. document.querySelector('.next_chapter').classList.add('end');
  2587. }
  2588. document.querySelector('.chapter_name').textContent = pageElems.results.chapter.name; // 修改漫画标题
  2589. let title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${pageElems.results.chapter.name}) - HiComic`)
  2590. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, curSite.pageUrl); // 添加历史记录
  2591. window.document.title = title; // 修改当前网页标题为下一话的标题
  2592. let _img = '';
  2593. for (let i = 0; i < pageElems.results.chapter.contents.length; i++) { // 遍历图片文件名数组,组合为 img 标签
  2594. let src = pageElems.results.chapter.contents[i].url;
  2595. if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h';
  2596. _img += `<img src="${src}">`
  2597. }
  2598. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2599. // 当前页码 + 1
  2600. pageNum.now = pageNum._now + 1
  2601. }
  2602.  
  2603.  
  2604. // [动漫之家] 初始化(调整本话其余图片)
  2605. function dmzj_init() {
  2606. let _img = '';
  2607. document.querySelectorAll('.comic_wraCon > a > img').forEach(function (one) {
  2608. _img += `<img src="${one.dataset.original}">`;
  2609. one.parentElement.remove();
  2610. })
  2611. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2612.  
  2613. }
  2614. // [动漫之家] 获取下一页地址
  2615. function dmzj_functionNext() {
  2616. let next;
  2617. next = document.querySelector('span.next > a[href]')
  2618. if (next) {
  2619. if (next.href === curSite.pageUrl) return
  2620. curSite.pageUrl = next.href;
  2621. getPageElems(curSite.pageUrl);
  2622. }
  2623. }
  2624. // [动漫之家] 插入数据
  2625. function dmzj_insertElement(pageElems, type) {
  2626. if (!pageElems) return
  2627. // 插入并运行 <script>
  2628. let scriptElement = pageElems.querySelectorAll('head > script[type]:not([src])'), scriptText = '';
  2629. scriptElement.forEach(function (one) {scriptText += ';' + one.textContent;});
  2630. if (scriptText) document.body.appendChild(document.createElement('script')).textContent = scriptText;
  2631.  
  2632. // 插入图片
  2633. let _img = '', _img_arr;
  2634. if (pages.indexOf('|') === -1) {
  2635. _img_arr = JSON.parse(pages.replace(/\r\n/g,'|')).page_url.split('|');
  2636. } else {
  2637. _img_arr = JSON.parse(pages).page_url.split('|');
  2638. }
  2639. for (let now of _img_arr) {
  2640. _img += `<img src="${img_prefix}${now}">`;
  2641. }
  2642. if (_img) {
  2643. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2644.  
  2645. // 添加历史记录
  2646. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
  2647.  
  2648. // 替换元素
  2649. let oriE = document.querySelectorAll(curSite.pager.replaceE.replace('css;', '')),
  2650. repE = getAllElements(curSite.pager.replaceE, pageElems, pageElems);
  2651. if (oriE.length === repE.length) {
  2652. for (let i = 0; i < oriE.length; i++) {
  2653. oriE[i].outerHTML = repE[i].outerHTML;
  2654. }
  2655. // 当前页码 + 1
  2656. pageNum.now = pageNum._now + 1
  2657. }
  2658. }
  2659. }
  2660.  
  2661.  
  2662. // [动漫之家-漫画] 初始化(调整本话其余图片)
  2663. function dmzj_manhua_init() {
  2664. let _img = '';
  2665. document.querySelectorAll('#center_box > .inner_img img[src]').forEach(function (one) {
  2666. _img += `<img src="${one.dataset.original}">`;
  2667. one.parentElement.parentElement.remove();
  2668. })
  2669. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2670.  
  2671. }
  2672. // [动漫之家-漫画] 获取下一页地址
  2673. function dmzj_manhua_functionNext() {
  2674. let next;
  2675. next = document.getElementById('next_chapter')
  2676. if (next) {
  2677. if (next.href === curSite.pageUrl) return
  2678. curSite.pageUrl = next.href;
  2679. getPageElems(curSite.pageUrl);
  2680. }
  2681. }
  2682. // [动漫之家-漫画] 插入数据
  2683. function dmzj_manhua_insertElement(pageElems, type) {
  2684. if (!pageElems) return
  2685. // 插入并运行 <script>
  2686. let scriptElement = pageElems.querySelectorAll('head > script[type]:not([src])'), scriptText = '';
  2687. scriptElement.forEach(function (one) {scriptText += ';' + one.textContent;});
  2688. if (scriptText) document.body.appendChild(document.createElement('script')).textContent = scriptText;
  2689.  
  2690. // 插入图片
  2691. let _img = '';
  2692. for (let now of arr_pages) {
  2693. _img += `<img src="${img_prefix}${now}">`;
  2694. }
  2695. if (_img) {
  2696. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2697.  
  2698. // 添加历史记录
  2699. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
  2700.  
  2701. // 替换元素
  2702. let oriE = document.querySelectorAll(curSite.pager.replaceE.replace('css;', '')),
  2703. repE = getAllElements(curSite.pager.replaceE, pageElems, pageElems);
  2704. if (oriE.length === repE.length) {
  2705. for (let i = 0; i < oriE.length; i++) {
  2706. oriE[i].outerHTML = repE[i].outerHTML;
  2707. }
  2708. // 当前页码 + 1
  2709. pageNum.now = pageNum._now + 1
  2710. }
  2711. }
  2712. }
  2713.  
  2714.  
  2715. // [拷贝漫画] 获取下一页地址
  2716. function copymanga_functionNext() {
  2717. let next;
  2718. next = document.querySelector('.comicContent-next > a[href]')
  2719. if (next) {
  2720. if (next.href === curSite.pageUrl) return
  2721. curSite.pageUrl = next.href;
  2722. getPageElems(curSite.pageUrl);
  2723. }
  2724. }
  2725. // [拷贝漫画] 插入数据
  2726. function copymanga_insertElement(pageElems, type) {
  2727. if (!pageElems) return
  2728. // 添加历史记录
  2729. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
  2730. let oldImg = document.querySelector('.comicContent-image-list').innerHTML;
  2731.  
  2732. // 替换元素
  2733. let oriE = document.querySelectorAll(curSite.pager.replaceE.replace('css;', '')),
  2734. repE = getAllElements(curSite.pager.replaceE, pageElems, pageElems);
  2735. if (oriE.length === repE.length) {
  2736. for (let i = 0; i < oriE.length; i++) {
  2737. oriE[i].outerHTML = repE[i].outerHTML;
  2738. }
  2739. // 插入并运行 <script>
  2740. document.body.appendChild(document.createElement('script')).src = document.querySelector('body > script[async][src*="comic_content_pass"]').src;
  2741. setTimeout(function(){
  2742. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), oldImg); // 将 img 标签插入到网页中
  2743. }, 100);
  2744. // 当前页码 + 1
  2745. pageNum.now = pageNum._now + 1
  2746. }
  2747. }
  2748.  
  2749.  
  2750. // [古风漫画网] 获取下一页地址
  2751. function gufengmh8_functionNext() {
  2752. let pageElems = document.querySelector(curSite.pager.pageElement.replace('css;', '')); // 寻找数据所在元素
  2753. if (pageElems) {
  2754. let comicUrl, nextId;
  2755. var url = '';
  2756. pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历
  2757. //console.log(one)
  2758. if (one.indexOf('comicUrl') > -1) { // 下一页 URL 前半部分
  2759. comicUrl = one.split('"')[1];
  2760. } else if (one.indexOf('nextChapterData') > -1) { // 下一页 URL 的后半部分 ID
  2761. nextId = one.split('"id":')[1].split(',')[0];
  2762. }
  2763. })
  2764. if (comicUrl && nextId && nextId != 'null') { // 组合到一起就是下一页 URL
  2765. url = comicUrl + nextId + '.html'
  2766. if (url === curSite.pageUrl) return
  2767. curSite.pageUrl = url
  2768. getPageElems(curSite.pageUrl); // 访问下一页 URL 获取
  2769. }
  2770. }
  2771. }
  2772. // [古风漫画网] 插入数据
  2773. function gufengmh8_insertElement(pageElems, type) {
  2774. if (pageElems) {
  2775. let url = curSite.pageUrl;
  2776. pageElems = getAllElements(curSite.pager.pageElement, pageElems, pageElems)[0];
  2777. let chapterImages, chapterPath;
  2778. document.querySelector(curSite.pager.pageElement.replace('css;', '')).innerText = pageElems.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL
  2779. pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历
  2780. //console.log(one)
  2781. if (one.indexOf('chapterImages') > -1) { // 图片文件名数组
  2782. chapterImages = one.replace(/^.+\[/, '').replace(']', '').replaceAll('"', '').split(',')
  2783. } else if (one.indexOf('chapterPath') > -1) { // 图片文件路径
  2784. chapterPath = one.split('"')[1];
  2785. } else if (one.indexOf('pageTitle') > -1) { // 网页标题
  2786. let title = one.split('"')[1];
  2787. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, url); // 添加历史记录
  2788. window.document.title = title; // 修改当前网页标题为下一页的标题
  2789. }
  2790. })
  2791. if (chapterImages && chapterPath) {
  2792. let _img = '';
  2793. chapterImages.forEach(function (one2){ // 遍历图片文件名数组,组合为 img 标签
  2794. _img += '<img src="https://res.xiaoqinre.com/' + chapterPath + one2 + '" data-index="0" style="display: inline-block;">'
  2795. })
  2796. document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中
  2797. // 当前页码 + 1
  2798. pageNum.now = pageNum._now + 1
  2799. }
  2800. }
  2801. }
  2802.  
  2803.  
  2804. // [砂之船动漫家] 的插入前函数(加载图片)
  2805. function szcdmj_functionBefore(pageElems) {
  2806. pageElems.forEach(function (one) {
  2807. if (one.tagName === 'TITLE') {
  2808. let title = one.textContent;
  2809. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, curSite.pageUrl); // 添加历史记录
  2810. window.document.title = title; // 修改当前网页标题为下一页的标题
  2811. one.style.display = 'none';
  2812. } else {
  2813. let now = one.querySelector('img[data-original]')
  2814. if (now) {
  2815. now.src = now.dataset.original;
  2816. now.style.display = 'inline';
  2817. }
  2818. }
  2819. });
  2820. return pageElems
  2821. }
  2822.  
  2823.  
  2824. // 自动无缝翻页
  2825. function pageLoading() {
  2826. if (curSite.SiteTypeID > 0) {
  2827. windowScroll(function (direction, e) {
  2828. if (direction === 'down' && pausePage === true) { // 下滑/没有暂停翻页时,才准备翻页
  2829. let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
  2830. scrollHeight = window.innerHeight || document.documentElement.clientHeight,
  2831. scrollDelta = curSite.pager.scrollDelta;
  2832. if (curSite.pager.type === 3) { // <<<<< 翻页类型 3(依靠元素距离可视区域底部的距离来触发翻页)>>>>>
  2833. let scrollElement = document.querySelector(curSite.pager.scrollElement);
  2834. //console.log(scrollElement.offsetTop - (scrollTop + scrollHeight), scrollDelta, curSite.SiteTypeID)
  2835. if (scrollElement.offsetTop - (scrollTop + scrollHeight) <= scrollDelta) {
  2836. if (curSite.SiteTypeID === SiteType.GAMERSKY_GL) curSite.pager.scrollDelta -= 800 // 游民星空 gl 的比较奇葩,需要特殊处理下
  2837. ShowPager.loadMorePage();
  2838. }
  2839. } else {
  2840. if (document.documentElement.scrollHeight <= scrollHeight + scrollTop + scrollDelta) {
  2841. if (curSite.pager.type === 2) { // <<<<< 翻页类型 2(网站自带了自动无缝翻页功能,只需要点击下一页按钮即可)>>>>>
  2842. if (curSite.SiteTypeID > 0) { // 如果指定了间隔时间,那么就依靠这个判断时间到了没有~
  2843. let autopbn = document.querySelector(curSite.pager.nextLink);
  2844. if (autopbn) { // 寻找下一页链接
  2845. // 避免重复点击翻页按钮
  2846. if (curSite.pager.nextText) { // 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页
  2847. if (autopbn.innerText === curSite.pager.nextText) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1
  2848. } else if (curSite.pager.nextTextOf) { // 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页
  2849. if (autopbn.innerText.indexOf(curSite.pager.nextTextOf) > -1) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1
  2850. } else if (curSite.pager.nextHTML) { // 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页
  2851. if (autopbn.innerHTML === curSite.pager.nextHTML) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1
  2852. } else { // 如果没有指定按钮文字就直接点击
  2853. autopbn.click(); pageNum.now = pageNum._now + 1; // 当前页码 + 1
  2854. // 对于没有按钮文字变化的按钮,可以手动指定间隔时间
  2855. if (curSite.pager.intervals) {
  2856. let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0;
  2857. setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals)
  2858. }
  2859. }
  2860. }
  2861. }
  2862. } else if (curSite.pager.type === 1) { // <<<<< 翻页类型 1(由脚本实现自动无缝翻页)>>>>>
  2863. if (curSite.SiteTypeID > 0) ShowPager.loadMorePage();
  2864. } else if (curSite.pager.type === 4) { // <<<<< 翻页类型 4(部分简单的动态加载类网站)>>>>>
  2865. if (curSite.SiteTypeID > 0) {
  2866. // 为百度贴吧的发帖考虑...
  2867. if (!(document.documentElement.scrollHeight <= scrollHeight + scrollTop + 200 && curSite.SiteTypeID === SiteType.BAIDU_TIEBA)) {
  2868. curSite.pager.nextLink();
  2869. }
  2870. if (curSite.pager.intervals) {
  2871. let _SiteTypeID = curSite.SiteTypeID;
  2872. curSite.SiteTypeID = 0;
  2873. setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals)
  2874. }
  2875. }
  2876. }
  2877. }
  2878. }
  2879. }
  2880. });
  2881. }
  2882. }
  2883.  
  2884.  
  2885. // 启用/禁用 (当前网站)
  2886. function menu_disable(type) {
  2887. switch(type) {
  2888. case 'check':
  2889. if(check()) {return true;} else {return false;}; break;
  2890. case 'add':
  2891. add(); break;
  2892. case 'del':
  2893. del(); break;
  2894. }
  2895.  
  2896. function check() { // 存在返回真,不存在返回假
  2897. let list = GM_getValue('menu_disable'); // 读取网站列表
  2898. if (list.indexOf(location.host) === -1) return false // 不存在返回假
  2899. return true
  2900. }
  2901.  
  2902. function add() {
  2903. if (check()) return
  2904. let list = GM_getValue('menu_disable'); // 读取网站列表
  2905. list.push(location.host); // 追加网站域名
  2906. GM_setValue('menu_disable', list); // 写入配置
  2907. location.reload(); // 刷新网页
  2908. }
  2909.  
  2910. function del() {
  2911. if (!check()) return
  2912. let list = GM_getValue('menu_disable'), // 读取网站列表
  2913. index = list.indexOf(location.host);
  2914. list.splice(index, 1); // 删除网站域名
  2915. GM_setValue('menu_disable', list); // 写入配置
  2916. location.reload(); // 刷新网页
  2917. }
  2918. }
  2919.  
  2920.  
  2921. // 左键双击网页空白处暂停翻页
  2922. function pausePageEvent() {
  2923. if (!GM_getValue('menu_pause_page')) return
  2924. if (curSite.SiteTypeID === 0) return
  2925. document.body.addEventListener('dblclick', function (e) {
  2926. if (pausePage) {
  2927. pausePage = false;
  2928. GM_notification({text: `❌ 已暂停本页 [自动无缝翻页]\n (再次双击可恢复)`, timeout: 2500});
  2929. } else {
  2930. pausePage = true;
  2931. GM_notification({text: `✅ 已恢复本页 [自动无缝翻页]\n (再次双击可暂停)`, timeout: 2500});
  2932. }
  2933. });
  2934. }
  2935.  
  2936.  
  2937. // 显示页码
  2938. function pageNumber(type) {
  2939. if (curSite.SiteTypeID === 0) return
  2940. let status = document.getElementById('Autopage_number');
  2941. switch (type) {
  2942. case 'add':
  2943. add(); break;
  2944. case 'del':
  2945. del(); break;
  2946. case 'set':
  2947. set(); break;
  2948. }
  2949.  
  2950. function add(){
  2951. if (status) {
  2952. if (status.style.display === 'none') {status.style.display = 'flex';}
  2953. return
  2954. }
  2955. // 插入网页
  2956. let _html = `<style>#Autopage_number {top: calc(75vh) !important;left: 0 !important;width: 32px;height: 32px;padding: 6px !important;display: flex;position: fixed !important;opacity: 0.5;transition: .2s;z-index: 1000 !important;cursor: pointer;user-select: none !important;flex-direction: column;align-items: center;justify-content: center;box-sizing: content-box;border-radius: 0 50% 50% 0;transform-origin: center !important;transform: translateX(-8px);background-color: #eeec;-webkit-tap-highlight-color: transparent;box-shadow: 1px 1px 3px 0px #989898 !important;color: #000 !important;} #Autopage_number:hover {opacity: 1;transform: translateX(0);}</style>
  2957. <div id="Autopage_number" title="1. 此处数字为 [当前页码] (可在脚本菜单中关闭)&#10;&#10;2. 鼠标左键点击此处 [临时暂停本页自动无缝翻页](再次点击可恢复)">${pageNum._now}</div>`
  2958. document.body.insertAdjacentHTML('beforeend', _html);
  2959. // 点击事件(临时暂停翻页)
  2960. document.getElementById('Autopage_number').onclick = function () {
  2961. if (pausePage) {pausePage = false; GM_notification({text: `❌ 已暂停本页 [自动无缝翻页]\n (再次点击可恢复)`, timeout: 2500});} else {pausePage = true; GM_notification({text: `✅ 已恢复本页 [自动无缝翻页]\n (再次点击可暂停)`, timeout: 2500});}
  2962. };
  2963. status = document.getElementById('Autopage_number');
  2964. set();
  2965. }
  2966. // 监听储存当前页码的对象值的变化
  2967. function set(){
  2968. Object.defineProperty(pageNum, 'now', {
  2969. set: function(value) {
  2970. this._now = value;
  2971. if (status) status.textContent = value;
  2972. }
  2973. });
  2974. }
  2975. function del(){
  2976. if (!status) return
  2977. status.style.display = 'none';
  2978. }
  2979. }
  2980.  
  2981.  
  2982. // 菜单开关
  2983. function menu_switch(menu_status, Name, Tips) {
  2984. if (menu_status === true){
  2985. GM_setValue(Name, false);
  2986. } else {
  2987. GM_setValue(Name, true);
  2988. }
  2989. if (Name === 'menu_page_number') {
  2990. if (menu_status === true){pageNumber('del');} else {pageNumber('add');}
  2991. registerMenuCommand(); // 重新注册脚本菜单
  2992. } else {
  2993. location.reload();}
  2994. };
  2995.  
  2996.  
  2997. // 生成 ID
  2998. function generateID() {
  2999. let num = 0
  3000. for (let val in DBSite) {
  3001. DBSite[val].SiteTypeID = num = num + 1;
  3002. }
  3003. }
  3004.  
  3005.  
  3006. // 判断是支持
  3007. function doesItSupport() {
  3008. setDBSite(); // 配置 DBSite 变量对象
  3009.  
  3010. // 遍历判断是否是某个已支持的网站,顺便直接赋值
  3011. let support = false;
  3012. for (let now in DBSite) { // 遍历对象
  3013. if (!DBSite[now].host) continue; // 如果不存在则继续下一个循环
  3014. if (Array.isArray(DBSite[now].host)) { // 如果是数组
  3015. for (let i of DBSite[now].host) { // 遍历数组
  3016. if (i === location.host) {
  3017. if (DBSite[now].functionStart) {
  3018. DBSite[now].functionStart();
  3019. } else {
  3020. curSite = DBSite[now];
  3021. }
  3022. support = true; break; // 如果找到了就退出循环
  3023. }
  3024. }
  3025. } else if (DBSite[now].host === location.host) {
  3026. if (DBSite[now].functionStart) {
  3027. DBSite[now].functionStart();
  3028. } else {
  3029. curSite = DBSite[now];
  3030. }
  3031. support = true; break; // 如果找到了就退出循环
  3032. }
  3033. }
  3034.  
  3035. if (!support) { // 部分域名额外判断一下
  3036. if (location.host.indexOf(DBSite.btbtt.host) > -1) { // < BT 之家 >
  3037. curSite = DBSite.btbtt;
  3038. support = true;
  3039. }
  3040. }
  3041.  
  3042. if (support) {
  3043. console.info('[自动无缝翻页] - 其他网站(独立规则)'); return 1;
  3044. } else if (document.querySelector('meta[name="author"][content*="Discuz!"], meta[name="generator"][content*="Discuz!"]') || (document.querySelector('a[href*="www.discuz.net"]') && document.querySelector('a[href*="www.discuz.net"]').textContent.indexOf('Discuz!') > -1) || (document.getElementById('ft') && document.getElementById('ft').textContent.indexOf('Discuz!') > -1)) {
  3045. console.info('[自动无缝翻页] - Discuz! 论坛'); return 2;
  3046. } else if (document.getElementById('flarum-loading')) {
  3047. console.info('[自动无缝翻页] - Flarum 论坛'); return 3;
  3048. } else if (document.querySelector('link[href*="themes/dux" i], script[src*="themes/dux" i]')) {
  3049. console.info('[自动无缝翻页] - 使用 WordPress DUX 主题的网站'); return 4;
  3050. }
  3051. return 0;
  3052. }
  3053.  
  3054.  
  3055. // 获取 Cookie
  3056. function getCookie(name) {
  3057. if (!name) return ''
  3058. let arr = document.cookie.split(';');
  3059. name += '='
  3060. for (let i=0; i<arr.length; i++) {
  3061. let now = arr[i].trim();
  3062. if (now.indexOf(name) == 0) return now.substring(name.length, now.length);
  3063. }
  3064. return '';
  3065. }
  3066.  
  3067.  
  3068. // 类型 4 专用
  3069. function getPageElems(url, type = 'text', method = 'GET', data = '', type2) {
  3070. //console.log(url, data)
  3071. let mimeType = '';
  3072. if (curSite.pager.mimeType) mimeType = curSite.pager.mimeType;
  3073. GM_xmlhttpRequest({
  3074. url: url,
  3075. method: method,
  3076. data: data,
  3077. responseType: type,
  3078. overrideMimeType: mimeType,
  3079. headers: {
  3080. "Referer": location.href,
  3081. 'Content-Type': (method === 'POST') ? 'application/x-www-form-urlencoded':''
  3082. },
  3083. timeout: 5000,
  3084. onload: function (response) {
  3085. try {
  3086. //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  3087. switch (type) {
  3088. case 'json':
  3089. curSite.pager.insertElement(response.response, type2);
  3090. break;
  3091. default:
  3092. curSite.pager.insertElement(ShowPager.createDocumentByString(response.responseText), type2)
  3093. }
  3094. } catch (e) {
  3095. console.log(e);
  3096. }
  3097. }
  3098. });
  3099. }
  3100.  
  3101.  
  3102. // 插入位置
  3103. function addTo(num) {
  3104. switch (num) {
  3105. case 1:
  3106. return 'beforebegin'; break;
  3107. case 2:
  3108. return 'afterbegin'; break;
  3109. case 3:
  3110. return 'beforeend'; break;
  3111. case 4:
  3112. return 'afterend'; break;
  3113. }
  3114. }
  3115.  
  3116.  
  3117. // 滚动条事件
  3118. function windowScroll(fn1) {
  3119. var beforeScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  3120. fn = fn1 || function () {};
  3121. setTimeout(function () { // 延时 1 秒执行,避免刚载入到页面就触发翻页事件
  3122. window.addEventListener('scroll', function (e) {
  3123. var afterScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
  3124. delta = afterScrollTop - beforeScrollTop;
  3125. if (delta == 0) return false;
  3126. fn(delta > 0 ? 'down' : 'up', e);
  3127. beforeScrollTop = afterScrollTop;
  3128. }, false);
  3129. }, 1000)
  3130. }
  3131.  
  3132.  
  3133. // 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader
  3134. var ShowPager = {
  3135. getFullHref: function (e) {
  3136. if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
  3137. return '';
  3138. },
  3139. createDocumentByString: function (e) {
  3140. if (e) {
  3141. if ('HTML' !== document.documentElement.nodeName) return (new DOMParser).parseFromString(e, 'application/xhtml+xml');
  3142. var t;
  3143. try { t = (new DOMParser).parseFromString(e, 'text/html');} catch (e) {}
  3144. if (t) return t;
  3145. if (document.implementation.createHTMLDocument) {
  3146. t = document.implementation.createHTMLDocument('ADocument');
  3147. } else {
  3148. 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) {}
  3149. }
  3150. if (t) {
  3151. var r = document.createRange(),
  3152. n = r.createContextualFragment(e);
  3153. r.selectNodeContents(document.body);
  3154. t.body.appendChild(n);
  3155. 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);
  3156. return t;
  3157. }
  3158. } else console.error('没有找到要转成 DOM 的字符串');
  3159. },
  3160. loadMorePage: function () {
  3161. if (curSite.pager) {
  3162. var url;
  3163. if (typeof curSite.pager.nextLink == 'function') {
  3164. url = curSite.pager.nextLink();
  3165. } else {
  3166. if (curSite.pager.nextLink.slice(0,4) === 'css;') {
  3167. url = this.getFullHref(getElementByCSS(curSite.pager.nextLink.slice(4)));
  3168. } else {
  3169. url = this.getFullHref(getElementByXpath(curSite.pager.nextLink));
  3170. }
  3171. }
  3172. console.log(url, curSite.pageUrl);
  3173. if (url === '') return;
  3174. if (curSite.pageUrl === url) return;// 避免重复加载相同的页面
  3175. curSite.pageUrl = url;
  3176. let mimeType = '';
  3177. if (curSite.pager.mimeType) mimeType = curSite.pager.mimeType;
  3178. // 读取下一页的数据
  3179. GM_xmlhttpRequest({
  3180. url: url,
  3181. method: 'GET',
  3182. overrideMimeType: mimeType,
  3183. headers: {
  3184. "Referer": location.href
  3185. },
  3186. timeout: 5000,
  3187. onload: function (response) {
  3188. try {
  3189. //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
  3190. var newBody = ShowPager.createDocumentByString(response.responseText);
  3191. let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody),
  3192. toElement = getAllElements(curSite.pager.insertPosition[0])[0];
  3193. //console.log(curSite.pager.pageElement, pageElems)
  3194.  
  3195. if (pageElems.length >= 0) {
  3196. // 如果有插入前函数就执行函数
  3197. if (curSite.function && curSite.function.before) {
  3198. if (curSite.function.parameter) { // 如果指定了参数
  3199. pageElems = curSite.function.before(curSite.function.parameter);
  3200. } else {
  3201. pageElems = curSite.function.before(pageElems);
  3202. }
  3203. }
  3204.  
  3205. // 插入位置
  3206. let addTo1 = addTo(curSite.pager.insertPosition[1]);
  3207.  
  3208. // 插入新页面元素
  3209. pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);});
  3210.  
  3211. // 当前页码 + 1
  3212. pageNum.now = pageNum._now + 1
  3213.  
  3214. // 插入 <script> 标签
  3215. if (curSite.pager.scriptType) {
  3216. let scriptText = '';
  3217. if (curSite.pager.scriptType === 1) { // 下一页的所有 <script> 标签
  3218. const scriptElems = getAllElements('//script', newBody, newBody);
  3219. scriptElems.forEach(function (one) {scriptText += ';' + one.textContent;});
  3220. toElement.appendChild(document.createElement('script')).textContent = scriptText;
  3221. } else if (curSite.pager.scriptType === 2) { // 下一页主体元素同级 <script> 标签
  3222. pageElems.forEach(function (one) {if (one.tagName === 'SCRIPT') {scriptText += ';' + one.textContent;}});
  3223. if (scriptText) toElement.appendChild(document.createElement('script')).textContent = scriptText;
  3224. } else if (curSite.pager.scriptType === 3) { // 下一页主体元素同级 <script> 标签(远程文件)
  3225. pageElems.forEach(function (one) {if (one.tagName === 'SCRIPT' && one.src) {toElement.appendChild(document.createElement('script')).src = one.src;}});
  3226. } else if (curSite.pager.scriptType === 4) { // 下一页主体元素子元素 <script> 标签
  3227. pageElems.forEach(function (one) {
  3228. const scriptElems = one.querySelectorAll('script');
  3229. scriptElems.forEach(function (script) {scriptText += ';' + script.textContent;});
  3230. });
  3231. if (scriptText) toElement.appendChild(document.createElement('script')).textContent = scriptText;
  3232. }
  3233. }
  3234.  
  3235. // 添加历史记录
  3236. if (curSite.pager.history && curSite.pager.history == true) {
  3237. window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, newBody.querySelector('title').textContent, curSite.pageUrl);
  3238. }
  3239.  
  3240. // 替换待替换元素
  3241. try {
  3242. let oriE = getAllElements(curSite.pager.replaceE),
  3243. repE = getAllElements(curSite.pager.replaceE, newBody, newBody);
  3244. //console.log(oriE, repE);
  3245. if (oriE.length === repE.length) {
  3246. for (let i = 0; i < oriE.length; i++) {
  3247. oriE[i].outerHTML = repE[i].outerHTML;
  3248. }
  3249. }
  3250. } catch (e) {
  3251. console.log(e);
  3252. }
  3253. // 如果有插入后函数就执行函数
  3254. if (curSite.function && curSite.function.after) {
  3255. if (curSite.function.parameter) { // 如果指定了参数
  3256. curSite.function.after(curSite.function.parameter);
  3257. } else {
  3258. curSite.function.after();
  3259. }
  3260. }
  3261. }
  3262. } catch (e) {
  3263. console.log(e);
  3264. }
  3265. }
  3266. });
  3267. }
  3268. },
  3269. };
  3270. function getElementByCSS(css, contextNode = document) {
  3271. return contextNode.querySelector(css);
  3272. }
  3273. function getAllElementsByCSS(css, contextNode = document) {
  3274. return [].slice.call(contextNode.querySelectorAll(css));
  3275. }
  3276. function getElementByXpath(xpath, contextNode, doc = document) {
  3277. contextNode = contextNode || doc;
  3278. try {
  3279. const result = doc.evaluate(xpath, contextNode, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  3280. // 应该总是返回一个元素节点
  3281. return result.singleNodeValue && result.singleNodeValue.nodeType === 1 && result.singleNodeValue;
  3282. } catch (err) {
  3283. throw new Error(`Invalid xpath: ${xpath}`);
  3284. }
  3285. }
  3286. function getAllElementsByXpath(xpath, contextNode, doc = document) {
  3287. contextNode = contextNode || doc;
  3288. const result = [];
  3289. try {
  3290. const query = doc.evaluate(xpath, contextNode, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  3291. for (let i = 0; i < query.snapshotLength; i++) {
  3292. const node = query.snapshotItem(i);
  3293. // 如果是 Element 节点
  3294. if (node.nodeType === 1) result.push(node);
  3295. }
  3296. } catch (err) {
  3297. throw new Error(`无效 Xpath: ${xpath}`);
  3298. }
  3299. return result;
  3300. }
  3301. function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) {
  3302. if (!selector) return [];
  3303. contextNode = contextNode || doc;
  3304. if (typeof selector === 'string') {
  3305. if (selector.search(/^css;/i) === 0) {
  3306. return getAllElementsByCSS(selector.slice(4), contextNode);
  3307. } else {
  3308. return getAllElementsByXpath(selector, contextNode, doc);
  3309. }
  3310. } else {
  3311. const query = selector(doc, win, _cplink);
  3312. if (!Array.isArray(query)) {
  3313. throw new Error('getAllElements 返回错误类型');
  3314. } else {
  3315. return query;
  3316. }
  3317. }
  3318. }
  3319.  
  3320. /*// 监听 XMLHttpRequest URL
  3321. var _send = window.XMLHttpRequest.prototype.send
  3322. function sendReplacement(data) {
  3323. console.log(data)
  3324. return _send.apply(this, arguments);
  3325. }
  3326. window.XMLHttpRequest.prototype.send = sendReplacement;
  3327. // 监听 XMLHttpRequest 模式(GET/POST)和数据
  3328. var _open = window.XMLHttpRequest.prototype.open
  3329. function openReplacement(data) {
  3330. console.log(data, arguments)
  3331. return _open.apply(this, arguments);
  3332. }
  3333. window.XMLHttpRequest.prototype.open = openReplacement;*/
  3334. })();