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.0
  5. // @description download manga from mangalib.me
  6. // @author You
  7. // @match *://mangalib.me/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. const header = document.querySelector('#main-page .media-tabs .tabs__list');
  15.  
  16. if (!header) {
  17. return;
  18. }
  19.  
  20. const button = document.createElement('span');
  21. button.classList.add('volume-anchor__trigger');
  22. button.innerText = 'Скачать все главы';
  23. button.addEventListener('click', function() {
  24. const chapters = document.querySelectorAll('.media-chapter__icon.media-chapter__icon_download');
  25. chapters.forEach(function(node) {
  26. if (node.getAttribute('data-chapter-dropdown')) {
  27. node.dispatchEvent(new MouseEvent('mouseenter'));
  28. setTimeout(() => {
  29. const tippyId = node.getAttribute('aria-describedby');
  30. const tippy = document.getElementById(tippyId);
  31. const translations = tippy.querySelectorAll('.menu a.menu__item');
  32. translations[translations.length - 1].click();
  33. }, 500);
  34. }
  35. node.click();
  36. });
  37. });
  38. button.style.marginLeft = '12px';
  39. header.appendChild(button);
  40.  
  41. })();