diff options
-rw-r--r-- | html/display_panel/content/display-panel.html | 47 | ||||
-rw-r--r-- | html/display_panel/content/main_panel.js | 30 | ||||
-rw-r--r-- | html/display_panel/content/panel-styles.css | 45 | ||||
-rw-r--r-- | main_background.js | 19 |
4 files changed, 78 insertions, 63 deletions
diff --git a/html/display_panel/content/display-panel.html b/html/display_panel/content/display-panel.html index 5f5ed18..79126a0 100644 --- a/html/display_panel/content/display-panel.html +++ b/html/display_panel/content/display-panel.html @@ -9,6 +9,8 @@ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * * Copyright (C) 2011, 2012, 2014 Loic J. Duros + * Copyright (C) 2017, 2018 NateN1222 <nathannichols454@gmail.com> + * Copyright (C) 2018 Ruben Rodriguez <ruben@gnu.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,40 +30,39 @@ </head> <body> - <script src="main_panel.js"></script> - <div style="float:left; display:inline;" class="title-area"> - <div> - <a class="libre" - id="ljs-settings" - href="javascript:void" - title="LibreJS Whitelist Settings"> - <h1 class="libre">LibreJS</h1> - </a> + <script src="main_panel.js"></script> + <div id="header"> + <div class="title-area"> + <div> + <a class="libre" + id="ljs-settings" + href="javascript:void" + title="LibreJS Whitelist Settings"> + <h1 class="libre">LibreJS</h1> + </a> + </div> + <div> + <a target="_blank" href="https://www.gnu.org/software/librejs/" + id="librejs-web-link">gnu.org/software/librejs</a> + </div> + <div> + <strong>LibreJS 7.0</strong> + </div> </div> - <div> - <a target="_blank" href="https://www.gnu.org/software/librejs/" - id="librejs-web-link" - >gnu.org/software/librejs</a> + <div id="buttons" class="title-area"> + <table id="buttons_table"> + </table> </div> - <div> - <strong>LibreJS 7.0 <br><br></strong> - </div> - </div> - <div id="buttons" style="display:inline;" class="title-area"> - <table id="buttons_table" style="width: 80px;"> - </table> - </div> + </div> <div id="info"> <div id="whitelisted"> <h2 class="blocked-js"></h2> <ul class="blocked-js"></ul> </div> - <div id="accepted"> <h2 class="blocked-js"></h2> <ul class="blocked-js"></ul> </div> - <div id="blocked"> <h2 class="blocked-js"></h2> <ul class="blocked-js"></ul> diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js index 899f0d8..7c1170d 100644 --- a/html/display_panel/content/main_panel.js +++ b/html/display_panel/content/main_panel.js @@ -1,5 +1,25 @@ -//TODO: there is a known bug involving "forget preference" not working correctly. + /** + * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. + * * + * Copyright (C) 2017, 2018 NateN1222 <nathannichols454@gmail.com> + * Copyright (C) 2018 Ruben Rodriguez <ruben@gnu.org> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +//TODO: there is a known bug involving "forget preference" not working correctly. /** * @@ -58,9 +78,9 @@ function new_debug_button(name_text,callback){ */ function write_elements(data,name,color){ var url = data["url"]; - var button_html = '<div style="float:right; position: relative;"><input id="temp" type="button" value="blacklist"></input></div><br>'; - var button_html_2 = '<div style="float:right; position: relative;"><input id="temp2" type="button" value="whitelist"></input></div><br>'; - var button_html_3 = '<div style="float:right; position: relative;"><input id="temp3" type="button" value="forget preference"></input></div><br>'; + var button_html = '<div style="float:left;"><input id="temp" type="button" value="blacklist"></input></div>'; + var button_html_2 = '<div style="float:left;"><input id="temp2" type="button" value="whitelist"></input></div>'; + var button_html_3 = '<div style="float:left;"><input id="temp3" type="button" value="forget preference"></input></div>'; var heading = document.getElementById(name).getElementsByTagName("h2")[0]; var list = document.getElementById(name).getElementsByTagName("ul")[0]; if(typeof(data[name]) == "undefined" || data[name].length == 0){ @@ -72,7 +92,7 @@ function write_elements(data,name,color){ } // Iterate over data[name] and generate list for(var i = 0; i < data[name].length; i++){ - list.innerHTML += "<li><b>"+data[name][i][0]+ ":</b><br>" + data[name][i][1]+"\n"+button_html+"<br><br>\n"+button_html_2+"<br><br>\n"+button_html_3+"</li>"; + list.innerHTML += "<li><a href='"+data[name][i][0]+"'><b>"+data[name][i][0]+ "</a>:</b><br>" + data[name][i][1]+"<br>"+button_html+"\n"+button_html_2+"\n"+button_html_3+"</li>"; document.getElementById("temp").id = name+"_"+i; document.getElementById("temp2").id = name+"_2_"+i; document.getElementById("temp3").id = name+"_3_"+i; diff --git a/html/display_panel/content/panel-styles.css b/html/display_panel/content/panel-styles.css index 01d2696..c077a31 100644 --- a/html/display_panel/content/panel-styles.css +++ b/html/display_panel/content/panel-styles.css @@ -18,31 +18,31 @@ * */ html { - padding:10px; + padding:0px; + margin:0px; color:#000 !important; background:url('background-panel.png') !important; } -document { - padding:10px; -} body { - padding:10px; - font-size:67.5%; - overflow-x:hidden; - overflow-y:visible; + padding:0; + margin:10px 30px 10px 20px; color:#000; +width:500px; } + +#header{ +display:block; +width:500px; +} + .libre { width:230px; height:104px; display:block; - margin-bottom: 4px; } h1.libre { font-size:1.5em; font-weight:normal; - font-family:Arial; - margin:-20px 0 0 0; padding:0; font-weight:bold; background:url('librejs-title.png') no-repeat top left; @@ -50,13 +50,12 @@ h1.libre { overflow:hidden; } h2 { - font-size:1.5em; + font-size:1.1em; font-weight:bold; font-family:arial; border-bottom:4px solid #444; padding-bottom:0; - margin:30px 0 0 0; - width:710px; + margin:10px 0 0 0; line-height:140%; } code { @@ -73,7 +72,6 @@ ul.blocked-js li, ul.accepted-js li, ul.dryrun-js li { padding:5px; border-bottom:2px solid #CCC; margin:0; - width:700px; } ul ul { @@ -83,17 +81,10 @@ ul ul { ul.blocked-js ul li, ul.accepted-js ul li, ul.dryrun-js ul li { padding:5px; border-bottom:0; - width:auto; } #info { clear:both; } -.button { - float:right; - padding:10px; - display:none; - margin:10px; -} /* Pure JS button styles below taken from: @@ -105,9 +96,10 @@ ul.blocked-js ul li, ul.accepted-js ul li, ul.dryrun-js ul li { cursor: pointer; text-align: center; text-decoration: none; - font: 10px/100% Arial, Helvetica, sans-serif; - padding: .5em 2em .55em; + font-size: 1 em; border-radius: .5em; + float:right; + padding:10px; } .small.button { font-size:11px; @@ -167,8 +159,9 @@ span.blocked { } .title-area { - width: 230px; - text-align: center; + width: 250px; + float:left !important; + text-align: center !important; } .title-area #librejs-web-link { diff --git a/main_background.js b/main_background.js index b159ff1..8d6052d 100644 --- a/main_background.js +++ b/main_background.js @@ -1,7 +1,8 @@ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * -* Copyright (C) 2017 Nathan Nichols +* Copyright (C) 2017, 2018 Nathan Nichols +* Copyright (C) 2018 Ruben Rodriguez <ruben@gnu.org> * * This file is part of GNU LibreJS. * @@ -814,11 +815,11 @@ function evaluate(script,name){ if(flag){ dbg_print("%c pass","color:green;"); } else{ - return [flag,reason+"<br>"]; + return [flag,reason]; } var final = full_evaluate(temp); - final[1] = final[1] + "<br>"; +// final[1] = final[1] + "<br>"; return final; } @@ -937,9 +938,9 @@ function get_script(response,url,tabid,wl,index=-1){ if(wl == true){ // Accept without reading script, it was explicitly whitelisted if(typeof(unused_data[tabid]["accepted"].push) != "function"){ - unused_data[tabid]["accepted"] = [[scriptname,"Page is whitelisted in preferences"]]; + unused_data[tabid]["accepted"] = [[url,"Page is whitelisted in preferences"]]; } else{ - unused_data[tabid]["accepted"].push([scriptname,"Page is whitelisted in preferences"]); + unused_data[tabid]["accepted"].push([url,"Page is whitelisted in preferences"]); } resolve("\n/*\n LibreJS: Script whitelisted by user (From a URL found in comma seperated whitelist)\n*/\n"+response); if(index != -1){ @@ -967,7 +968,7 @@ function get_script(response,url,tabid,wl,index=-1){ dbg_print("amt. blocked on page:"+badge_str); if(badge_str > 0 || verdict == false){ webex.browserAction.setBadgeText({ - text: "GRR", + text: "!", tabId: tabid }); webex.browserAction.setBadgeBackgroundColor({ @@ -976,7 +977,7 @@ function get_script(response,url,tabid,wl,index=-1){ }); } else{ webex.browserAction.setBadgeText({ - text: "OK", + text: "✓", tabId: tabid }); webex.browserAction.setBadgeBackgroundColor({ @@ -986,9 +987,9 @@ function get_script(response,url,tabid,wl,index=-1){ } if(verdict == true){ - popup_res = add_popup_entry(tabid,src_hash,{"url":domain,"accepted":[scriptname+" ("+src_hash+")",edited[2]]}); + popup_res = add_popup_entry(tabid,src_hash,{"url":domain,"accepted":[url,edited[2]]}); } else{ - popup_res = add_popup_entry(tabid,src_hash,{"url":domain,"blocked":[scriptname+" ("+src_hash+")",edited[2]]}); + popup_res = add_popup_entry(tabid,src_hash,{"url":domain,"blocked":[url,edited[2]]}); } popup_res.then(function(list_verdict){ |