aboutsummaryrefslogtreecommitdiff
path: root/html/display_panel/content/main_panel.js
diff options
context:
space:
mode:
authorNateN1222 <nathannichols454@gmail.com>2017-08-01 11:10:34 -0500
committerNateN1222 <nathannichols454@gmail.com>2017-08-01 11:10:34 -0500
commit33db5e1fd5f3d94d070ed37f46f370adcdaf1b3b (patch)
tree9945488a99f10cd433a37dfe386b07465cfefd0d /html/display_panel/content/main_panel.js
parenta74bb8ae5e20afa57cbd8bcbffa9420a6281593e (diff)
UI improvements, removed ES6 'for ... of' statements
Diffstat (limited to 'html/display_panel/content/main_panel.js')
-rw-r--r--html/display_panel/content/main_panel.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js
index 2becb4e..44be902 100644
--- a/html/display_panel/content/main_panel.js
+++ b/html/display_panel/content/main_panel.js
@@ -18,6 +18,10 @@ function set_webex(){
}
set_webex();
+
+var myPort = webex.runtime.connect({name:"port-from-cs"});
+var current_blocked_data;
+
/**
* update the HTML of the pop-up window.
* If return_HTML is true, it returns the HTML of the popup window without updating it.
@@ -31,6 +35,7 @@ set_webex();
*
*/
function generate_HTML(blocked_data){
+ current_blocked_data = blocked_data;
var a = blocked_data;
var button_complain = '<a id="complain-contact" class="button white" href="#"><span>Complain to site owner</span></a>';
var button_allow_all = '<a id="allow-button" class="button white" href="#"><span>Allow all scripts in this page</span></a>';
@@ -70,17 +75,21 @@ function generate_HTML(blocked_data){
}
if(a["blocked"].length != 0){
blocked.innerHTML += "</ul>";
+ // add click listeners to the buttons
+ for(var i = 0; i < a["blocked"].length; i++){
+ document.getElementById("wl_"+i).addEventListener("click",function(a){
+ console.log(a.path[0].id + " clicked");
+ var temp = current_blocked_data["blocked"][parseInt(a.path[0].id.substr(3))];
+ console.log(temp);
+ myPort.postMessage({"whitelist_script": temp});
+ });
+ }
}
// At this point, it has the HTML that the popup needs and the only problem is
// getting it into the popup. (browserAction() needs a (local) URL to work).
}
-
-// content-script.js
-
-var myPort = webex.runtime.connect({name:"port-from-cs"});
-
myPort.onMessage.addListener(function(m) {
if(m["show_info"] !== undefined){
generate_HTML(m["show_info"]);