Skip to content
Permalink
Browse files

Fix hiding first row with a chapter lower than another

Build.js keep folders for each browser instead of deleting them
  • Loading branch information...
Glagan committed Oct 24, 2018
1 parent ca6ebe5 commit 285943ce3890a9bfadf0712751fd632aae5e0ee1
Showing with 25 additions and 21 deletions.
  1. +4 −0 .gitignore
  2. +11 −13 build.js
  3. +1 −1 manifests/firefox.json
  4. +1 −1 manifests/manifest.json
  5. +1 −1 scripts/minified/myMangaDex.js
  6. +7 −5 scripts/myMangaDex.js
@@ -8,3 +8,7 @@ web-ext-artifacts

# File save
export.json

# Build
firefoxBuild
chromeBuild
@@ -77,7 +77,11 @@ function deepFileCopy(files, destFolder, baseFolder="") {
if (["firefox", "chrome"].includes(browser)) {
// Create temp folder for the bundle
console.log("Creating temp directory");
fs.mkdirSync("makeBundle");
let makeFolder = browser + "Build";
if (fs.existsSync(makeFolder)) {
rimraf.sync(makeFolder);
}
fs.mkdirSync(makeFolder);

// Merge manifests
console.log("Merging manifests");
@@ -86,9 +90,10 @@ if (["firefox", "chrome"].includes(browser)) {
let browserManifest = fs.readFileSync("manifests/" + browser + ".json");
browserManifest = JSON.parse(browserManifest);
deepMerge(mainManifest, browserManifest);
console.log("Building version %s", mainManifest.version);

// Write new manifest
let bundleManifestStream = fs.createWriteStream("makeBundle/manifest.json", {flags: "w+"});
let bundleManifestStream = fs.createWriteStream(makeFolder + "/manifest.json", {flags: "w+"});
bundleManifestStream.write(JSON.stringify(mainManifest));
bundleManifestStream.cork();
bundleManifestStream.end();
@@ -99,10 +104,9 @@ if (["firefox", "chrome"].includes(browser)) {

// Copy files
console.log("Copying files");
deepFileCopy(files, "makeBundle/", "");
deepFileCopy(files, makeFolder + "/", "");

console.log("Building version %s", mainManifest.version);
exec("web-ext build", {cwd: "makeBundle"}, (error, stdout, stderr) => {
exec("web-ext build", {cwd: makeFolder}, (error, stdout, stderr) => {
if (error) {
console.error(`Build error: ${error}`);
return;
@@ -111,14 +115,8 @@ if (["firefox", "chrome"].includes(browser)) {
if (!fs.existsSync("builds")) {
fs.mkdirSync("builds");
}
fs.renameSync("makeBundle/web-ext-artifacts/mymangadex-" + mainManifest.version + ".zip", "builds/mymangadex-" + mainManifest.version + "_" + browser + ".zip");

console.log("Deleting temp directory");
if (browser == "chrome") {
fs.renameSync("makeBundle", "ChromeTempBuild");
} else {
rimraf.sync("makeBundle");
}
console.log("Moving zip archive to 'builds'");
fs.renameSync(makeFolder + "/web-ext-artifacts/mymangadex-" + mainManifest.version + ".zip", "builds/mymangadex-" + mainManifest.version + "_" + browser + ".zip");

console.log("Done");
});
@@ -2,7 +2,7 @@
"applications": {
"gecko": {
"id": "mymangadex@glagan",
"strict_min_version": "59.0"
"strict_min_version": "61.0"
}
},

@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "MyMangaDex",
"version": "1.9.2",
"version": "1.9.3",
"author": "Glagan",

"description": "Automatically update your MyAnimeList manga list when reading on MangaDex.",

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -862,7 +862,8 @@ class MyMangaDex {
});
}
} else {
let higherThanLast = false;
let sawLastChapter = false;
let sawHigher = false;

// It's a multiple row list - we delete the old ones if needed
for (let chapter in chapters) {
@@ -871,24 +872,25 @@ class MyMangaDex {

// We delete the row if it's lower and one first - or first but all are lower
if (currentChapter > manga.last && this.options.highlightChapters) {
if (higherThanLast) {
if (sawLastChapter) {
currentRow.firstElementChild.style.backgroundColor = paintColor;
}
sawHigher = true;
currentRow.lastElementChild.firstElementChild.addEventListener("auxclick", () => {
currentRow.style.backgroundColor = paintColor;
});
} else if (currentChapter < manga.last) {
if (higherThanLast && chapter == 0) {
if (sawLastChapter && this.options.highlightChapters) {
currentRow.firstElementChild.style.backgroundColor = paintColor;
} else {
} else if (!sawHigher || (sawHigher && chapter < chapters.length-1)) {
if (this.options.hideLowerChapters) {
currentRow.parentElement.removeChild(currentRow);
} else if (this.options.highlightChapters) {
currentRow.style.backgroundColor = this.options.lowerChaptersColor;
}
}
} else if (currentChapter == manga.last) {
higherThanLast = true;
sawLastChapter = true;
if (this.options.highlightChapters) {
currentRow.style.backgroundColor = paintColor;
}

0 comments on commit 285943c

Please sign in to comment.
You can’t perform that action at this time.