From 86b64c4f11300779a0a7f5636343984d1d54f3b4 Mon Sep 17 00:00:00 2001 From: klayveR Date: Wed, 26 Sep 2018 01:14:25 +0200 Subject: [PATCH] Flash any icon, no data poe.ninja shows yellow icon, update flashes icon --- src/index.html | 1 - src/modules/gui/gui.js | 12 ++++++++---- src/modules/pricecheck.js | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/index.html b/src/index.html index d8819d3..2e65fda 100644 --- a/src/index.html +++ b/src/index.html @@ -17,7 +17,6 @@
-
diff --git a/src/modules/gui/gui.js b/src/modules/gui/gui.js index b1cb480..2a27a85 100644 --- a/src/modules/gui/gui.js +++ b/src/modules/gui/gui.js @@ -335,13 +335,16 @@ class GUI { /** * Flashes the error icon in the menu bar + * + * @param {string} icon Font awesome icon class */ - static flashErrorIcon() { + static flashIcon(icon = "fas fa-exclamation-circle red") { var statusButton = $(".menu").find("[data-button='status']"); var statusIcon = statusButton.find("i"); + statusButton.stop(true, true); statusIcon.removeClass(); - statusIcon.addClass("fas fa-exclamation-circle red"); + statusIcon.addClass(icon); statusButton.show().delay(1000).fadeOut("slow"); } @@ -355,9 +358,10 @@ class GUI { updateEntry.setId("update-entry"); updateEntry.add(); + GUI.flashIcon("fas fa-box blue"); + $(".entry[data-id='" + updateEntry.getId() + "']").find("[data-entry-link='download']").click(function() { ipcRenderer.send("download-update"); - $(".menu").find("[data-button='download']").show(); updateEntry.setTitle("Downloading v" + info.version + "..."); updateEntry.setText(""); @@ -377,7 +381,7 @@ class GUI { updateEntry.setText("XenonTrade v" + info.version + " has been downloaded. It will be automatically installed after closing XenonTrade.
Install now"); updateEntry.setCloseable(); - $(".menu").find("[data-button='download']").hide(); + GUI.flashIcon("fas fa-download blue"); $(".entry[data-id='" + updateEntry.getId() + "']").find("[data-entry-link='install']").click(function() { ipcRenderer.send("install-update"); diff --git a/src/modules/pricecheck.js b/src/modules/pricecheck.js index edf4236..3e21c74 100644 --- a/src/modules/pricecheck.js +++ b/src/modules/pricecheck.js @@ -23,7 +23,7 @@ class Pricecheck { } else if(itemType !== "Magic" && !ninjaAPI.isUpdating()) { Pricecheck._getNinjaPrice(parser); } else { - GUI.flashErrorIcon(); + GUI.flashIcon("fas fa-exclamation-circle red"); } } } @@ -40,7 +40,7 @@ class Pricecheck { return Pricecheck._handleNinjaPrice(parser, itemArray[0]); }) .catch((error) => { - return GUI.flashErrorIcon(); + return GUI.flashIcon("fas fa-exclamation-circle yellow"); }); } else { new TextEntry("No data", "There's no data for " + config.get("league") + ". You should update before attempting to price check another item.", {icon: "fa-exclamation-triangle yellow", timeout: 10}).add();