From e8a19736d3608e49b9f9ffadac5ea022f888f9d1 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 14 Jan 2014 01:32:05 -0700 Subject: [PATCH] Better. --- builds/appchan-x.user.js | 7 +++++-- builds/crx/script.js | 7 +++++-- src/Theming/Mascots.coffee | 9 ++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 3f256713a..664216875 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -13337,13 +13337,16 @@ } if (name = mascots["Mascot"]) { MascotTools.parse(mascot); - } else { + message = "" + name + " successfully imported!"; + } else if (mascots.length) { for (_i = 0, _len = mascots.length; _i < _len; _i++) { mascot = mascots[_i]; MascotTools.parse(mascot); } + message = "Mascots imported!"; + } else { + return new Notice('warning', "Failed to import mascot. Is file a properly formatted JSON file?", 5); } - message = mascots.length ? "Mascots imported!" : "" + name + " successfully imported!"; new Notice('info', message, 10); $.rm($("#mascotContainer", d.body)); return Settings.open('Mascots'); diff --git a/builds/crx/script.js b/builds/crx/script.js index eb005cf15..8df081331 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -13326,13 +13326,16 @@ } if (name = mascots["Mascot"]) { MascotTools.parse(mascot); - } else { + message = "" + name + " successfully imported!"; + } else if (mascots.length) { for (_i = 0, _len = mascots.length; _i < _len; _i++) { mascot = mascots[_i]; MascotTools.parse(mascot); } + message = "Mascots imported!"; + } else { + return new Notice('warning', "Failed to import mascot. Is file a properly formatted JSON file?", 5); } - message = mascots.length ? "Mascots imported!" : "" + name + " successfully imported!"; new Notice('info', message, 10); $.rm($("#mascotContainer", d.body)); return Settings.open('Mascots'); diff --git a/src/Theming/Mascots.coffee b/src/Theming/Mascots.coffee index 94b8fe76b..20caaf8ab 100644 --- a/src/Theming/Mascots.coffee +++ b/src/Theming/Mascots.coffee @@ -346,13 +346,12 @@ MascotTools = if name = mascots["Mascot"] MascotTools.parse mascot - else + message = "#{name} successfully imported!" + else if mascots.length MascotTools.parse mascot for mascot in mascots - - message = if mascots.length - "Mascots imported!" + message = "Mascots imported!" else - "#{name} successfully imported!" + return new Notice 'warning', "Failed to import mascot. Is file a properly formatted JSON file?", 5 new Notice 'info', message, 10