From 59ec3f6d6d3b1362cd9cadc94beb929f3718ba5c Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 11 Jun 2019 01:24:11 +0200 Subject: [PATCH 1/3] Remove HTML from descriptions. --- src/uri.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) }; } From 91d3059e137bdefb48fe694a555e141b26781b38 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 15 Jun 2019 00:24:48 +0200 Subject: [PATCH 2/3] webextension: Replaced var with const and let. --- browser-plugins/webextension/options.js | 10 +++++----- browser-plugins/webextension/popup.js | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) 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.js b/browser-plugins/webextension/popup.js index a511b04..c3c5db5 100644 --- a/browser-plugins/webextension/popup.js +++ b/browser-plugins/webextension/popup.js @@ -1,15 +1,15 @@ -var taburl = ""; -var archive = ""; +let taburl = ""; +let archive = ""; 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,7 +19,7 @@ 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) @@ -55,13 +55,13 @@ 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; + let arguments = get_tags() + archive + taburl; launch(arguments); } From f90883c412ab71cbf12fc03497d9a73f3cd241b6 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 15 Jun 2019 00:45:26 +0200 Subject: [PATCH 3/3] webextension: Added checkbox to enable/disable archiving to popup. --- browser-plugins/webextension/manifest.json | 2 +- browser-plugins/webextension/popup.html | 10 +++++++-- browser-plugins/webextension/popup.js | 24 ++++++++++++++++------ 3 files changed, 27 insertions(+), 9 deletions(-) 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/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 c3c5db5..2bf347a 100644 --- a/browser-plugins/webextension/popup.js +++ b/browser-plugins/webextension/popup.js @@ -1,5 +1,11 @@ let taburl = ""; -let archive = ""; + +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. { @@ -24,7 +30,7 @@ function read_options() { if (res.archive === false) { - archive = "--no-archive "; + chkarchive.checked = false; } }); } @@ -61,8 +67,14 @@ function launch(args) // Launch wrapper and send tags + URL to stdin. function add() { - let 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(); });