🏠 返回首頁 

Greasy Fork is available in English.

Mangalib: Download all chapters

download manga from mangalib.me


安装此脚本?
  1. // ==UserScript==
  2. // @name Mangalib: Download all chapters
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.1
  5. // @description download manga from mangalib.me
  6. // @author DIMA325SK
  7. // @match *://mangalib.me/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. var header = document.querySelector('#main-page .media-tabs .tabs__list');
  14. if (header != undefined) {
  15. const button = document.createElement('span');
  16. var timer = null, px = 30, list = [];
  17. button.classList.add('volume-anchor__trigger');
  18. button.innerText = 'Скачать все главы';
  19. button.style.marginLeft = '12px';
  20. header.append(button);
  21. button.addEventListener('click', function() {
  22. timer = setInterval(function(){
  23. window.scrollTo(0,px);
  24. const chapters = document.querySelectorAll('.media-chapter');
  25. chapters.forEach(function(node) {
  26. var id = node.getAttribute('data-id'),
  27. element = list.find(function(value, index) {return value === id;});
  28. if (element == undefined) {
  29. list.push(id);
  30. node.querySelector('.media-chapter__icon_download').click();
  31. }
  32. });
  33. px+=300;
  34. }, 500);
  35. });
  36. window.onscroll = function(e){
  37. if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
  38. clearInterval(timer);
  39. console.log(list);
  40. }
  41. }
  42. }
  43. })();