Skip to content
Permalink
Browse files

Fix new entries update on MyAnimeList

  • Loading branch information...
Glagan committed Jul 30, 2019
1 parent 18bf5d2 commit 5e85c05d833c3297d5656d253d473dd9039bb9dc
Showing with 31 additions and 7 deletions.
  1. +9 −4 README.md
  2. +1 −1 manifests/manifest.json
  3. +12 −0 options.html
  4. +1 −0 scripts/defaultOptions.js
  5. +4 −2 scripts/myMangaDex.js
  6. +4 −0 scripts/sharedFunctions.js
@@ -86,12 +86,11 @@ You can disable the option to save all opened chapters, and all of the data can
## Debug installation

You can also install the extension from this repository, but the extension **will** be uninstalled when Firefox is closed and the data **could** be deleted at the same time, Chrome will keep the extension installed.
Before you actually install it, you have to build it, using ``node build <browser>``, ``rimraf``, ``web-ext`` and ``babel-minify`` are required.
Before you actually install it, you have to build it, using ``node build <browser>``, ``rimraf`` and ``web-ext`` are required.

There is 2 parameters you can set:
There is 1 parameter you can set:

1. ``--no-minify`` to skip minifying files, don't forget to use the correct file path
2. ``--no-web-ext`` to skip building the extension with ``web-ext build``
1. ``--no-web-ext`` to skip building the extension with ``web-ext build``

### Firefox

@@ -118,3 +117,9 @@ There is 2 parameters you can set:

* Extension inspired from [MAL-Sync](https://github.com/lolamtisch/MALSync).
* [Import favorites from KissManga to MangaDex](https://old.reddit.com/r/manga/comments/8qebu4/import_kissmanga_bookmarks_to_mangadex/)

## TODO

* Update rating from MangaDex rating
* Fetch /title/id to get informations
* Update only if the manga as a status on MangaDex
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "MyMangaDex",
"version": "2.1.4",
"version": "2.1.5",
"author": "Glagan",

"description": "Automatically update your MyAnimeList manga list when reading on MangaDex.",
@@ -241,6 +241,18 @@ <h1 class="text-container py-2 px-2"><i class="fas fa-file"></i> Chapter page</h
<input data-option="maxChapterSaved" data-type="number" type="number" min="1" max="200" class="form-control" />
</div>
</div>
<div class="form-group text-container p-2 d-none">
<label class="font-weight-bold">Update only if in MangaDex list <a data-default="updateOnlyInList" class="btn btn-sm btn-secondary"><i class="fas fa-trash"></i><span class="d-none d-xl-inline"> Restore default</span></a></label>
<p class="d-none d-xl-block">Update <b>MyAnimeList</b> only if the title have a status on <b>MangaDex</b> (<i>Disable</i> the update <b>MangaDex</b> status option).</p>
<div data-option="updateOnlyInList" data-type="checkbox" class="col px-0 my-auto input-group">
<div class="input-group-prepend">
<button type="button" class="btn btn-success input-prepend col px-2">Enabled</button>
</div>
<div class="input-group-append">
<button type="button" class="btn btn-secondary input-append col px-2 active">Disabled</button>
</div>
</div>
</div>
</div>
</div>
<!-- Export -->
@@ -23,6 +23,7 @@ let defaultOptions = {
saveAllOpened: true,
maxChapterSaved: 100,
updateHistoryPage: false,
updateOnlyInList: false,
historySize: 100,
updateMDList: false,
showTooltips: true,
@@ -86,13 +86,15 @@ class MyMangaDex {
// If the current chapter is higher than the last read one
// Use Math.floor on the current chapter to avoid updating even tough it's the same if this is a sub chapter
let realChapter = Math.floor(this.manga.currentChapter.chapter);
let isHigher = (realChapter > this.manga.lastMyAnimeListChapter);
let isHigher = (realChapter == 0 || realChapter > this.manga.lastMyAnimeListChapter);
if (usePepper && !isHigher && (this.options.saveOnlyHigher || realChapter == this.manga.lastMyAnimeListChapter)) {
this.notification(NOTIFY.INFO, "Not updated", "Last read chapter on MyAnimelist is higher or equal to the current chapter and wasn't updated.", "https://mangadex.org/images/manga/" + this.manga.mangaDexId + ".thumb.jpg");
return;
}

let isNext = (realChapter == this.manga.lastMyAnimeListChapter || (realChapter == this.manga.lastMyAnimeListChapter+1 ||
let isNext = (realChapter == 0 ||
realChapter == this.manga.lastMyAnimeListChapter ||
(realChapter == this.manga.lastMyAnimeListChapter+1 ||
(!this.options.saveOnlyHigher && realChapter == this.manga.lastMyAnimeListChapter-1)));
if (usePepper && this.options.saveOnlyNext && this.manga.lastMyAnimeListChapter > 0 && !isNext) {
this.notification(NOTIFY.INFO, "Not updated", "The current chapter is not the next one and it wasn't updated on MyAnimelist.", "https://mangadex.org/images/manga/" + this.manga.mangaDexId + ".thumb.jpg");
@@ -163,6 +163,10 @@ async function loadOptions() {
data.saveOnlyNext = false;
}

if (data.subVersion < 5) {
data.updateOnlyInList = false;
}

data.subVersion = defaultOptions.subVersion;
}
await storageSet("options", data);

0 comments on commit 5e85c05

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