webextension: Added checkbox to enable/disable archiving to popup.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
91d3059e13
commit
f90883c412
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "remwharead",
|
"name": "remwharead",
|
||||||
"version": "0.3.1",
|
"version": "0.4.0",
|
||||||
|
|
||||||
"description": "Integrates remwharead into your Browser.",
|
"description": "Integrates remwharead into your Browser.",
|
||||||
"homepage_url": "https://schlomp.space/tastytea/remwharead",
|
"homepage_url": "https://schlomp.space/tastytea/remwharead",
|
||||||
|
|
|
@ -7,8 +7,14 @@
|
||||||
<!-- I did not use a form here because I want to display status and
|
<!-- I did not use a form here because I want to display status and
|
||||||
error messages inside the popup. -->
|
error messages inside the popup. -->
|
||||||
<label for="txttags">Tags, comma separated:</label>
|
<label for="txttags">Tags, comma separated:</label>
|
||||||
<input type="text" id="txttags" autofocus>
|
<input type="text" id="txttags" autofocus/>
|
||||||
<input type="button" id="btnadd" value="Add URI">
|
<div>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="chkarchive" value="archive" checked/>
|
||||||
|
Archive
|
||||||
|
</label>
|
||||||
|
<input type="button" id="btnadd" value="Add URI" style="float:right;"/>
|
||||||
|
</div>
|
||||||
<em id="msgstatus"></em>
|
<em id="msgstatus"></em>
|
||||||
<strong id="msgerror"></strong>
|
<strong id="msgerror"></strong>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
let taburl = "";
|
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.
|
function set_taburl(tabs) // Set taburl to URL of current tab.
|
||||||
{
|
{
|
||||||
|
@ -24,7 +30,7 @@ function read_options()
|
||||||
{
|
{
|
||||||
if (res.archive === false)
|
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()
|
function add()
|
||||||
{
|
{
|
||||||
let arguments = get_tags() + archive + taburl;
|
let archive = "";
|
||||||
launch(arguments);
|
if (chkarchive.checked === false)
|
||||||
|
{
|
||||||
|
archive = "--no-archive ";
|
||||||
|
}
|
||||||
|
const args = get_tags() + archive + taburl;
|
||||||
|
console.log(args);
|
||||||
|
launch(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
read_options();
|
read_options();
|
||||||
|
@ -70,7 +82,7 @@ read_options();
|
||||||
// Call set_taburl() with current tab.
|
// Call set_taburl() with current tab.
|
||||||
browser.tabs.query({currentWindow: true, active: true}).then(set_taburl);
|
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.
|
txttags.addEventListener( // Call launch() if enter is hit in text input.
|
||||||
"keyup", event =>
|
"keyup", event =>
|
||||||
|
@ -79,6 +91,6 @@ txttags.addEventListener( // Call launch() if enter is hit in text input.
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
launch();
|
add();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue