diff options
Diffstat (limited to 'html/display_panel/content')
-rw-r--r-- | html/display_panel/content/README | 21 | ||||
-rw-r--r-- | html/display_panel/content/background-panel.png | bin | 0 -> 14814 bytes | |||
-rw-r--r-- | html/display_panel/content/display-panel.html | 73 | ||||
-rw-r--r-- | html/display_panel/content/librejs-title-old.png | bin | 0 -> 2673 bytes | |||
-rw-r--r-- | html/display_panel/content/librejs-title.png | bin | 0 -> 14123 bytes | |||
-rw-r--r-- | html/display_panel/content/main_panel.js | 96 | ||||
-rw-r--r-- | html/display_panel/content/panel-styles.css | 190 |
7 files changed, 380 insertions, 0 deletions
diff --git a/html/display_panel/content/README b/html/display_panel/content/README new file mode 100644 index 0000000..a56ea46 --- /dev/null +++ b/html/display_panel/content/README @@ -0,0 +1,21 @@ +/** + * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. + * * + * Copyright (C) 2011, 2012, 2014 Loic J. Duros + * + * 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/>. + * + */ + +All images in this directory are free, released under the GPLv3 or later.
\ No newline at end of file diff --git a/html/display_panel/content/background-panel.png b/html/display_panel/content/background-panel.png Binary files differnew file mode 100644 index 0000000..022ffb3 --- /dev/null +++ b/html/display_panel/content/background-panel.png diff --git a/html/display_panel/content/display-panel.html b/html/display_panel/content/display-panel.html new file mode 100644 index 0000000..9ef3eef --- /dev/null +++ b/html/display_panel/content/display-panel.html @@ -0,0 +1,73 @@ +<!doctype html> +<html> +<head> +<meta charset="utf-8"/> +<title>Display JS Monitoring Panel</title> +<link rel="stylesheet" type="text/css" href="./panel-styles.css"/> + +<!-- /** + * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. + * * + * Copyright (C) 2011, 2012, 2014 Loic J. Duros + * + * 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/>. + * + */ +--> +</head> + +<body> + <script src="main_panel.js"></script> + <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 6.0.13</strong> + </div> + </div> + + <div id="info"> + <div id="dryrun"> + <h2 class="dryrun-js"></h2> + <ul class="dryrun-js"></ul> + </div> + + <div id="accepted"> + <h2 class="accepted-js"></h2> + <ul class="accepted-js"></ul> + </div> + + <div id="blocked"> + <h2 class="blocked-js"></h2> + <ul class="blocked-js"> + </div> + + <div id="librejs-web-labels-pages"> + <h2></h2> + <ul></ul> + </div> + </div> +</body> +</html> diff --git a/html/display_panel/content/librejs-title-old.png b/html/display_panel/content/librejs-title-old.png Binary files differnew file mode 100644 index 0000000..8a11527 --- /dev/null +++ b/html/display_panel/content/librejs-title-old.png diff --git a/html/display_panel/content/librejs-title.png b/html/display_panel/content/librejs-title.png Binary files differnew file mode 100644 index 0000000..c1a911c --- /dev/null +++ b/html/display_panel/content/librejs-title.png diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js new file mode 100644 index 0000000..3bcb164 --- /dev/null +++ b/html/display_panel/content/main_panel.js @@ -0,0 +1,96 @@ +/** +* +* Sets global variable "webex" to either "chrome" or "browser" for +* use on Chrome or a Firefox variant. +* +* Change this to support a new browser that isn't Chrome or Firefox, +* given that it supports webExtensions. +* +* (Use the variable "webex" for all API calls after calling this) +*/ +var webex; +function set_webex(){ + if(typeof(browser) == "undefined"){ + webex = chrome; + } else{ + webex = browser; + } +} +set_webex(); + +/** +* update the HTML of the pop-up window. +* If return_HTML is true, it returns the HTML of the popup window without updating it. +* example input: +* +* var example_input = { +* "accepted": [["REASON 1","SOURCE 1"],["REASON 2","SOURCE 2"]], +* "blocked": [["REASON 1","SOURCE 1"],["REASON 2","SOURCE 2"]], +* "url": "example.com" +* } +* +*/ +function generate_HTML(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>'; + var button_block_nonfree = '<a id="disallow-button" class="button white" href="#"><span>Block all nonfree/nontrivial scripts from this page</span></a>'; + var button_new_tab = '<a id="open-in-tab" class="button white" href="#"><span>Open this report in a new tab</span></a>'; + var htmlDoc = document;// Not neccessary + var accept = htmlDoc.getElementById("accepted"); + var blocked = htmlDoc.getElementById("blocked"); + // HTML taken directly from the current LibreJS, display-panel.html + if(a["accepted"].length == 0){ + accept.innerHTML = '<li>LibreJS did not allow the execution of any scripts on this page: \n\n<ul><li>There may be no scripts on this page (check source, C-u)</li><li>The inline and on-page JavaScript code may not be free and/or may not have proper license information and external scripts (if present) may have been removed by default.</li><li>External scripts may not be free and/or may not have proper licensing and are not part of the whitelist of free JavaScript libraries.</li></ul></li>'; + } else{ + accept.innerHTML = ""; + accept.innerHTML = '<h2 class="accepted-js">List of <div style="color: green;">ACCEPTED</div> javascript in '+a["url"]+':</h2>'; + accept.innerHTML += '<ul class="accepted-js">'; + } + // Iterate over a["accepted"] and generate bulleted list + for(var i = 0; i < a["accepted"].length; i++){ + accept.innerHTML += "<li>"; + accept.innerHTML += a["accepted"][i][0] + "<br>" + a["accepted"][i][1]; + accept.innerHTML += "</li>"; + } + if(a["accepted"].length != 0){ + accept.innerHTML += "</ul>"; + } + // HTML taken directly from the current LibreJS, display-panel.html + if(a["blocked"].length == 0){ + blocked.innerHTML += '<li>LibreJS did not block any scripts on this page: \n\n<ul><li>There may be no scripts on this page (check source, C-u).</li><li>All the scripts on this page may be trivial and/or free.</li><li>You may have whitelisted this domain name or url from the preferences (Type about:addons in your location bar to check)</li><li>You may have clicked the "allow all scripts" button, which causes LibreJS to load all JavaScript on a page regardless of whether it is free, trivial, nontrivial or nonfree. This policy is effective for the entire duration of a Firefox session.</li><li>If for any reason you think LibreJS should have blocked JavaScript code on this page, please report this issue to: <a id="report" href="mailto:bug-librejs@gnu.org" target="_blank">bug-librejs@gnu.org</a></li></ul></li>'; + } else{ + blocked.innerHTML = ""; + blocked.innerHTML = "<h2 class='blocked-js'>List of <div style='color: red;'>BLOCKED</div> javascript in" + a["url"]+":</h2>"; + blocked.innerHTML += '<ul class="blocked-js">'; + } + // Iterate over a["blocked"] and generate bulleted list + for(var i = 0; i < a["blocked"].length; i++){ + blocked.innerHTML += "<li>"; + blocked.innerHTML += a["blocked"][i][0]+ "<br>" + a["blocked"][i][1]; + blocked.innerHTML += "</li>"; + } + if(a["blocked"].length != 0){ + blocked.innerHTML += "</ul>"; + } + // 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"]); + } +}); +function onGot(tabInfo) { + myPort.postMessage({"tab_info": tabInfo}); +} +var gettingCurrent = webex.tabs.getCurrent(onGot); + + diff --git a/html/display_panel/content/panel-styles.css b/html/display_panel/content/panel-styles.css new file mode 100644 index 0000000..2e5223b --- /dev/null +++ b/html/display_panel/content/panel-styles.css @@ -0,0 +1,190 @@ +/** + * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. + * * + * Copyright (C) 2011, 2012, 2014 Loic J. Duros + * + * 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/>. + * + */ +html { + padding:10px; + 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; + color:#000; +} + +.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; + text-indent:-1000px; + overflow:hidden; +} +h2 { + font-size:1.5em; + font-weight:bold; + font-family:arial; + border-bottom:4px solid #444; + padding-bottom:0; + margin:30px 0 0 0; + width:710px; + line-height:140%; +} +code { + font-size:1.2em; + margin:0; + padding:0; +} +ul { + margin:0; + padding:0; + list-style:none; +} +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 { + margin:10px; + list-style:disc; +} +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; + clear:both; + margin:10px; +} + +/* + Pure JS button styles below taken from: + http://webdesignerwall.com/tutorials/css3-gradient-buttons + */ +.button { + display: inline-block; + outline: none; + cursor: pointer; + text-align: center; + text-decoration: none; + font: 14px/100% Arial, Helvetica, sans-serif; + padding: .5em 2em .55em; + text-shadow: 0 1px 1px rgba(0,0,0,.3); + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + border-radius: .5em; + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2); + -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2); + box-shadow: 0 1px 2px rgba(0,0,0,.2); +} +.small.button { + font-size:11px; + padding:.5em .5em; + margin-top:10px; +} +.button:hover { + text-decoration: none; +} +.button:active { + position: relative; + top: 1px; +} +.orange { + color: #fef4e9; + border: solid 1px #da7c0c; + background: #f78d1d; + background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20)); + background: -moz-linear-gradient(top, #faa51a, #f47a20); +} +.orange:hover { + background: #f47c20; + background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015)); + background: -moz-linear-gradient(top, #f88e11, #f06015); +} +.orange:active { + color: #fcd3a5; + background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a)); + background: -moz-linear-gradient(top, #f47a20, #faa51a); +} +.white { + background: -moz-linear-gradient(center top , #FFFFFF, #EDEDED) repeat scroll 0 0 transparent; + border: 1px solid #B7B7B7; + /* color: #606060;*/ + color:#9d0d0d; +} +.white:hover { + background: -moz-linear-gradient(center top , #FFFFFF, #DCDCDC) repeat scroll 0 0 transparent; +} +.white:active { + background: -moz-linear-gradient(center top , #EDEDED, #FFFFFF) repeat scroll 0 0 transparent; +/*color: #999999;*/ + +} + +span.accepted, span.blocked { + color:#008e00; + font-size:145%; + font-variant:small-caps; + font-weight:bold; +} +ul.blocked-js li { + overflow:hidden; +} +span.blocked { + color:#8e0000; +} + +.title-area { + width: 230px; + text-align: center; +} + +.title-area #librejs-web-link { + font-size: 18px; +} + +#librejs-web-labels-pages>ul { + margin-top: 8px; + font-size: 14px; + list-style-type: disc; +}
\ No newline at end of file |