summaryrefslogtreecommitdiff
path: root/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel
diff options
context:
space:
mode:
Diffstat (limited to 'data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel')
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/display-panel.html113
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/main_panel.js231
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/panel-styles.css182
3 files changed, 0 insertions, 526 deletions
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/display-panel.html b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/display-panel.html
deleted file mode 100644
index 7d1fdf5..0000000
--- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/display-panel.html
+++ /dev/null
@@ -1,113 +0,0 @@
-<!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
- * Copyright (C) 2017, 2018 NateN1222 <nathannichols454@gmail.com>
- * Copyright (C) 2018 Ruben Rodriguez <ruben@gnu.org>
- * Copyright (C) 2018 Giorgio Maone <giorgio@maone.net>
- *
- * 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/>.
- *
- */
--->
-<script src="/html/mobile.js"></script>
-</head>
-
-<body>
- <div id="header">
- <div class="title-area">
- <div>
- <a class="libre"
- id="ljs-settings"
- href= href="https://www.gnu.org/software/librejs/"
- title="LibreJS Page Settings">
- <h1 class="libre">LibreJS</h1>
- </a>
- </div>
- </div>
- <div id="buttons" class="title-area">
- <div>
- <a target="_blank" href="https://www.gnu.org/software/librejs/"
- id="librejs-web-link">gnu.org/software/librejs</a>
- </div>
- <div>
- <strong>LibreJS <span id="version"></span></strong>
- </div>
- <button id="complain">Complain to site owner</button>
- <button id="report-tab">Show this report in a new tab</button>
- <button id="open-options">Settings...</button>
- <button id="autotest">Automated self test...</button>
- </div>
- </div>
- <div id="info">
- <div id="site">
- <h2 class="site">This whole site <span></span></h2>
- <div class="status"></div>
- <div class="buttons">
- <button class="whitelist" name="*">Whitelist</button>
- <button class="blacklist" name="*">Blacklist</button>
- <button class="forget" name="*">Forget</button>
- <button id="reload" class="reload">Reload</button>
- </div>
- </div>
- <div id="unknown" class="unknown-js">
- <h2></h2>
- <p id="must-reload">
- LibreJS will decide whether blocking these scripts next time this page is loaded. <button class="reload" id="reload-now">Reload it now</button>
- </p>
- <ul>
- <li id="li-template">
- <button class="toggle-source show" title="Show code inline">Show</button>
- <button class="toggle-source hide" title="Hide code inline">Hide</button>
- <a class="script-url" href="#" target="librejs_viewsource"></a>:
- <pre class="source"></pre>
- <p class="reason"></p>
- <div class="buttons">
- <button class="whitelist">Whitelist</button>
- <button class="blacklist">Blacklist</button>
- <button class="forget">Forget</button>
- <button class="forget" name="*">Forget <span class="domain"></span></button>
- </div>
-
- </li>
- </ul>
- </div>
- <div id="whitelisted" class="accepted-js">
- <h2></h2>
- <ul></ul>
- </div>
- <div id="accepted" class="accepted-js">
- <h2></h2>
- <ul></ul>
- </div>
- <div id="blocked" class="blocked-js">
- <h2></h2>
- <ul></ul>
- </div>
- <div id="blacklisted" class="blocked-js">
- <h2></h2>
- <ul></ul>
- </div>
- </div>
-</body>
-<script src="/common/Test.js"></script>
-<script src="main_panel.js"></script>
-</html>
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/main_panel.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/main_panel.js
deleted file mode 100644
index 7a5e2c3..0000000
--- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/main_panel.js
+++ /dev/null
@@ -1,231 +0,0 @@
-/**
-* 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>
-* Copyright (C) 2018 Giorgio Maone <giorgio@maone.net>
-*
-* 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/>.
-*
-*/
-
-var fromTab = window.location.hash.match(/^#fromTab=(\d+)/) && RegExp.$1;
-if (fromTab) {
- let browserStyle = document.createElement("link");
- browserStyle.rel = "stylesheet";
- browserStyle.href = "chrome://browser/content/extension.css";
- document.head.appendChild(browserStyle);
- document.documentElement.classList.add("tab");
-}
-
-var myPort = browser.runtime.connect({ name: "port-from-cs" });
-var currentReport;
-
-// Sends a message that tells the background script the window is open
-myPort.postMessage({ "update": true, tabId: parseInt(currentReport && currentReport.tabId || fromTab) || "" });
-
-// Display the actual extension version Number
-document.querySelector("#version").textContent = browser.runtime.getManifest().version;
-
-// Enable autotest button if this is a test-enabled build / session
-(async () => {
- if (await Test.getURL()) {
- let button = document.querySelector("#autotest");
- button.style.display = "block";
- button.onclick = async () => {
- await Test.getTab(true);
- close();
- }
- }
-})();
-
-var liTemplate = document.querySelector("#li-template");
-liTemplate.remove();
-
-document.querySelector("#info").addEventListener("click", e => {
- let button = e.target;
- if (button.tagName === "A") {
- setTimeout(close, 100);
- return;
- }
- if (button.tagName !== "BUTTON") button = button.closest("button");
- if (button.matches(".toggle-source")) {
- let parent = button.parentNode;
- if (!parent.querySelector(".source").textContent) {
- parent.querySelector("a").click();
- } else {
- parent.classList.toggle("visible");
- }
- return;
- }
- if (!button.matches(".buttons > button")) return;
- let domain = button.querySelector(".domain");
-
- let li = button.closest("li");
- let entry = li && li._scriptEntry || [currentReport.url, "Page's site"];
- let action = button.className;
- let site = domain ? domain.textContent : button.name === "*" ? currentReport.site : "";
-
- if (site) {
- ([action] = action.split("-"));
- }
- myPort.postMessage({ [action]: entry, site, tabId: currentReport.tabId });
-});
-
-document.querySelector("#report-tab").onclick = e => {
- myPort.postMessage({ report_tab: currentReport });
- close();
-}
-
-document.querySelector("#complain").onclick = e => {
- myPort.postMessage({ invoke_contact_finder: currentReport });
- close();
-}
-
-document.querySelector("#open-options").onclick = e => {
- browser.runtime.openOptionsPage();
- close();
-}
-
-document.body.addEventListener("click", async e => {
- if (!e.target.matches(".reload")) return;
- let { tabId } = currentReport;
- if (tabId) {
- await browser.tabs.reload(tabId);
- myPort.postMessage({ "update": true, tabId });
- }
-});
-
-/*
-* Takes in the [[file_id, reason],...] array and the group name for one group
-* of scripts found in this tab, rendering it as a list with management buttons.
-* Groups are "unknown", "blacklisted", "whitelisted", "accepted", and "blocked".
-*/
-function createList(data, group) {
- var { url } = data;
- let entries = data[group];
- let container = document.getElementById(group);
- let heading = container.querySelector("h2");
- var list = container.querySelector("ul");
- list.classList.toggle(group, true);
- if (Array.isArray(entries) && entries.length) {
- heading.innerHTML = `<span class="type-name">${group}</span> scripts in ${url}:`;
- container.classList.remove("empty");
- } else {
- // default message
- list.innerHTML = `<li>No <span class="type-name">${group}</span> scripts on this page.</li>`
- entries = data[group] = [];
- container.classList.add("empty");
- }
- // generate list
- let viewSourceToHuman = /^view-source:(.*)#line(\d+)\(([^)]*)\)[^]*/;
- for (let entry of entries) {
- let [scriptId, reason] = entry;
- let li = liTemplate.cloneNode(true);
- let a = li.querySelector("a");
- a.href = scriptId.split("(")[0];
- if (scriptId.startsWith("view-source:")) {
- a.target = "LibreJS-ViewSource";
- let source = scriptId.match(/\n([^]*)/);
- if (source) {
- li.querySelector(".source").textContent = source[1];
- li.querySelector(".toggle-source").style.display = "inline";
- }
- scriptId = scriptId.replace(viewSourceToHuman, "$3 at line $2 of $1");
- }
- a.textContent = scriptId;
- li.querySelector(".reason").textContent = reason;
- let bySite = !!reason.match(/https?:\/\/[^/]+\/\*/);
- li.classList.toggle("by-site", bySite);
- if (bySite) {
- let domain = li.querySelector(".forget .domain");
- if (domain) domain.textContent = RegExp.lastMatch;
- }
- li._scriptEntry = entry;
- list.appendChild(li);
- }
-
-}
-
-/**
-* Updates scripts lists and buttons to act on them.
-* If return_HTML is true, it returns the HTML of the popup window without updating it.
-* example report argument:
-* {
-* "accepted": [["FILENAME 1","REASON 1"],["FILENAME 2","REASON 2"]],
-* "blocked": [["FILENAME 1","REASON 1"],["FILENAME 2","REASON 2"]],
-* "whitelisted": [["FILENAME 1","REASON 1"],["FILENAME 2","REASON 2"]],
-* "blacklisted": [["FILENAME 1","REASON 1"],["FILENAME 2","REASON 2"]],
-* "unknown": [["FILENAME 1","REASON 1"],["FILENAME 2","REASON 2"]],
-* "url":"example.com"
-* };
-*
-*/
-function refreshUI(report) {
- currentReport = report;
- let { siteStatus, listedSite } = report;
- document.querySelector("#site").className = siteStatus || "";
- document.querySelector("#site h2").textContent =
- `This site ${report.site}`;
-
- for (let toBeErased of document.querySelectorAll("#info h2:not(.site) > *, #info ul > *")) {
- toBeErased.remove();
- }
-
- let scriptsCount = 0;
- for (let group of ["unknown", "accepted", "whitelisted", "blocked", "blacklisted"]) {
- if (group in report) createList(report, group);
- scriptsCount += report[group].length;
- }
-
- for (let b of document.querySelectorAll(`.forget, .whitelist, .blacklist`)) {
- b.disabled = false;
- }
- for (let b of document.querySelectorAll(
- `.unknown .forget, .accepted .forget, .blocked .forget,
- .whitelisted .whitelist, .blacklisted .blacklist`
- )) {
- b.disabled = true;
- }
-
- if (siteStatus && siteStatus !== "unknown") {
- let siteContainer = document.querySelector("#site");
- let statusLabel = siteStatus;
- if (listedSite && listedSite !== report.site) {
- statusLabel += ` via ${listedSite}`;
- siteContainer.querySelector(".forget").disabled = true;
- }
- let status = siteContainer.querySelector(".status");
- status.classList.add(siteStatus);
- status.textContent = statusLabel;
- } else {
- document.querySelector("#site .status").textContent = "";
- }
-
- let noscript = scriptsCount === 0;
- document.body.classList.toggle("empty", noscript);
-}
-
-myPort.onMessage.addListener(m => {
- if (m.show_info) {
- refreshUI(m.show_info);
- }
-});
-
-function print_local_storage() {
- myPort.postMessage({ "printlocalstorage": true });
-}
-function delete_local_storage() {
- myPort.postMessage({ "deletelocalstorage": true });
-}
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/panel-styles.css b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/panel-styles.css
deleted file mode 100644
index fefd668..0000000
--- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/html/display_panel/content/panel-styles.css
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * 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/>.
- *
- */
-@import url("/html/common.css");
-
-body {
- max-width: 600px;
- min-width: 500px;
- -moz-user-select: text !important;
-}
-#header{
-display: block;
-width: 100%
-}
-
-h2 {
- font-size: 1.4em;
- font-weight:bold;
- font-family:arial;
- border-bottom:.2em solid #444;
- padding-bottom:0;
- margin:.8em 0 0 0;
- line-height:140%;
-}
-code {
- font-size: 1.2em;
- margin:0;
- padding:0;
-}
-ul {
- margin:0;
- padding:0;
- list-style:none;
-}
-#info li {
- padding: .3em;
- border-bottom:.1em solid #CCC;
- margin:0;
- overflow: hidden;
-}
-
-#info ul ul {
- margin: .4em;
- list-style:disc;
-}
-#info ul ul li {
- padding: .5em;
- border-bottom:0;
-}
-#info {
- clear:both;
-}
-
-#info .type-name {
- text-transform: uppercase;
- font-weight: bold;
-}
-
-#info .accepted-js .type-name {
- color: #080;
-}
-
-#info .blocked-js .type-name {
- color: #800;
-}
-
-#info .unknown-js .type-name {
- color: #008;
-}
-
-#info .unknown-js .reason {
- display: none;
-}
-
-.by-site button.forget, button.forget[name="*"] {
- display: none;
-}
-
-.by-site button.forget[name="*"], #site .forget[name="*"] {
- display: initial;
-}
-
-.status {
- margin: .2em;
-}
-
-button.whitelist, .status.whitelisted {
- color: #080;
-}
-button.blacklist, .status.blacklisted {
- color: #800;
-}
-button.forget {
- color: #008;
-}
-
-button:disabled {
- color: #888 !important;
-}
-
-button.toggle-source {
- color: #004;
- width: 5em;
- text-align:center;
-}
-
-pre.source {
- display: none;
- background: white;
- border: 1px solid #444;
- padding: .5em;
- overflow: auto;
- max-height: 20em;
- white-space: pre-wrap;
-}
-
-button.hide { display: none }
-.visible > button.show { display: none !important}
-.visible > pre.source { display: block }
-.visible > button.hide { display: initial }
-
-span.accepted, span.blocked {
- color:#008e00;
- font-size:145%;
- font-variant:small-caps;
- font-weight:bold;
-}
-
-span.blocked {
- color:#8e0000;
-}
-
-.title-area {
- width: 50%;
- float:left !important;
- text-align: center !important;
-}
-
-.title-area #librejs-web-link {
- font-size: 1.2em;
-}
-
-#librejs-web-labels-pages>ul {
- margin-top: .5em;
- font-size: 1.2em;
- list-style-type: disc;
-}
-
-
-.empty #site, .unknown-js.empty {
- display: none;
-}
-
-.tab #must-reload, .tab #buttons,
-.empty #complain, .empty #report-tab, #autotest {
- display: none;
-}
-
-#buttons button {
- width: 100%;
- text-align: center;
-}
-
-.mobile #report-tab {
- display: none;
-}