From e05b154e21a87a82942ea932fe8e41261ffcc651 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 21 May 2019 13:30:53 +0200 Subject: [PATCH] Show error in popup. --- browser-plugins/webextension/add_uri.html | 1 + browser-plugins/webextension/launch.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/browser-plugins/webextension/add_uri.html b/browser-plugins/webextension/add_uri.html index 2f46fb9..ce42368 100644 --- a/browser-plugins/webextension/add_uri.html +++ b/browser-plugins/webextension/add_uri.html @@ -7,6 +7,7 @@ +
diff --git a/browser-plugins/webextension/launch.js b/browser-plugins/webextension/launch.js index 738d66f..0e68535 100644 --- a/browser-plugins/webextension/launch.js +++ b/browser-plugins/webextension/launch.js @@ -18,11 +18,21 @@ function get_tags() // get tags from text input. } function onResponse(response) { - console.log("Received: " + response); + console.log("Received: " + response); + if (response == "Command successful.") + { + window.close(); + } + else + { + document.getElementById("error").innerHTML = + "" + response + ""; + } + } function onError(error) { - console.log(`Error: ${error}`); + console.log(`Error: ${error}`); } function launch() // Launch wrapper and send tags + URL to stdin. @@ -31,7 +41,6 @@ function launch() // Launch wrapper and send tags + URL to stdin. console.log("Sending: " + arguments + " to remwharead"); var sending = browser.runtime.sendNativeMessage("remwharead", arguments); sending.then(onResponse, onError); - window.close(); }