Skip to content

Fixes and cosmetic improvements for working with latest MangaDex #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 40 additions & 8 deletions mangadex-downloader.user.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// ==UserScript==
// @name MangaDex Downloader
// @version 2.5
// @version 2.6
// @description A userscript to add download-buttons to mangadex
// @author NO_ob, icelord, eva
// @author hekkun, NO_ob, icelord, eva
// @homepage https://github.com/NO-ob/mangadex-scripts
// @updateURL https://github.com/NO-ob/mangadex-scripts/raw/master/mangadex-downloader.user.js
// @downloadURL https://github.com/NO-ob/mangadex-scripts/raw/master/mangadex-downloader.user.js
// @match https://mangadex.org/*
// @icon https://mangadex.org/favicon.ico
// @require https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.5/jszip.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js
// @grant GM_xmlhttpRequest
// @grant GM.setValue
// @grant GM.getValue
// @namespace https://greasyfork.org/users/821816
// @grant GM_addStyle
// @namespace https://greasyfork.org/users/821816
// @updateURL https://github.com/NO-ob/mangadex-scripts/raw/master/mangadex-downloader.user.js
// @downloadURL https://github.com/NO-ob/mangadex-scripts/raw/master/mangadex-downloader.user.js
// ==/UserScript==
//Required to retrieve iso_codes

Expand Down Expand Up @@ -54,7 +55,38 @@ var language_iso = {
'vi': 'Vietnamese'
};

GM_addStyle (`
.dlButton {
background-color: #242729;
border: 1px solid #596065;
border-radius: 8px;
color: #ffffff;
cursor: pointer;
display: inline-block;
font-family: "Amazon Ember",sans-serif;
font-size: 13px;
line-height: 29px;
padding: 0 10px 0 11px;
position: relative;
text-align: center;
text-decoration: none;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
vertical-align: middle;
margin-left: 4px;
}

.dlButton:hover {
background-color: #747b74;
}

.dlButton:focus {
border-color: #008296;
box-shadow: rgba(213, 217, 217, .5) 0 2px 5px 0;
outline: 0;
}
`);

(function () {
'use strict';
Expand Down Expand Up @@ -92,7 +124,7 @@ function addDynastyDownloadButtons() {
document.querySelectorAll(".chapter-list > dd > a.name").forEach((chapterRow) => {
let chapterID = chapterRow.href.split('/').pop();
let dlButton = document.createElement("button");
let mangaID = document.URL.split('/').pop();
let mangaID = document.URL.split('/')[4];
let mangaHref = chapterRow.href
dlButton.innerHTML = "Download";
dlButton.setAttribute("class", "dlButton");
Expand Down Expand Up @@ -181,7 +213,7 @@ function addDownloadButtons() {
if (chapterRow.href.startsWith("https://mangadex.org/chapter")) {
let chapterID = chapterRow.href.split('/').pop();
let dlButton = document.createElement("button");
let mangaID = document.URL.includes("/title/") ? document.querySelector("a.group.flex.items-start").getAttribute("to").split("/")[2] : chapterRow.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.querySelector("a.chapter-feed__title").href.split("/")[4];
let mangaID = document.URL.split('/')[4];
dlButton.innerHTML = "Download";
dlButton.setAttribute("class", "dlButton");
dlButton.setAttribute("id", "dl-" + chapterID);
Expand Down Expand Up @@ -585,4 +617,4 @@ function printKey(responseText){
}


*/
*/