diff --git a/browser-plugins/webextension/manifest.json b/browser-plugins/webextension/manifest.json
index 55794a4..eaf19a9 100644
--- a/browser-plugins/webextension/manifest.json
+++ b/browser-plugins/webextension/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "remwharead",
- "version": "0.3.1",
+ "version": "0.4.0",
"description": "Integrates remwharead into your Browser.",
"homepage_url": "https://schlomp.space/tastytea/remwharead",
diff --git a/browser-plugins/webextension/options.js b/browser-plugins/webextension/options.js
index c7aedeb..ab0616d 100644
--- a/browser-plugins/webextension/options.js
+++ b/browser-plugins/webextension/options.js
@@ -9,7 +9,7 @@ function save_options(e)
function restore_options()
{
- var item = browser.storage.sync.get('archive');
+ const item = browser.storage.sync.get('archive');
item.then((res) =>
{
if (res.archive === false)
@@ -24,10 +24,10 @@ function info_commands(commands)
commands.forEach(
function(command)
{
- var element = document.querySelector("#shortcuts");
- var para = document.createElement("p");
+ const element = document.querySelector("#shortcuts");
+ const para = document.createElement("p");
- var text = document.createElement("strong");
+ const text = document.createElement("strong");
text.appendChild(document.createTextNode(command.shortcut + ": "));
para.appendChild(text);
para.appendChild(document.createTextNode(command.description));
@@ -39,5 +39,5 @@ function info_commands(commands)
document.addEventListener('DOMContentLoaded', restore_options);
document.querySelector("#archive").addEventListener("change", save_options);
-var get_commands = browser.commands.getAll();
+const get_commands = browser.commands.getAll();
get_commands.then(info_commands);
diff --git a/browser-plugins/webextension/popup.html b/browser-plugins/webextension/popup.html
index 6527b00..1fac72a 100644
--- a/browser-plugins/webextension/popup.html
+++ b/browser-plugins/webextension/popup.html
@@ -7,8 +7,14 @@
-
-
+
+
+
+
+
diff --git a/browser-plugins/webextension/popup.js b/browser-plugins/webextension/popup.js
index a511b04..2bf347a 100644
--- a/browser-plugins/webextension/popup.js
+++ b/browser-plugins/webextension/popup.js
@@ -1,15 +1,21 @@
-var taburl = "";
-var archive = "";
+let taburl = "";
+
+const txttags = document.getElementById("txttags");
+const chkarchive = document.getElementById("chkarchive");
+const btnadd = document.getElementById("btnadd");
+const msgstatus = document.getElementById("msgstatus");
+const msgerror = document.getElementById("msgerror");
+
function set_taburl(tabs) // Set taburl to URL of current tab.
{
- let tab = tabs[0];
+ const tab = tabs[0];
taburl = tab.url;
}
function get_tags() // get tags from text input.
{
- let tags = txttags.value;
+ const tags = txttags.value;
if (tags != "")
{
return "-t '" + tags + "' ";
@@ -19,12 +25,12 @@ function get_tags() // get tags from text input.
function read_options()
{
- var item = browser.storage.sync.get('archive');
+ const item = browser.storage.sync.get('archive');
item.then((res) =>
{
if (res.archive === false)
{
- archive = "--no-archive ";
+ chkarchive.checked = false;
}
});
}
@@ -55,14 +61,20 @@ function launch(args) // Launch wrapper and send tags + URL to stdin.
msgstatus.textContent = "Launching remwharead…";
msgerror.textContent = "";
console.log("Sending: " + args + " to remwharead");
- var sending = browser.runtime.sendNativeMessage("remwharead", args);
+ const sending = browser.runtime.sendNativeMessage("remwharead", args);
sending.then(onResponse, onError);
}
function add()
{
- var arguments = get_tags() + archive + taburl;
- launch(arguments);
+ let archive = "";
+ if (chkarchive.checked === false)
+ {
+ archive = "--no-archive ";
+ }
+ const args = get_tags() + archive + taburl;
+ console.log(args);
+ launch(args);
}
read_options();
@@ -70,7 +82,7 @@ read_options();
// Call set_taburl() with current tab.
browser.tabs.query({currentWindow: true, active: true}).then(set_taburl);
-btnadd.addEventListener("click", launch);
+btnadd.addEventListener("click", add);
txttags.addEventListener( // Call launch() if enter is hit in text input.
"keyup", event =>
@@ -79,6 +91,6 @@ txttags.addEventListener( // Call launch() if enter is hit in text input.
{
return;
}
- launch();
+ add();
event.preventDefault();
});
diff --git a/src/uri.cpp b/src/uri.cpp
index 7fbead3..802c369 100644
--- a/src/uri.cpp
+++ b/src/uri.cpp
@@ -64,7 +64,7 @@ const html_extract URI::get()
return
{
extract_title(answer),
- extract_description(answer),
+ strip_html(extract_description(answer)),
strip_html(answer)
};
}