From 75763122b0f83bf314e6628814ae911df723051c Mon Sep 17 00:00:00 2001 From: Thibault Duval Date: Sun, 30 Sep 2018 18:16:49 +0200 Subject: [PATCH] Version 1.3.0 + Add Firefox compatibility --- Scripts/Class/Bookmarks.js | 18 +++++------------- Scripts/Class/FreeKiss.js | 3 ++- Views/Options.html | 3 --- Views/Patchnotes.html | 6 ++++++ manifest.json | 2 +- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Scripts/Class/Bookmarks.js b/Scripts/Class/Bookmarks.js index 66072ba..933f93d 100644 --- a/Scripts/Class/Bookmarks.js +++ b/Scripts/Class/Bookmarks.js @@ -60,22 +60,14 @@ var Bookmarks = { type: "GET", url: "http://kissmanga.com/BookmarkList", success: (html) => { - html = html.replace(/]*>/g, ""); - // |\r?\n|\r - // (.*)<\/table> gi - // ]*>(.+?)<\/tr> gi - // mid=['"](\w+)['"] i - // href=['"]\/?(.+?)['"] i - // bdid=['"](\w+)['"] i - // ! - // (.+?)<\/a> i - // Completed<\/td> i - //console.log(html); - obj.setBookmarks($(html).find(".listing tr:not(:first-child)")); + // We remove elements making FireFox cry about CSP (onClick, Images and everything beside the .listing table) + html = html.replace(/onClick=['"].+?['"]|]*>|\r?\n|\r/gi, ""); + let table = html.match(/]+class=['"]listing['"].*<\/table>/gi)[0]; + obj.setBookmarks($(table).find("tr:not(:first-child)")); obj.executeCallbacks(); }, error: (req, status, err) => { - console.log("Error " + req.status + " while connecting to bookmarks list: " + err); + console.error("Error " + req.status + " while connecting to bookmarks list: " + err); if (errorCB) { errorCB(req.status); } diff --git a/Scripts/Class/FreeKiss.js b/Scripts/Class/FreeKiss.js index 532e866..6cbdca7 100644 --- a/Scripts/Class/FreeKiss.js +++ b/Scripts/Class/FreeKiss.js @@ -234,7 +234,8 @@ var FreeKiss = { */ updateIcon: function(bookmarks, refreshAlarm) { if (this.Options.get("showUnreadOnIcon") === true) { - chrome.runtime.sendMessage({message: "UpdateIcon", freekiss: this, bookmarks: bookmarks, refreshAlarm: refreshAlarm}); + // NOTE: Objects have to be stripped of their methods or Firefox will refuse to send them... (Instead of, you know, sending them without their methods...) + chrome.runtime.sendMessage({message: "UpdateIcon", freekiss: JSON.parse(JSON.stringify(this)), bookmarks: JSON.parse(JSON.stringify(bookmarks)), refreshAlarm: refreshAlarm}); } } }; diff --git a/Views/Options.html b/Views/Options.html index 10b83f3..e14e30d 100644 --- a/Views/Options.html +++ b/Views/Options.html @@ -51,9 +51,6 @@

Options

-
- This option is a new feature. If you encounter any problem, you can report it on the webstore support page. -
diff --git a/Views/Patchnotes.html b/Views/Patchnotes.html index d54ae71..88e129e 100644 --- a/Views/Patchnotes.html +++ b/Views/Patchnotes.html @@ -23,6 +23,12 @@

Versions


+
+

1.3.0

+
    +
  • Freekiss is now available on Firefox.
  • +
+

1.2.6

    diff --git a/manifest.json b/manifest.json index 106fa8a..686b171 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "FreeKiss", "short_name": "FreeKiss", "description": "Enhance your KissManga experience.", - "version": "1.2.6", + "version": "1.3.0", "icons": { "16": "Images/Icons/icon16.png",