aboutsummaryrefslogtreecommitdiff
path: root/html/preferences_panel
diff options
context:
space:
mode:
authorNateN1222 <nathannichols454@gmail.com>2017-09-09 14:10:26 -0500
committerNateN1222 <nathannichols454@gmail.com>2017-09-09 14:10:26 -0500
commitb975f183fe19250c67b2c8617c2a76f9cdf71548 (patch)
treedd439290a922512211dd82d3c3fab23f05d924a3 /html/preferences_panel
parentd324474467727fa31c76c206acb027acd8925fa1 (diff)
Implemented buttons in context menu, improved options screen, added window to the list of nontrivial objects
Diffstat (limited to 'html/preferences_panel')
-rw-r--r--html/preferences_panel/pref.js24
-rw-r--r--html/preferences_panel/preferences_panel.html6
2 files changed, 27 insertions, 3 deletions
diff --git a/html/preferences_panel/pref.js b/html/preferences_panel/pref.js
index aa88f5d..223165f 100644
--- a/html/preferences_panel/pref.js
+++ b/html/preferences_panel/pref.js
@@ -20,16 +20,31 @@ set_webex();
function storage_got(items){
var inputs = document.getElementsByTagName("input");
+
+ if(items["pref_whitelist"] == "undefined"){
+ items["pref_whitelist"] = "";
+ }
+
+ if(items["pref_subject"] == "undefined" || items["pref_subject"] == ""){
+ items["pref_subject"] = "Issues with Javascript on your website";
+ }
+
+ if(items["pref_body"] == "undefined" || items["pref_body"] == ""){
+ items["pref_body"] = "Please consider using a free license for the Javascript on your website. [Message generated by LibreJS. See https://www.gnu.org/software/librejs/ for more information]";
+ }
+
for(var i = 0; i < inputs.length; i++){
if(inputs[i].id.indexOf("pref_") != -1){
if(inputs[i].type == "checkbox" && items[inputs[i].id]){
inputs[i].checked = true;
}
- if(inputs[i].type == "text"){
+ if(inputs[i].type == "text" && items[inputs[i].id] != undefined){
inputs[i].value = items[inputs[i].id];
}
}
}
+
+
}
webex.storage.local.get(storage_got);
@@ -43,13 +58,18 @@ document.getElementById("save_changes").addEventListener("click", function(){
if(inputs[i].type == "checkbox"){
input_val = inputs[i].checked;
} else{
- input_val = inputs[i].value;
+ if(inputs[i.value] != "undefined"){
+ input_val = inputs[i].value;
+ } else{
+ input_val = "";
+ }
}
var input_id = inputs[i].id;
data[input_id] = input_val;
}
}
console.log(data);
+
webex.storage.local.set(data);
});
diff --git a/html/preferences_panel/preferences_panel.html b/html/preferences_panel/preferences_panel.html
index 5c5a217..2d01f94 100644
--- a/html/preferences_panel/preferences_panel.html
+++ b/html/preferences_panel/preferences_panel.html
@@ -34,9 +34,11 @@
<table>
<tr>
- <td><p>Whitelist domains, seperated by comma (wildcard is *)</p></td>
+ <td><p>Allow all scripts from pages with this text <br> in their URL. (Comma seperated, wildcard is *)</p></td>
<td><input id="pref_whitelist" type="text"></input></td>
</tr>
+ <!--
+
<tr>
<td><p>Display complaint tab on sites where nonfree nontrivial Javascript detected</p></td>
<td><input id="pref_complaint_tab" type="checkbox"></input></td>
@@ -45,6 +47,8 @@
<td><p>Display notifications of the JavaScript code being analyzed by LibreJS</p></td>
<td><input id="pref_notify_analyze" type="checkbox"></input></td>
</tr>
+
+ -->
<tr>
<td><p>Default complaint email subject</p></td>
<td><input id="pref_subject" type="text"></input></td>