From 102e411ccfc62fefe6205a2b54f67da64b29f878 Mon Sep 17 00:00:00 2001 From: NateN1222 Date: Wed, 30 Aug 2017 13:57:57 -0500 Subject: Made the blacklist/whitelist/forget preference buttons in the GUI work --- html/display_panel/content/main_panel.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'html/display_panel') diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js index a0877a3..fbdd047 100644 --- a/html/display_panel/content/main_panel.js +++ b/html/display_panel/content/main_panel.js @@ -82,20 +82,20 @@ function write_elements(data,name,color){ for(var i = 0; i < data[name].length; i++){ // Make sure this causes generate_html to get called again with updated data document.getElementById(name+"_"+i).addEventListener("click",function(info){ - var temp = current_blocked_data[name][parseInt(info.path[0].id.match(/\d/g)[0])]; + var temp = current_blocked_data[name][parseInt(info.target.id.match(/\d/g)[0])]; console.log("Moving script " + temp[0] + " to blacklist"); var script_name = this.parentElement.parentElement.parentElement.parentElement.id; myPort.postMessage({"blacklist": temp}); }); document.getElementById(name+"_2_"+i).addEventListener("click",function(info){ - var temp = current_blocked_data[name][parseInt(info.path[0].id.match(/\d/g)[1])]; + var temp = current_blocked_data[name][parseInt(info.target.id.match(/\d+/g)[1])]; console.log("Moving script " + temp[0] + " to whitelist"); var script_name = this.parentElement.parentElement.parentElement.parentElement.id; myPort.postMessage({"whitelist": temp}); }); document.getElementById(name+"_3_"+i).addEventListener("click",function(info){ - var temp = current_blocked_data[name][parseInt(info.path[0].id.match(/\d/g)[1])]; + var temp = current_blocked_data[name][parseInt(info.target.id.match(/\d/g)[1])]; console.log("Forget preferences for script " + temp[0]); var script_name = this.parentElement.parentElement.parentElement.parentElement.id; if(this.parentElement.parentElement.innerHTML.indexOf("Refresh the page") == -1){ -- cgit v1.2.3