Show error in popup.

This commit is contained in:
tastytea 2019-05-21 13:30:53 +02:00
parent de5d65d32a
commit e05b154e21
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 13 additions and 3 deletions

View File

@ -7,6 +7,7 @@
<label for="tags">Tags, comma separated:</label>
<input type="text" id="tags" autofocus>
<input type="button" id="button" value="Add URI">
<div id="error"></div>
<script src="launch.js"></script>
</body>

View File

@ -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 =
"<strong>" + response + "</strong>";
}
}
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();
}