// ==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 https://greasyfork.org/users/581457
// @downloadURL none
// ==/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', ' to
' );
document.getElementById("gallery-dl").addEventListener("click", gallery_all)
})();