Skip to content
Permalink
Browse files

Update SimpleNotification

build for firefox by default
  • Loading branch information...
Glagan committed Aug 7, 2019
1 parent 5e85c05 commit 8b4c164f9b9f14d2c7b63369d1f8c08a4cca8f6d
@@ -29,7 +29,7 @@ let files = {
};

// What browser to bundle for
let browser;
let browser = "firefox";
if (args[0] == "firefox" || args[0] == "f") {
browser = "firefox";
} else if (args[0] == "chrome" || args[0] == "c") {
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "MyMangaDex",
"version": "2.1.5",
"version": "2.1.6",
"author": "Glagan",

"description": "Automatically update your MyAnimeList manga list when reading on MangaDex.",
@@ -241,7 +241,7 @@ <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">
<div class="form-group text-container p-2">
<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">
@@ -64,12 +64,12 @@ class MyMangaDex {
// init and set if it was redirected - redirected often means not in list or not approved
if (data.url.indexOf("login.php") > -1) {
if (CHROME) {
this.notification(NOTIFY.ERROR, "Not logged in", "Login {{here:https://myanimelist.net/login.php}} on MyAnimeList !", this.myAnimeListImage, true);
this.notification(NOTIFY.ERROR, "Not logged in", "Login {{here|https://myanimelist.net/login.php}} on MyAnimeList !", this.myAnimeListImage, true);
} else {
this.notification(NOTIFY.ERROR, "Not logged in",
[
"Login {{here:https://myanimelist.net/login.php}} on MyAnimeList !\r\n",
"If you see this error while logged in, see {{this issue:https://github.com/Glagan/MyMangaDex/issues/5}} on **Github**.",
"Login {{here|https://myanimelist.net/login.php}} on MyAnimeList !\r\n",
"If you see this error while logged in, see {{this issue|https://github.com/Glagan/MyMangaDex/issues/5}} on **Github**.",
].join(""), this.myAnimeListImage, true);
}
this.loggedMyAnimeList = false;
@@ -122,7 +122,7 @@ class MyMangaDex {

if (usePepper) {
if (this.manga.status == 6) {
this.notification(NOTIFY.SUCCESS, "Added to Plan to Read", "**" + this.manga.name + "** has been put in your endless Plan to read list !", "https://mangadex.org/images/manga/" + this.manga.mangaDexId + ".thumb.jpg");
this.notification(NOTIFY.SUCCESS, "Plan to Read", "**" + this.manga.name + "** has been put in your endless Plan to read list !", "https://mangadex.org/images/manga/" + this.manga.mangaDexId + ".thumb.jpg");
} else {
if ("started" in this.manga) {
delete this.manga.started;
@@ -466,7 +466,7 @@ class MyMangaDex {
// Add a "Add to reading list" button
let quickAddReading = this.createQuickButton("Start Reading", 1);
// And a "Plan to read" button
let quickAddPTR = this.createQuickButton("Add to Plan to Read list", 4);
let quickAddPTR = this.createQuickButton("Add to Plan to Read list", 6);
// Append
this.informationsNode.appendChild(quickAddReading);
this.informationsNode.appendChild(document.createTextNode(" "));
@@ -758,12 +758,15 @@ class MyMangaDex {

notification(type, title, text=undefined, image=undefined, sticky=false) {
if (this.options.showNotifications || (type == NOTIFY.ERROR && this.options.showErrors)) {
let data = {
let options = {
position: "bottom-left",
image: image,
sticky: sticky
};
SimpleNotification[type](title, text, data);
SimpleNotification[type]({
title: title,
image: image,
text: text
}, options);
}
}

@@ -65,11 +65,11 @@ async function loadOptions() {
let mmdImage = "https://ramune.nikurasu.org/mymangadex/128.png";
// If there is nothing in the storage, default options
if (data === undefined) {
SimpleNotification.info(
"First time using MyMangaDex",
"It looks like it is your first time using MyMangaDex, for any help go on {{github:https://github.com/Glagan/MyMangaDex}}, and don't forget to look at the settings !",
{sticky: true, position: "bottom-left", image: mmdImage}
);
SimpleNotification.info({
title: "First time using MyMangaDex",
image: mmdImage,
text: "It looks like it is your first time using MyMangaDex, for any help go on {{github|https://github.com/Glagan/MyMangaDex}}, and don't forget to look at the settings !"
}, { sticky: true, position: "bottom-left" });

await storageSet("options", defaultOptions);
return JSON.parse(JSON.stringify(defaultOptions));
@@ -103,11 +103,11 @@ async function loadOptions() {
data.showErrors = defaultOptions.showErrors;
data.version = 1.9;

SimpleNotification.info(
"MyMangaDex as been updated to 1.9",
"You can see the changelog on {{github:https://github.com/Glagan/MyMangaDex}}, new options have been added, you should check them out !",
{sticky: true, position: "bottom-left", image: mmdImage}
);
SimpleNotification.info({
title: "MyMangaDex as been updated to 1.9",
image: mmdImage,
text: "You can see the changelog on {{github|https://github.com/Glagan/MyMangaDex}}, new options have been added, you should check them out !",
}, { sticky: true, position: "bottom-left" });
}

if (data.version < 2.0) {
@@ -119,28 +119,28 @@ async function loadOptions() {
data.token = defaultOptions.token;
data.version = 2.0;

SimpleNotification.info(
"MyMangaDex as been updated to 2.0",
"Online Save as been added, if you wish to use it you need to manually enable it. You can see the changelog on {{github:https://github.com/Glagan/MyMangaDex}}.",
{sticky: true, position: "bottom-left", image: mmdImage}
);
SimpleNotification.info({
title: "MyMangaDex as been updated to 2.0",
image: mmdImage,
text: "Online Save as been added, if you wish to use it you need to manually enable it. You can see the changelog on {{github|https://github.com/Glagan/MyMangaDex}}.",
}, { sticky: true, position: "bottom-left" });
}

if (data.version < 2.1) {
data.updateHistoryPage = defaultOptions.updateHistoryPage; // New options to default
data.historySize = defaultOptions.historySize;
data.version = 2.1;

SimpleNotification.info(
"MyMangaDex as been updated to 2.1",
"Fix for new **MyAnimeList** entries and the {{history:https://mangadex.org/history}} page now display more than your last 10 chapters if you want.\nYou can see the changelog on {{github:https://github.com/Glagan/MyMangaDex}}.",
{ sticky: true, position: "bottom-left", image: mmdImage }
);
SimpleNotification.info(
"Update Information",
"The project is currently *done* and I don't really plan into adding new features.\r\nBut if you have a problem or a suggestion, I can still look into it, open an issue or message me (Github, Discord or {{Reddit:https://old.reddit.com/message/compose?to=Glagan}}).",
{ sticky: true, position: "bottom-left", image: mmdImage }
);
SimpleNotification.info({
title: "MyMangaDex as been updated to 2.1",
image: mmdImage,
text: "Fix for new **MyAnimeList** entries and the {{history|https://mangadex.org/history}} page now display more than your last 10 chapters if you want.\nYou can see the changelog on {{github:https://github.com/Glagan/MyMangaDex}}.",
}, { sticky: true, position: "bottom-left" });
SimpleNotification.info({
title: "Update Information",
image: mmdImage,
text: "If you have a problem or a suggestion, open an issue or message me (Github, Discord or {{Reddit|https://old.reddit.com/message/compose?to=Glagan}}).",
}, { sticky: true, position: "bottom-left" });
}

await storageSet("options", data);
@@ -195,11 +195,11 @@ async function updateLocalStorage(manga, options) {
});
// Show a notification for updated last opened if there is no MyAnimeList id
if (options.showNotifications && manga.myAnimeListId == 0 && manga.currentChapter.chapter > manga.lastMangaDexChapter) {
SimpleNotification.success(
"Manga updated",
manga.name + " last open Chapter as been updated to " + manga.lastMangaDexChapter,
{position: "bottom-left", image: "https://mangadex.org/images/manga/" + manga.mangaDexId + ".thumb.jpg"}
);
SimpleNotification.success({
title: "Manga updated",
image: "https://mangadex.org/images/manga/" + manga.mangaDexId + ".thumb.jpg",
text: manga.name + " last open Chapter as been updated to " + manga.lastMangaDexChapter,
}, { position: "bottom-left" });
}
// Update online
if (options.onlineSave && options.isLoggedIn) {
@@ -240,11 +240,11 @@ async function updateLocalStorage(manga, options) {

if (options.isLoggedIn == false) {
if (options.showErrors) {
SimpleNotification.error(
"Couldn't save Online",
"The Online Service might have a problem, or your credentials has been changed. Go to the options to update it.",
{sticky: true, position: "bottom-left", image: "https://ramune.nikurasu.org/mymangadex/128b.png"}
);
SimpleNotification.error({
title: "Couldn't save Online",
image: "https://ramune.nikurasu.org/mymangadex/128b.png",
text: "The Online Service might have a problem, or your credentials has been changed. Go to the options to update it.",
}, { sticky: true, position: "bottom-left" });
}
await storageSet("options", options);
}

Some generated files are not rendered by default. Learn more.

0 comments on commit 8b4c164

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