自动无缝翻页

无缝拼接下一页内容(瀑布流),目前支持:[所有使用「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、Github、StackOverflow(以上仅一部分,更多的写不下了...

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

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