自动无缝翻页

无缝拼接下一页内容(瀑布流),目前支持:[所有使用「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-08 提交的版本,查看 最新版本

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