Greasy Fork

Greasy Fork is available in English.

MangaDex - Gallery-dl

Batch download mangadex manga w gallery-dl

当前为 2020-11-24 提交的版本,查看 最新版本

// ==UserScript==
// @name         MangaDex - Gallery-dl
// @version      1.0
// @description  Batch download mangadex manga w gallery-dl
// @author       Gondola
// @grant        GM_addStyle
// @grant        GM_setClipboard
// @run-at       document-end
// @match        https://mangadex.org/title/*
// @compatible   firefox
// @namespace http://greasyfork.icu/users/581457
// ==/UserScript==


GM_addStyle("#jdownload_all_icon:before{content: '\\f019';} .jdl1:before{content: '\\f019'; cursor:pointer;} .jdl2:before{content: '\\f019';cursor:default !important;} .jdl2:hover{color:#999 !important;} .gallery-dl_input{background-color:#fff !important; border-color:#dee2e6 !important; border-style:solid !important; border-width:1px !important; width:50px !important; text-align: center !important; color:#000 !important; height: 32px !important; margin-bottom:6px !important;}");


(function() {

    function gallery_all()
    {
        var gall_from = 0
        var gall_to = 99999

        if(document.getElementById("gallery_dl_from").value != "")
        {
            gall_from = document.getElementById("gallery_dl_from").value
        }

        if(document.getElementById("gallery_dl_to").value != "")
        {
            gall_to = document.getElementById("gallery_dl_to").value
        }

        if(document.getElementById("gallery_dl_from").value === "" && document.getElementById("gallery_dl_to").value === "")
        {
            GM_setClipboard("gallery-dl --chapter-filter \"lang == 'en'\" \"" + window.location.href + "\"")
        }else{
            GM_setClipboard("gallery-dl --chapter-filter \"lang == 'en' and " + gall_from + " <= chapter < " + gall_to + "\" \"" + window.location.href + "\"")
        }
    }

    document.getElementById("upload_button").insertAdjacentHTML( 'beforebegin', '<button style="margin-right:3px;" id="gallery-dl" class="btn btn-secondary"><span id="jdownload_all_icon" class="fa-fw fas"></span>&nbsp;<span id="gallery-dl_text">Copy</span></button> <input id="gallery_dl_from" class="gallery-dl_input" type="text"></input> to <input id="gallery_dl_to" class="gallery-dl_input" type="text"></input><br>' );
    document.getElementById("gallery-dl").addEventListener("click", gallery_all)

})();