// ==UserScript== // @name byw漫畫下載 // @version 1.0 // @namespace mccranky83.github.io // @description 下載搬運網單行本漫畫 // @author mccranky // @match http://*/plugin.php?id=jameson_manhua*a=bofang*kuid* // @match http://*/plugin.php?id=jameson_manhua*kuid*a=bofang* // @match https://*/plugin.php?id=jameson_manhua*a=bofang*kuid* // @match https://*/plugin.php?id=jameson_manhua*kuid*a=bofang* // @icon https://www.google.com/s2/favicons?sz=64&domain=antbyw.com // @grant GM_xmlhttpRequest // @connect zerobywz.com // @license MIT // @downloadURL none // ==/UserScript== "use strict"; window.addEventListener("load", async () => { const scripts = [ "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js", "https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js", ]; await Promise.all( scripts.map( (cur) => new Promise((res, rej) => { const script = document.createElement("script"); script.src = cur; script.onload = res; script.onerror = rej; (document.head || document.documentElement).appendChild(script); }), ), ) .then(() => { console.log("scripts successfully loaded..."); (() => { class MangaDl { constructor() { this.chap_info = this.getChapterInfo(); this.manga_name = this.chap_info.manga_name; this.chap_list = this.chap_info.chap_list; this.chap_num = this.chap_list.length; this.chap_dllist = []; this.entry_chap = 0; this.end_chap = 0; this.max_chap_par = 0; this.max_img_par = 0; this.dling = false; this.zip = []; this.storing = false; this.retry = 0; // Logging this.f = false; this.net_chap = 0; } init() { if (!$("#mangadl-retry").attr("class").includes("none")) { $("#mangadl-retry").addClass("none"); } this.entry_chap = 0; this.end_chap = 0; this.max_chap_par = 0; this.max_img_par = 0; this.chap_dllist = []; this.zip = []; console.clear(); } getChapterInfo() { const title = $(".uk-switcher .uk-heading-line").text(); let manga_name_jp = ""; let manga_name_zh = ""; if (title.includes("【")) { manga_name_jp = title.match(/(?<=【)[^[【】]+(?=】)/g)[1]; manga_name_zh = title.split("【")[0]; } else { manga_name_zh = title.split(" ")[0]; } const manga_name = manga_name_zh + (manga_name_jp ? "|" + manga_name_jp : manga_name_jp); let chap_list = []; const push_chap = (selector) => { $(selector).each((_, cur) => { const url = [ window.location.protocol, "//", window.location.host, "/", $(cur).attr("href"), ].join(""); chap_list.push({ number: $(cur).text().padStart(2, "0"), url, }); }); }; let selector = ""; switch (location.hostname.includes("ant")) { case true: selector = ".uk-container ul.uk-switcher .muludiv a.uk-button-default"; break; case false: selector = ".uk-grid-collapse .muludiv a"; break; default: break; } push_chap(selector); return { chap_list, manga_name }; } } const mangadl = new MangaDl(); createSidebar(); createMenu(); manualSelect(); initPB(); function createSidebar() { const html = `
Click here to force save downloaded images.

菜單

`; const css = ` #sidebar-open-btn { --sidebar-diameter: 50px; position: fixed; top: 50%; right: 0%; width: var(--sidebar-diameter); height: var(--sidebar-diameter); font-size: 16px; border-radius: 50%; background-color: #007bff; color: white; border: none; cursor: pointer; z-index: 1000; display: flex; align-items: center; justify-content: center; text-overflow: ellipsis; white-space: nowrap; } #sidebar-open-btn.hidden { display: none; } #uk-sidebar { position: fixed; bottom: 0; right: -100%; width: 30%; max-width: 50%; height: 50%; background-color: white; color: black; padding: 20px; transition: right 0.3s ease; box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5); z-index: 1000; display: flex; flex-direction: column; justify-content: center; align-items: center; } .abort-dialog a { color: #cc0000; cursor: pointer; } #uk-sidebar .abort-dialog { width: 100%; background: rgba(0, 0, 0, 0.75); color: white; padding: 10px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); text-align: center; position: absolute; top: 0; left: 0; border: 1px solid black; opacity: 0; transition: opacity 0.5s ease, bottom 0.5s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100%; } #uk-sidebar:hover .abort-dialog { opacity: 1; } #uk-sidebar .titlebar { font-size: 25px; margin-bottom: auto; margin-top: 50px; } #uk-sidebar .uk-container { margin-top: 10%; flex-grow: 1; } #uk-sidebar.active { right: 0%; } #sidebar-close-btn { position: absolute; top: 40px; right: 20px; font-size: 30px; background: none; border: none; color: black; cursor: pointer; } `; const styles = $("