包子漫畫閱讀輔助

包子漫畫閱讀輔助,瀑布流閱讀連續載入圖片,在新分頁打開漫畫鏈接(自用)。

  1. // ==UserScript==
  2. // @name 包子漫畫閱讀輔助
  3. // @name:en Baozi Manga Read Helpr
  4. // @name:zh-CN 包子漫画阅读辅助
  5. // @name:zh-TW 包子漫畫閱讀輔助
  6. // @version 2.5.10
  7. // @description 包子漫畫閱讀輔助,瀑布流閱讀連續載入圖片,在新分頁打開漫畫鏈接(自用)。
  8. // @description:en read infinite scroll,manga link open in newtab
  9. // @description:zh-CN 包子漫画阅读辅助,瀑布流阅读连续载入图片,在新分页打开漫画链接(自用)。
  10. // @description:zh-TW 包子漫畫閱讀輔助,瀑布流閱讀連續載入圖片,在新分頁打開漫畫鏈接(自用)。
  11. // @author tony0809
  12. // @match *://cn.baozimh.com/*
  13. // @match *://cn.webmota.com/*
  14. // @match *://tw.baozimh.com/*
  15. // @match *://tw.webmota.com/*
  16. // @match *://www.baozimh.com/*
  17. // @match *://www.webmota.com/*
  18. // @match *://cn.kukuc.co/*
  19. // @match *://tw.kukuc.co/*
  20. // @match *://www.kukuc.co/*
  21. // @match *://tw.czmanga.com/*
  22. // @match *://cn.czmanga.com/*
  23. // @match *://www.czmanga.com/*
  24. // @match *://tw.dzmanga.com/*
  25. // @match *://cn.dzmanga.com/*
  26. // @match *://www.dzmanga.com/*
  27. // @match *://tw.dociy.net/*
  28. // @match *://cn.dociy.net/*
  29. // @match *://www.dociy.net/*
  30. // @match *://www.twmanga.com/*
  31. // @match *://tw.twmanga.com/*
  32. // @match *://cn.twmanga.com/*
  33. // @match *://www.tbmanga.com/*
  34. // @match *://tw.tbmanga.com/*
  35. // @match *://cn.tbmanga.com/*
  36. // @match *://www.hcmanga.com/*
  37. // @match *://tw.hcmanga.com/*
  38. // @match *://cn.hcmanga.com/*
  39. // @icon https://www.baozimh.com/favicon.ico
  40. // @require https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
  41. // @license MIT
  42. // @namespace https://greasyfork.org/users/20361
  43. // ==/UserScript==
  44.  
  45. (() => {
  46. 'use strict';
  47. const options = { //true 開啟,false 關閉
  48. oint: true, //在新分頁打開漫畫鏈接。
  49. aH: true, //載入下一話時添加瀏覽器歷史紀錄
  50. aO: true, //目錄頁自動展開全部章節。
  51. pln: true, //1頁1線程逐張預讀的圖片,可減少等待加載圖片的時間,如果滾動、滑動的閱讀速度大於預讀速度還是需要待圖片載入。
  52. topBtn: false, //添加返回頂部按鈕
  53. remove: [true, 4] //!!!不能小於2!!!閱讀載入超過n話時刪除前面話數的圖片。
  54. },
  55. ge = (selector, doc) => (doc || document).querySelector(selector),
  56. gae = (selector, doc) => (doc || document).querySelectorAll(selector),
  57. gx = (xpath, doc) => (doc || document).evaluate(xpath, (doc || document), null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue,
  58. lp = location.pathname,
  59. home = /^\/$/.test(lp),
  60. classify = /^\/classify/.test(lp),
  61. list = /^\/list\/new/.test(lp),
  62. search = /^\/search\?/.test(lp),
  63. comic = /^\/comic\/[^.]+$/.test(lp),
  64. read = /^\/comic\/chapter\/[^.]+\.html$/.test(lp),
  65. loading_bak = 'data:image/png;base64,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',
  66. openInNewTab = () => gae('.comics-card a:not([target=_blank]),.bookshelf-items a:not(.remove-img):not([target=_blank])').forEach(a => {
  67. a.setAttribute('target', '_blank');
  68. }),
  69. addGoBack = () => {
  70. let goback = document.createElement('div');
  71. goback.className = 'goback';
  72. goback.setAttribute('title', '返回頂部');
  73. goback.addEventListener('click', () => {
  74. window.scrollTo({
  75. top: 0,
  76. behavior: "smooth"
  77. });
  78. });
  79. document.body.appendChild(goback);
  80. },
  81. removeAd = () => {
  82. let loop = setInterval(() => {
  83. let ad = ge('#interstitial_fade');
  84. if (ad) {
  85. clearInterval(loop);
  86. ad.remove();
  87. }
  88. }, 100);
  89. setTimeout(() => {
  90. if (loop) clearInterval(loop);
  91. }, 1e4);
  92. gae('.mobadsq').forEach(e => {
  93. e.remove();
  94. });
  95. },
  96. addHistory = (title, url) => {
  97. history.pushState(null, title, url);
  98. document.title = title;
  99. },
  100. showElement = () => {
  101. let end = gx("//div[@class='next_chapter']/span[text()='这是本作品最后一话了' or text()='這是本作品最後一話了']");
  102. if (end) {
  103. ge('.next_chapter+.l-content').style.display = 'block';
  104. const observer = new IntersectionObserver((entries, observer) => {
  105. entries.forEach(entry => {
  106. if (entry.isIntersecting) {
  107. observer.unobserve(entry.target);
  108. let e = entry.target;
  109. setTimeout(() => {
  110. let noImg = e.querySelector('div.i-amphtml-svc');
  111. if (noImg) {
  112. noImg.remove();
  113. let img = new Image();
  114. img.setAttribute('decoding', 'async');
  115. img.setAttribute('alt', e.getAttribute('alt'));
  116. img.src = e.getAttribute('src');
  117. img.className = 'i-amphtml-svc i-amphtml-loading-container i-amphtml-fill-content';
  118. e.appendChild(img);
  119. }
  120. }, 200);
  121. }
  122. });
  123. });
  124. gae('.l-box a>amp-img').forEach(amp => {
  125. observer.observe(amp);
  126. });
  127. }
  128. },
  129. addLoad = () => {
  130. let cl = document.createElement('div');
  131. cl.className = 'chapterLoading';
  132. let li = new Image();
  133. li.className = 'loadingImg';
  134. li.src = '/_nuxt/img/loading.12fdcc4.gif';
  135. li.style.width = '50px';
  136. cl.appendChild(li);
  137. let lt = document.createElement('div');
  138. lt.className = 'loadingText';
  139. lt.innerText = 'Loading...';
  140. cl.appendChild(lt);
  141. ge('.comic-contain').appendChild(cl);
  142. },
  143. removeLoad = () => {
  144. ge('.chapterLoading').remove();
  145. },
  146. addTitle = title => {
  147. let t = document.createElement('div');
  148. t.className = 'chapterTitle';
  149. t.innerText = title;
  150. let load = ge('.chapterLoading');
  151. load.parentNode.insertBefore(t, load);
  152. },
  153. parseHTML = str => {
  154. var doc = null;
  155. try {
  156. doc = new DOMParser().parseFromString(str, 'text/html');
  157. } catch (e) {}
  158. if (!doc) {
  159. doc = document.implementation.createHTMLDocument('');
  160. doc.documentElement.innerHTML = str;
  161. }
  162. return doc;
  163. },
  164. getNextLink = () => {
  165. let nextlink = null;
  166. let next = ge('#next-chapter');
  167. if (next) {
  168. nextlink = next.href;
  169. //可能會遇到當前域名和下一頁鏈接的域名不同,導致發生跨域請求出錯的情況,需替換為當前域名。
  170. const nh = next.host,
  171. lh = location.host;
  172. if (nh !== lh) {
  173. nextlink = nextlink.replace(nh, lh);
  174. }
  175. }
  176. return nextlink;
  177. },
  178. picPreload = async (imgsArray, index, str) => {
  179. const loadImg = src => {
  180. return new Promise(resolve => {
  181. let num = src.match(/(\d+)\.[a-z]{3,5}$/i)[1];
  182. let temp = new Image();
  183. temp.src = src;
  184. temp.onload = () => {
  185. resolve(`${(str || '')}[Pic(${num})][Preload OK]\n${src}`);
  186. temp = null;
  187. };
  188. temp.onerror = (e) => {
  189. resolve(`${(str || '')}[Pic(${num})][Preload ERROR]\n${src}`);
  190. setTimeout(() => {
  191. console.log(`Preload重新載入圖片:\n${src}\n`, loadImg(src));
  192. }, 500);
  193. temp = null;
  194. };
  195. });
  196. };
  197. for (let i = index; i < imgsArray.length; i++) {
  198. let msg = await loadImg(imgsArray[i].getAttribute('src'));
  199. console.log(msg);
  200. msg = null;
  201. }
  202. },
  203. preloadNext = () => {
  204. let url = getNextLink();
  205. if (url !== null) {
  206. fetch(url).then(res => res.text()).then(res => {
  207. var doc = null;
  208. doc = parseHTML(res);
  209. let imgs = gae('.comic-contain amp-img', doc);
  210. let title = ge('span.title', doc).innerText;
  211. let firstImgSrcNum = imgs[0].getAttribute('src').match(/(\d+)\.[a-z]{3,5}$/i)[1];
  212. const num = (n) => Math.round(n / 50 + 1);
  213. picPreload(imgs, 0, `[${title} part${num(firstImgSrcNum)}]`);
  214. });
  215. }
  216. },
  217. fetchData = url => {
  218. fetch(url).then(res => res.text()).then(res => {
  219. let doc = parseHTML(res);
  220. insertData(doc, url);
  221. }).catch(error => {
  222. console.error(error);
  223. ge('.loadingImg').style.display = 'none';
  224. ge('.loadingText').innerText = '連線出錯,請返回頂部重新載入。';
  225. });
  226. },
  227. imagesObserver = new IntersectionObserver((entries, observer) => {
  228. entries.forEach(entry => {
  229. if (entry.isIntersecting) {
  230. observer.unobserve(entry.target);
  231. let realSrc = entry.target.dataset.src,
  232. nE = entry.target.nextElementSibling;
  233. if (realSrc) {
  234. entry.target.src = realSrc;
  235. entry.target.onerror = (error) => {
  236. error.target.src = loading_bak;
  237. setTimeout(() => {
  238. console.log(`Observer重新載入圖片:\n${realSrc}`);
  239. error.target.src = realSrc;
  240. console.log(error.target);
  241. }, 500);
  242. };
  243. }
  244. if (nE && nE.tagName == 'IMG' && nE.dataset.src) {
  245. nE.src = nE.dataset.src;
  246. }
  247. }
  248. });
  249. }),
  250. nextObserver = new IntersectionObserver((entries, observer) => {
  251. entries.forEach(entry => {
  252. if (entry.isIntersecting) {
  253. observer.unobserve(entry.target);
  254. let url = getNextLink();
  255. if (url !== null) {
  256. console.log(`觸發載入下一頁\n${url}`);
  257. addLoad();
  258. fetchData(url);
  259. }
  260. }
  261. });
  262. }),
  263. insertData = (doc, url) => {
  264. let imgs = gae('.comic-contain amp-img', doc);
  265. let F = new DocumentFragment();
  266. let n = 0;
  267. if (ge('.comic-contain>img')) {
  268. let currentLastImgSrc = [...gae('.comic-contain>img')].pop().src;
  269. let nextFirstImgSrc = imgs[0].dataset.src ? imgs[0].dataset.src : imgs[0].getAttribute('src');
  270. //當目前最後一張圖片檔名是50的倍數和下一頁第一張圖片檔名尾數是7且尾數不是1時,則不插入下一頁的前4張圖,讓條漫整體圖片按正確順序銜接。
  271. if (/\/(50|100|150|200|250|300)\.[a-z]{3,5}$/i.test(currentLastImgSrc) && /\/(\d+)?7\.[a-z]{3,5}$/i.test(nextFirstImgSrc) && !/\/(\d+)?1\.[a-z]{3,5}$/i.test(nextFirstImgSrc)) {
  272. n = 4;
  273. }
  274. }
  275. for (let i = n; i < imgs.length; i++) {
  276. let img = new Image();
  277. img.className = 'comic-contain__item';
  278. img.src = loading_bak;
  279. img.dataset.src = imgs[i].dataset.src ? imgs[i].dataset.src : imgs[i].getAttribute('src');
  280. imagesObserver.observe(img);
  281. F.appendChild(img);
  282. }
  283. let load = ge('.chapterLoading');
  284. if (load) {
  285. ['.comic-chapter>.next_chapter', '.bottom-bar', 'span.title'].forEach(e => {
  286. ge(e).outerHTML = ge(e, doc).outerHTML; //替換元素
  287. });
  288. showElement();
  289. let title = ge('span.title', doc).innerText.replace(/\(\d\/\d+\)/, "");
  290. if (!/\/\d+_\d+_\d+\.html$/.test(url)) { //是下一話才添加標題分隔條,下一頁則不添加。
  291. let docTitle = doc.title;
  292. if (options.aH) {
  293. addHistory(docTitle, url);
  294. }
  295. addTitle(title);
  296. }
  297. if (options.remove[0] && options.remove[1] > 1) {
  298. removeOldChapter();
  299. }
  300. setTimeout(() => {
  301. load.parentNode.insertBefore(F, load);
  302. removeLoad();
  303. if (options.pln) {
  304. preloadNext();
  305. }
  306. addNextObserver();
  307. }, 300);
  308. } else {
  309. showElement();
  310. let E = ge('.comic-contain');
  311. E.innerHTML = '';
  312. E.appendChild(F);
  313. }
  314. },
  315. addNextObserver = () => {
  316. let lastImg = [...gae('.comic-contain img')].pop();
  317. nextObserver.observe(lastImg);
  318. },
  319. removeOldChapter = () => {
  320. let titles = gae('.chapterTitle');
  321. if (titles.length > options.remove[1]) {
  322. titles[0].remove();
  323. let removes = gae('.comic-contain>*');
  324. for (let i in removes) {
  325. if (/chapterTitle/.test(removes[i].className)) {
  326. break;
  327. }
  328. removes[i].remove();
  329. }
  330. }
  331. },
  332. addGlobalStyle = css => {
  333. let style = document.createElement('style');
  334. style.type = 'text/css';
  335. style.innerHTML = css;
  336. document.head.appendChild(style);
  337. },
  338. readCss = `
  339. .goback {
  340. background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c6QAAAgpJREFUSEvtlD2IE0EYht9vJBeRQxIU5AoPCwsFGwsRrAQRzztRRFeEa6LsfiyBgJ2FrYWdSDjITH4uhYK4Ih74g4qFjSAWFoJYWCgKIigbVCSYzYxsGCXJ5ZLlDq6QTDPs9/M+H+/MDmGdFq0TB2PQqp0eW0fMfAUAKaUuAjBJvUxsneM4G7LZbBnAOSu+GIahFwRBOwksESiXy21MpVI3iehEt6gxZqnVap2t1+vNUbCRoEKhsLnZbC4R0UEr9tvuE3Z/lk6njxeLxe/DYENBrutuE0I8BLDXivwEcIqIjDHmDoBJG3+ltT5aqVS+rARbEeT7/g6t9RMAO23zNwBzSqkX8Tcz7wdwH8AWm38nhDhcKpXeD4INBPm+v0dr/RjAlG36SEQzUso33SKu6+4WQjwCsN3GPwM4opR63Q9bBvI87wAR3QOQtcVv2+32TLVa/TBoUmaeBhDDdtl8aIw5Vi6Xn3fX94CYeQ7ALQCbbNFLALNKqa/DDpqZtwJ4AGCfrfsF4IxSKra2s/6BPM+bJ6JFACmbexpF0clarfZj1NWN8/l8fjKKorsADtn6FhGdl1Je7wEx81UAF+KgMeZ2o9GYD4Lg71VOwoLjOBOZTOYGEZ3uiBNdk1J2NPutuwRgOgzDfNI/vn8C+4IsENEnKeXlZdYlGnkNRSNfhjVo97SOQat28v+z7g/utJ8bMvScRQAAAABJRU5ErkJggg==) no-repeat;
  341. background-position:bottom 6px right 5px;
  342. opacity: 0.7;
  343. border-radius: 50%;
  344. position: fixed;
  345. z-index:999;
  346. bottom: 7px;
  347. left: 50%;
  348. margin-left: -16px;
  349. width: 36px;
  350. height: 36px;
  351. }
  352. .mobadsq {
  353. display: none !important
  354. }
  355. ul {
  356. margin-block-start: -2px !important;
  357. margin-block-end: 2px !important
  358. }
  359. .chapterLoading {
  360. font-size: 20px;
  361. height: 80px;
  362. line-height: 32px;
  363. text-align: center;
  364. margin-bottom: 20px;
  365. }
  366. .chapterTitle {
  367. width: auto;
  368. height: 30px;
  369. font-size: 20px;
  370. font-family: Arial,sans-serif!important;
  371. line-height: 32px;
  372. text-align: center;
  373. overflow: hidden;
  374. display: -webkit-box;
  375. -webkit-box-orient: vertical;
  376. -webkit-line-clamp: 1;
  377. margin: 10px 5px;
  378. border: 1px solid #e0e0e0;
  379. background-color: #f0f0f0;
  380. background: -webkit-gradient(linear, 0 0, 0 100%, from(#f9f9f9), to(#f0f0f0));
  381. background: -moz-linear-gradient(top, #f9f9f9, #f0f0f0);
  382. box-shadow: 0 0 5px rgba(0, 0, 0, 0.6);
  383. border-radius: 5px;
  384. }
  385. .next_chapter + .l-content {
  386. display: none;
  387. }
  388. `;
  389. /*
  390. if (home) {
  391. addGlobalStyle(`amp-addthis[data-widget-type=floating]{display:none !important}`);
  392. ge('amp-addthis[data-widget-type=floating]').remove();
  393. }
  394. */
  395. if (read) {
  396. document['onkeydown'] = null;
  397. removeAd();
  398. addGlobalStyle(readCss);
  399. if (options.topBtn) addGoBack();
  400. let imgs = [...gae('.comic-contain amp-img')];
  401. let title = ge('span.title').innerText;
  402. if (imgs.length > 3 && options.pln) picPreload(imgs, 3, `[${title} part1]`);
  403. insertData(document);
  404. addNextObserver();
  405. if (options.pln) preloadNext();
  406. /*
  407. const hidetoolbar = () => {
  408. var e = e || window.event;
  409. if (e.wheelDelta < 0 || e.detail > 0) {
  410. $('div.header').attr('style', 'top: -44px;');
  411. $('div.bottom-bar').attr('style', 'bottom: -50px;')
  412. } else {
  413. $('div.header').attr('style', 'transform: translateY(0%);');
  414. $('div.bottom-bar').attr('style', 'transform: translateY(0%);')
  415. }
  416. };
  417. $('body').on('wheel', hidetoolbar);
  418. $('body').on('DOMMouseScroll', hidetoolbar);
  419.  
  420. const keyhidetoolbar = (e) => {
  421. let key = window.event ? e.keyCode : e.which;
  422. if (key == '34' || key == '32' || key == '40') {
  423. $('div.header').attr('style', 'top: -44px;');
  424. $('div.bottom-bar').attr('style', 'bottom: -50px;')
  425. } else {
  426. $('div.header').attr('style', 'transform: translateY(0%);');
  427. $('div.bottom-bar').attr('style', 'transform: translateY(0%);')
  428. }
  429. };
  430. $('body').on('keydown', keyhidetoolbar);
  431.  
  432. if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) {
  433. let startY, moveY, Y;
  434. $('body').on('touchstart', (e) => {
  435. startY = e.originalEvent.changedTouches[0].pageY;
  436. });
  437. $('body').on('touchmove', (e) => {
  438. moveY = e.originalEvent.changedTouches[0].pageY;
  439. Y = moveY - startY;
  440. if (Y < 0) {
  441. $('div.header').attr('style', 'top: -44px;');
  442. $('div.bottom-bar').attr('style', 'bottom: -50px;')
  443. } else if (Y > 0) {
  444. $('div.header').attr('style', 'transform: translateY(0%);');
  445. $('div.bottom-bar').attr('style', 'transform: translateY(0%);')
  446. }
  447. });
  448. }
  449. */
  450. }
  451.  
  452. if (options.oint && !comic && !read) {
  453. openInNewTab();
  454. new MutationObserver(() => {
  455. openInNewTab();
  456. }).observe(document.body, {
  457. childList: true,
  458. subtree: true
  459. });
  460. }
  461.  
  462. if (options.aO && comic) {
  463. let button = ge('#button_show_all_chatper');
  464. new IntersectionObserver(entries => {
  465. if (entries[0].isIntersecting) {
  466. button.click();
  467. }
  468. }).observe(button);
  469. }
  470.  
  471. })();