diff --git a/src/popup.js b/src/popup.js index c935f1d..4cab095 100644 --- a/src/popup.js +++ b/src/popup.js @@ -38,7 +38,7 @@ function popupTasks() { // get all current values and write them to the local storage async function updateSettings(){ // update settings values - settings.fediact_homeinstance = $("input#homeinstance").val().trim() + settings.fediact_homeinstance = $("input#homeinstance").val().trim().toLowerCase() settings.fediact_alert = $("input#alert").is(':checked') settings.fediact_mode = $("select#mode").val() settings.fediact_whitelist = $("textarea#whitelist_content").val() diff --git a/src/popup.min.js b/src/popup.min.js index e6760a9..bd6eaa3 100644 --- a/src/popup.min.js +++ b/src/popup.min.js @@ -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,a;const i=!0,c="[FediAct]";function d(t){i&&console.log(c+" "+t)}function n(){async function i(){a.fediact_homeinstance=$("input#homeinstance").val().trim(),a.fediact_alert=$("input#alert").is(":checked"),a.fediact_mode=$("select#mode").val(),a.fediact_whitelist=$("textarea#whitelist_content").val(),a.fediact_blacklist=$("textarea#blacklist_content").val(),a.fediact_target=$("select#target").val(),a.fediact_autoaction=$("input#autoaction").is(":checked"),a.fediact_redirects=$("input#redirects").is(":checked"),a.fediact_enabledelay=$("input#delay").is(":checked"),a.fediact_hidemuted=$("input#hidemuted").is(":checked"),a.fediact_runifloggedin=$("input#runifloggedin").is(":checked");try{await(browser||chrome).storage.local.set(a)}catch{return d(e),!1}$("span#indicator").show(),setTimeout(function(){$("span#indicator").hide()},1500)}$(document).ready(function(){$("input#homeinstance").val(a.fediact_homeinstance),$("textarea#blacklist_content").val(a.fediact_blacklist),$("textarea#whitelist_content").val(a.fediact_whitelist),$("select#mode").val(a.fediact_mode),$("select#target").val(a.fediact_target),$("input#alert").prop("checked",a.fediact_alert),$("input#autoaction").prop("checked",a.fediact_autoaction),$("input#redirects").prop("checked",a.fediact_redirects),$("input#delay").prop("checked",a.fediact_enabledelay),$("input#hidemuted").prop("checked",a.fediact_hidemuted),$("input#runifloggedin").prop("checked",a.fediact_runifloggedin),("whitelist"==$("select#mode").val()?$("div#whitelist_input"):$("div#blacklist_input")).show(),$("select#mode").change(function(){("whitelist"==$("select#mode").val()?($("div#blacklist_input").hide(),$("div#whitelist_input")):($("div#whitelist_input").hide(),$("div#blacklist_input"))).show()}),$("form#fediact-settings").on("submit",async function(t){t.preventDefault(),i();try{await chrome.runtime.sendMessage({updatedsettings:!0})}catch(t){d(t)}})})}async function l(){try{a=await(browser||chrome).storage.local.get(t)}catch(t){return d(t),!1}a&&n()}l(); \ No newline at end of file +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")).show(),$("select#mode").change(function(){("whitelist"==$("select#mode").val()?($("div#blacklist_input").hide(),$("div#whitelist_input")):($("div#whitelist_input").hide(),$("div#blacklist_input"))).show()}),$("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(); \ No newline at end of file