add descriptions for deny/allow mode

pull/36/head
lartsch 2022-12-21 06:09:53 -05:00
rodzic 608e336141
commit de4f1ad1dd
3 zmienionych plików z 15 dodań i 2 usunięć

Wyświetl plik

@ -91,7 +91,14 @@
<fieldset>
<h2>Filtered servers</h2>
<div class="row">
<label for="mode">Mode</label>
<label for="mode">Mode
<span class="hide" id="allowlabel">
Only run on the following domains...
</span>
<span class="hide" id="denylabel">
Run on all domains except the following...
</span>
</label>
<select name="mode" id="mode" selected="blacklist">
<option id="blacklist" value="blacklist">Denylist&nbsp;</option>
<option id="whitelist" value="whitelist">Allowlist&nbsp;</option>

Wyświetl plik

@ -76,17 +76,23 @@ function popupTasks() {
// both containers are hidden by default
if ($("select#mode").val() == "whitelist") {
$("div#whitelist_input").removeClass("hide")
$("span#allowlabel").removeClass("hide")
} else {
$("div#blacklist_input").removeClass("hide")
$("span#denylabel").removeClass("hide")
}
// check changes of the select to update whitelist/blacklist input
$("select#mode").change(function() {
if ($("select#mode").val() == "whitelist") {
$("div#blacklist_input").addClass("hide")
$("span#denylabel").addClass("hide")
$("div#whitelist_input").removeClass("hide")
$("span#allowlabel").removeClass("hide")
} else {
$("div#whitelist_input").addClass("hide")
$("span#allowlabel").addClass("hide")
$("div#blacklist_input").removeClass("hide")
$("span#denylabel").removeClass("hide")
}
})
}

2
src/popup.min.js vendored
Wyświetl plik

@ -1 +1 @@
const t={fediact_homeinstance:null,fediact_alert:!1,fediact_mode:"blacklist",fediact_whitelist:null,fediact_blacklist:null,fediact_target:"_self",fediact_autoaction:!0,fediact_redirects:!0,fediact_enabledelay:!0,fediact_hidemuted:!1,fediact_runifloggedin:!1};var browser,chrome,i;const a=!0,c="[FediAct]";function d(e){a&&console.log(c+" "+e)}function n(){async function t(){i.fediact_homeinstance=$("input#homeinstance").val().trim().toLowerCase(),i.fediact_alert=$("input#alert").is(":checked"),i.fediact_mode=$("select#mode").val(),i.fediact_whitelist=$("textarea#whitelist_content").val(),i.fediact_blacklist=$("textarea#blacklist_content").val(),i.fediact_target=$("select#target").val(),i.fediact_autoaction=$("input#autoaction").is(":checked"),i.fediact_redirects=$("input#redirects").is(":checked"),i.fediact_enabledelay=$("input#delay").is(":checked"),i.fediact_hidemuted=$("input#hidemuted").is(":checked"),i.fediact_runifloggedin=$("input#runifloggedin").is(":checked");try{await(browser||chrome).storage.local.set(i)}catch{return d(e),!1}$("span#indicator").show(),setTimeout(function(){$("span#indicator").hide()},1500)}$(document).ready(function(){$("input#homeinstance").val(i.fediact_homeinstance),$("textarea#blacklist_content").val(i.fediact_blacklist),$("textarea#whitelist_content").val(i.fediact_whitelist),$("select#mode").val(i.fediact_mode),$("select#target").val(i.fediact_target),$("input#alert").prop("checked",i.fediact_alert),$("input#autoaction").prop("checked",i.fediact_autoaction),$("input#redirects").prop("checked",i.fediact_redirects),$("input#delay").prop("checked",i.fediact_enabledelay),$("input#hidemuted").prop("checked",i.fediact_hidemuted),$("input#runifloggedin").prop("checked",i.fediact_runifloggedin),("whitelist"==$("select#mode").val()?$("div#whitelist_input"):$("div#blacklist_input")).removeClass("hide"),$("select#mode").change(function(){("whitelist"==$("select#mode").val()?($("div#blacklist_input").addClass("hide"),$("div#whitelist_input")):($("div#whitelist_input").addClass("hide"),$("div#blacklist_input"))).removeClass("hide")}),$("form#fediact-settings").on("submit",async function(e){e.preventDefault(),t();try{await chrome.runtime.sendMessage({updatedsettings:!0})}catch(e){d(e)}})})}async function l(){try{i=await(browser||chrome).storage.local.get(t)}catch(e){return d(e),!1}i&&n()}l();
const t={fediact_homeinstance:null,fediact_alert:!1,fediact_mode:"blacklist",fediact_whitelist:null,fediact_blacklist:null,fediact_target:"_self",fediact_autoaction:!0,fediact_redirects:!0,fediact_enabledelay:!0,fediact_hidemuted:!1,fediact_runifloggedin:!1};var browser,chrome,i;const a=!0,c="[FediAct]";function d(e){a&&console.log(c+" "+e)}function l(){async function t(){i.fediact_homeinstance=$("input#homeinstance").val().trim().toLowerCase(),i.fediact_alert=$("input#alert").is(":checked"),i.fediact_mode=$("select#mode").val(),i.fediact_whitelist=$("textarea#whitelist_content").val(),i.fediact_blacklist=$("textarea#blacklist_content").val(),i.fediact_target=$("select#target").val(),i.fediact_autoaction=$("input#autoaction").is(":checked"),i.fediact_redirects=$("input#redirects").is(":checked"),i.fediact_enabledelay=$("input#delay").is(":checked"),i.fediact_hidemuted=$("input#hidemuted").is(":checked"),i.fediact_runifloggedin=$("input#runifloggedin").is(":checked");try{await(browser||chrome).storage.local.set(i)}catch{return d(e),!1}$("span#indicator").show(),setTimeout(function(){$("span#indicator").hide()},1500)}$(document).ready(function(){$("input#homeinstance").val(i.fediact_homeinstance),$("textarea#blacklist_content").val(i.fediact_blacklist),$("textarea#whitelist_content").val(i.fediact_whitelist),$("select#mode").val(i.fediact_mode),$("select#target").val(i.fediact_target),$("input#alert").prop("checked",i.fediact_alert),$("input#autoaction").prop("checked",i.fediact_autoaction),$("input#redirects").prop("checked",i.fediact_redirects),$("input#delay").prop("checked",i.fediact_enabledelay),$("input#hidemuted").prop("checked",i.fediact_hidemuted),$("input#runifloggedin").prop("checked",i.fediact_runifloggedin),("whitelist"==$("select#mode").val()?($("div#whitelist_input").removeClass("hide"),$("span#allowlabel")):($("div#blacklist_input").removeClass("hide"),$("span#denylabel"))).removeClass("hide"),$("select#mode").change(function(){("whitelist"==$("select#mode").val()?($("div#blacklist_input").addClass("hide"),$("span#denylabel").addClass("hide"),$("div#whitelist_input").removeClass("hide"),$("span#allowlabel")):($("div#whitelist_input").addClass("hide"),$("span#allowlabel").addClass("hide"),$("div#blacklist_input").removeClass("hide"),$("span#denylabel"))).removeClass("hide")}),$("form#fediact-settings").on("submit",async function(e){e.preventDefault(),t();try{await chrome.runtime.sendMessage({updatedsettings:!0})}catch(e){d(e)}})})}async function n(){try{i=await(browser||chrome).storage.local.get(t)}catch(e){return d(e),!1}i&&l()}n();