diff options
author | Amin Bandali <bandali@gnu.org> | 2020-04-08 21:52:58 -0400 |
---|---|---|
committer | Amin Bandali <bandali@gnu.org> | 2020-04-08 21:52:58 -0400 |
commit | 61dd7225c7b6a2bb9346c76926b5e96264f831b8 (patch) | |
tree | 871f406fd2e3dfbfde8645615426e1c4ee15db23 /data/extensions/https-everywhere@eff.org/pages | |
parent | f6e3adb6b2344ee2c7bb453a305fd2d6fb4c194c (diff) |
Update HTTPS Everywhere to 2020.3.16.
Diffstat (limited to 'data/extensions/https-everywhere@eff.org/pages')
17 files changed, 323 insertions, 379 deletions
diff --git a/data/extensions/https-everywhere@eff.org/pages/cancel/index.html b/data/extensions/https-everywhere@eff.org/pages/cancel/index.html index 5dd3551..3522301 100644 --- a/data/extensions/https-everywhere@eff.org/pages/cancel/index.html +++ b/data/extensions/https-everywhere@eff.org/pages/cancel/index.html @@ -1,24 +1,28 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<!doctype html> +<html> <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta http-equiv="Content-Style-Type" content="text/css" /> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> <title>⚠ HTTPS Everywhere ⚠</title> - <style type="text/css">code{white-space: pre;}</style> - <link rel="stylesheet" href="style.css" type="text/css" /> + <link rel="stylesheet" href="style.css"> + <link rel="icon" href="/images/icons/icon-blocking-38.png"> </head> <body> <div class="content"> - <h1 id="https-everywhere"><img src="../../images/banner-red.png" alt="HTTPS Everywhere" /></h1> + <h1 id="https-everywhere"> + <img src="/images/banner-red.svg" alt="HTTPS Everywhere"> + </h1> + <p data-i18n="cancel_he_blocking_explainer"></p> <p id="url-paragraph"> - <span id="url-label">URL: </span><span id="url-value">PLACEHOLDER</span> + <span id="url-label">URL: </span><span id="url-value"></span> </p> - <form method="get" action="#" id="url-actions-form"> - <button type="button" name="open" formaction="#" id="open-url-button" data-i18n="cancel_open_page">Open insecure page</button> - </form> + <div class="actions"> + <button id="open-url-button" data-i18n="cancel_open_page"></button> + <button id="http-once-button" data-i18n="cancel_http_once"></button> + </div> <script src="../translation.js"></script> <script src="../util.js"></script> diff --git a/data/extensions/https-everywhere@eff.org/pages/cancel/style.css b/data/extensions/https-everywhere@eff.org/pages/cancel/style.css index 1858867..9b91ca3 100644 --- a/data/extensions/https-everywhere@eff.org/pages/cancel/style.css +++ b/data/extensions/https-everywhere@eff.org/pages/cancel/style.css @@ -1,48 +1,77 @@ -body{ +body { margin-top: 6em; - position: relative; - text-align: center; + font-size: 12pt; + font-family: sans-serif; + line-height: 150%; } -.content{ - width: 600px; +.content { margin: auto; - text-align: left; + max-width: 600px; } -h1{ - text-align: center; +h1 { + display: block; } -form, button, p{ - font-size: 12pt; - font-family: sans-serif; - line-height: 150%; +h1 img { + width: 100%; + height: auto; } -form{ - overflow: auto; - margin-bottom: 1em; +#url-paragraph { + display: block; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; } -form button{ - padding: .5em 1em; - background-color: #aaa; - color: #fff; - border: none; +button { + background-color: #ec1e1e; + border: 1px solid #ec1e1e; border-radius: 4px; + color: #fff; cursor: pointer; + padding: 0.5em 1em; + display: block; + float: none; + font-size: 12pt; + margin: 8px 0; + line-height: 150%; } -#url-value{ - display: block; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; +button:hover { + background-color: #fff; + color: #ec1e1e; } -#open-url-button{ - display: inline-block; - float: left; - background-color: #ec1e1e; +button:last-child { + margin: 0; +} + +@media screen and (max-width: 550px) { + button { + width: 100%; + margin: 8px 0; + } +} + +@media (prefers-color-scheme: dark) { + body { + background-color: #202023; + color: #f9f9fa; + } + + a { + color: #45a1ff; + } + + button { + color: #202023; + } + + button:hover { + background-color: #202023; + border-color: #ec1e1e; + } } diff --git a/data/extensions/https-everywhere@eff.org/pages/cancel/ux.js b/data/extensions/https-everywhere@eff.org/pages/cancel/ux.js index a1773ca..7e6199a 100644 --- a/data/extensions/https-everywhere@eff.org/pages/cancel/ux.js +++ b/data/extensions/https-everywhere@eff.org/pages/cancel/ux.js @@ -20,23 +20,38 @@ function replaceLink(explainer) { observer.disconnect(); const linkText = chrome.i18n.getMessage("cancel_he_blocking_network"); const link = document.createElement("a"); + link.classList.add("wikilink"); link.href = "https://en.wikipedia.org/wiki/Downgrade_attack"; link.innerText = linkText; explainer.innerHTML = explainer.innerHTML.replace(linkText, link.outerHTML); + + /* + In response to translation of i18n string "cancel_he_blocking_network". + Within context of the paragraph and as a standalone string can be interpreted differently + langauge to language. + + So if link fails to swap in replace, this conditional is triggered + */ + if (document.getElementsByClassName("wikilink").length === 0) { + link.innerText = linkText; + explainer.after(link); + } + } function displayURL() { - const cancelURL = new URL(window.location.href); - const originURL = decodeURI(cancelURL.searchParams.get('originURL')); + const searchParams = new URLSearchParams(window.location.search); + const originURL = searchParams.get('originURL'); const originURLLink = document.getElementById('url-value'); const openURLButton = document.getElementById('open-url-button'); + const openHttpOnce = document.getElementById('http-once-button'); + const url = new URL(originURL); - originURLLink.innerHTML = originURL; + originURLLink.innerText = originURL; originURLLink.href = originURL; openURLButton.addEventListener("click", function() { if (confirm(chrome.i18n.getMessage("chrome_disable_on_this_site") + '?')) { - const url = new URL(originURL); sendMessage("disable_on_site", url.host, () => { window.location = originURL; }); @@ -44,4 +59,14 @@ function displayURL() { return false; }); + + openHttpOnce.addEventListener("click", function() { + if (confirm(chrome.i18n.getMessage("chrome_disable_on_this_site") + '?')) { + sendMessage("disable_on_site_once", url.host, () => { + window.location = originURL; + }); + } + + return false; + }); } diff --git a/data/extensions/https-everywhere@eff.org/pages/devtools/index.html b/data/extensions/https-everywhere@eff.org/pages/devtools/index.html deleted file mode 100644 index 940de8b..0000000 --- a/data/extensions/https-everywhere@eff.org/pages/devtools/index.html +++ /dev/null @@ -1,10 +0,0 @@ -<!doctype html> -<html> - <head> - <meta charset="utf-8"> - <title></title> - <script src="../util.js"></script> - <script src="ux.js"></script> - </head> - <body></body> -</html> diff --git a/data/extensions/https-everywhere@eff.org/pages/devtools/panel-ux.js b/data/extensions/https-everywhere@eff.org/pages/devtools/panel-ux.js deleted file mode 100644 index 2cd6a56..0000000 --- a/data/extensions/https-everywhere@eff.org/pages/devtools/panel-ux.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; - -function e(id) { - return document.getElementById(id); -} - -/** - * Send message to main extension for HTML to display - * @param type: enable/disable - */ -function sendMessage(type) { - chrome.runtime.sendMessage({ - type: type, - tabId: chrome.devtools.inspectedWindow.tabId, - }); -} - -/** - * Turn on the Switch Planner recording mode, and hide the long description. - */ -function enableSwitchPlanner() { - sendMessage("enable"); - e("SwitchPlannerDescription").style.display = "none"; - e("SwitchPlannerDetails").style.display = "block"; - // Hack: Fetch and display summary information from background page - // once per second. - setInterval(display, 1000); - chrome.devtools.inspectedWindow.reload(); -} - -/** - * Disable the switch planner and reload, so any state is forgotten and - * the long description is restored. - */ -function disableSwitchPlanner() { - sendMessage("disable"); - document.location.reload(); -} - -/** - * Fetch summary HTML of the planner results from the background page for - * display in the devtools panel. - */ -function display() { - chrome.runtime.sendMessage({ - type: "getHosts", - tabId: chrome.devtools.inspectedWindow.tabId, - }, function(response) { - var switch_planner_details = e("SwitchPlannerDetails"); - while (switch_planner_details.firstChild) { - switch_planner_details.removeChild(switch_planner_details.firstChild); - } - - var nrw_text_div = document.createElement("div"); - nrw_text_div.innerText = "Unrewritten HTTP resources loaded from this tab (enable HTTPS on these domains and add them to HTTPS Everywhere):" - var nrw_div = switchPlannerSmallHtmlSection(response.nrw); - var rw_text_div = document.createElement("div"); - rw_text_div.style.marginTop = "20px"; - rw_text_div.innerText = "Resources rewritten successfully from this tab (update these in your source code):" - var rw_div = switchPlannerSmallHtmlSection(response.rw); - - switch_planner_details.appendChild(nrw_text_div); - switch_planner_details.appendChild(nrw_div); - switch_planner_details.appendChild(rw_text_div); - switch_planner_details.appendChild(rw_div); - - e("SwitchPlannerResults").style.display = "block"; - }); -} - -/** -* Format the switch planner output for presentation to a user. -* */ -function switchPlannerSmallHtmlSection(asset_host_list) { - var wrapper_div = document.createElement("div"); - if (asset_host_list.length == 0) { - wrapper_div.style.fontWeight = "bold"; - wrapper_div.innerText = "none"; - return wrapper_div; - } - - for (var i = asset_host_list.length - 1; i >= 0; i--) { - var host = asset_host_list[i][3]; - var activeCount = asset_host_list[i][1]; - var passiveCount = asset_host_list[i][2]; - - var div = document.createElement("div"); - var b = document.createElement("b"); - b.innerText = host; - div.appendChild(b); - - var text_arr = []; - if (activeCount > 0) { - text_arr.push(activeCount + " active"); - } - if (passiveCount > 0) { - text_arr.push(passiveCount + " passive"); - } - div.appendChild(document.createTextNode(": " + text_arr.join(', '))); - - wrapper_div.appendChild(div); - } - return wrapper_div; -} - -window.onload = function() { - // Open a connection to the background page. Right now this is only used - // by the background page so it knows when the devtools pane has closed. - // We don't receive messages from the background page currently, though that - // may be a future improvement. Sending messages to the background page doesn't - // require an existing connection. - chrome.runtime.connect({ name: "devtools-page" }); - - var checkbox = e("SwitchPlannerCheckbox"); - checkbox.addEventListener("change", function() { - if (checkbox.checked) { - enableSwitchPlanner(); - } else { - disableSwitchPlanner(); - } - }); - - e("SwitchPlannerDetailsLink").addEventListener("click", function() { - window.open("/pages/switch-planner/index.html?tab=" + chrome.devtools.inspectedWindow.tabId); - }); - // Since this is rendered in a devtools console, we have to make clicks on the - // link open a new window. - e("MixedContentLink").addEventListener("click", function(e) { - window.open(e.target.href); - }); -}; diff --git a/data/extensions/https-everywhere@eff.org/pages/devtools/panel.html b/data/extensions/https-everywhere@eff.org/pages/devtools/panel.html deleted file mode 100644 index f5f6859..0000000 --- a/data/extensions/https-everywhere@eff.org/pages/devtools/panel.html +++ /dev/null @@ -1,38 +0,0 @@ -<!doctype html> -<html> - <head> - <meta charset="utf-8"> - <title></title> - <style> - html { - background: #fff; - color: #000; - } - </style> - </head> - <body> - <div id="SwitchPlanner"> - <input type="checkbox" id="SwitchPlannerCheckbox"> - <label for="SwitchPlannerCheckbox">Enable HTTPS Switch Planner mode (reloads page).</label> - <br> - <div id="SwitchPlannerDescription"> - <p>Switch Planner mode helps prepare for your site's switch to HTTPS by generating a report of external HTTP - resources that might not yet be available on HTTPS.</p> - <p>After enabling, navigate around your site and try to exercise all functionality in order to get a - comprehensive list of external resources.</p> - <p>For each group of resources listed as "Unrewritten," find out whether they are available on HTTPS. If so: - add a rule to HTTPS Everywhere! If not: try to make them available over HTTPS or use a different resource or - provider. Otherwise your site will generate <a id="MixedContentLink" - href="https://developer.mozilla.org/en-US/docs/Security/MixedContent#Mixed_passive.2Fdisplay_content">Mixed - Content</a> (passive or active) errors when you turn on HTTPS.</p> - <p>For most accurate results, disable ad blockers before using. Closing this panel will deactivate Switch - Planner mode and clear stored data.</p> - </div> - <div id="SwitchPlannerResults" style="display: none"> - <div id="SwitchPlannerDetails"></div> - <a id="SwitchPlannerDetailsLink" href="javascript:void 0">details</a> - </div> - </div> - <script src="panel-ux.js"></script> - </body> -</html> diff --git a/data/extensions/https-everywhere@eff.org/pages/devtools/ux.js b/data/extensions/https-everywhere@eff.org/pages/devtools/ux.js deleted file mode 100644 index 8244cbf..0000000 --- a/data/extensions/https-everywhere@eff.org/pages/devtools/ux.js +++ /dev/null @@ -1,17 +0,0 @@ -/* global sendMessage */ - -"use strict"; - -const defaultOptions = { - showDevtoolsTab: true -}; - -sendMessage("get_option", defaultOptions, item => { - if (item.showDevtoolsTab) { - chrome.devtools.panels.create("HTTPS Everywhere", - "/images/icons/icon-active-38.png", - "/pages/devtools/panel.html", - function() { } - ); - } -}); diff --git a/data/extensions/https-everywhere@eff.org/pages/onboarding/style.css b/data/extensions/https-everywhere@eff.org/pages/onboarding/style.css new file mode 100644 index 0000000..b270b2e --- /dev/null +++ b/data/extensions/https-everywhere@eff.org/pages/onboarding/style.css @@ -0,0 +1,42 @@ +:root { + --https-blue: #0a84ff; + --darker-blue: #0060df; + --text-main: #000; + --text-secondary: #464646; + --light-grey: #ececec; +} + +body { + align-content: center; + background-color: var(--light-grey); + color: var(--text-main); + display: flex; + flex-direction: column; + flex-wrap: wrap; + font-family: 'Lucida Grande', 'Segoe UI', Tahoma, 'DejaVu Sans', Arial, sans-serif; + justify-content: center; +} + +img { + width: 100%; +} +img.footer_img { + width: 15%; +} + +h1.description { + text-align: center; +} + +.updates_header { + text-align: center; +} +.updates_details { + margin: 18px; + padding: 1%; +} + +footer { + margin: 18px 0; + text-align: center; +}
\ No newline at end of file diff --git a/data/extensions/https-everywhere@eff.org/pages/onboarding/updated.html b/data/extensions/https-everywhere@eff.org/pages/onboarding/updated.html new file mode 100644 index 0000000..fc730a3 --- /dev/null +++ b/data/extensions/https-everywhere@eff.org/pages/onboarding/updated.html @@ -0,0 +1,38 @@ +<!doctype html> +<html class="no-js" lang=""> + +<head> + <meta charset="utf-8"> + <title>What's Updated</title> + <meta name="description" content="Updates"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" href="style.css"> + <link rel="icon" href="/images/icons/icon-active-38.png"> +</head> + +<body> + <header> + <img src="/images/onboarding/httpseverywhere-logo.png" alt="HTTPS Everywhere"> + </header> + <h1 class="description" data-i18n="onboarding_intro"></h1> + <section class="updates"> + <h1 class="updates_header" data-i18n="onboarding_header"></h1> + <hr> + <div class="updates_details"> + <h2 class="updates_details_list" data-i18n="onboarding_details_one"></h2> + <img src="https://raw.githubusercontent.com/EFForg/https-everywhere/master/chromium/images/onboarding/ease_badssl.gif" alt="EASE Mode GIF Demo" aria-hidden="true"/> + </div> + <div class="updates_details"> + <h2 class="updates_details_list" data-i18n="onboarding_details_two"></h2> + <img src="https://raw.githubusercontent.com/EFForg/https-everywhere/master/chromium/images/onboarding/add_disabled_site.gif" alt="Options GIF Demo" aria-hidden="true"/> + </div> + </section> + <footer> + <img class="footer_img" src="/images/eff-logo-monogram-red.png" alt="EFF Logo" aria-hidden="true"/> + <p data-i18n="onboarding_footer"></p> + </footer> + + <script src="../translation.js"></script> +</body> + +</html> diff --git a/data/extensions/https-everywhere@eff.org/pages/options/index.html b/data/extensions/https-everywhere@eff.org/pages/options/index.html index 078f5ea..6d82a18 100644 --- a/data/extensions/https-everywhere@eff.org/pages/options/index.html +++ b/data/extensions/https-everywhere@eff.org/pages/options/index.html @@ -2,6 +2,7 @@ <html> <head> <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=.8"> <title></title> <link href="style.css" rel="stylesheet"> </head> @@ -20,6 +21,10 @@ </div> <div id="disabled-rules-wrapper"> <p class="disabled-rules-wrapper-header" data-i18n="options_disabledUrlsListed"></p> + <div id="add-disabled-site-wrapper"> + <button id="add-disabled-site" data-i18n="options_addDisabledSite"></button> + <input type="text" id="disabled-site" /> + </div> </div> </div> @@ -49,6 +54,8 @@ </div> </div> + <a id="secretArea" href="/pages/debugging-rulesets/index.html" target="_blank" class="hidden" data-i18n="options_debuggingRulesets"></a> + <script src="ux.js"></script> <script src="../translation.js"></script> <script src="../util.js"></script> diff --git a/data/extensions/https-everywhere@eff.org/pages/options/style.css b/data/extensions/https-everywhere@eff.org/pages/options/style.css index d1ff21e..d0f4324 100644 --- a/data/extensions/https-everywhere@eff.org/pages/options/style.css +++ b/data/extensions/https-everywhere@eff.org/pages/options/style.css @@ -1,8 +1,37 @@ body{ min-width: 500px; + min-height: 250px; display: block; } +@media (prefers-color-scheme: dark) { + body { + background-color: #202023; + color: #f9f9fa; + } + + .section-header-span, div#update-channels-warning { + color: #000; + } + + textarea, input[type=text] { + background-color: #202023; + color: #f9f9fa; + } +} + +a.settings{ + background-color: #1c87c9; + border: none; + color: white; + padding: 20px 34px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 20px; + margin: 4px 2px; +} + .settings-wrapper{ margin: 10px 0 0 0; } @@ -135,13 +164,13 @@ div.update-channel-row-scope { border-radius: 7px; } -button#add-update-channel{ +button#add-update-channel, button#add-disabled-site { float: right; margin: 0px 10px 10px 10px; border-radius: 7px; } -input#update-channel-name{ +input#update-channel-name, input#disabled-site { float: right; } @@ -192,3 +221,25 @@ div#update-channels-last-checked { #update-channels-wrapper{ width: 500px; } + +@keyframes flash { + from { + background: #fc0; + } + to { + background: transparent; + } +} + +#secretArea { + border-radius: 5px; + padding: 5px; +} + +.hidden { + display: none +} + +.flash { + animation: flash 1s ease-out; +} diff --git a/data/extensions/https-everywhere@eff.org/pages/options/ux.js b/data/extensions/https-everywhere@eff.org/pages/options/ux.js index 97c5673..fbfc113 100644 --- a/data/extensions/https-everywhere@eff.org/pages/options/ux.js +++ b/data/extensions/https-everywhere@eff.org/pages/options/ux.js @@ -5,7 +5,43 @@ "use strict"; +if (navigator.userAgent.includes("Android")) { + const url = new URL(window.location.href); + if (!url.searchParams.get('redirected')) { + url.searchParams.set('redirected', true); + document.body.innerText = ""; + let link = document.createElement("a"); + link.href = url.href; + link.target = "_blank"; + link.className = "settings"; + link.innerText = chrome.i18n.getMessage("options_settings"); + document.body.appendChild(link); + } +} + document.addEventListener("DOMContentLoaded", () => { + const secretArea = document.getElementById('secretArea') + + const onKeyDownHandler = evt => { + if (evt.ctrlKey && evt.key === 'z') { + secretArea.classList.remove('hidden') + secretArea.classList.add('flash') + + sendMessage('set_option', { developerMode: true }) + + document.removeEventListener('keydown', onKeyDownHandler) + + evt.preventDefault() + } + } + + sendMessage('get_option', { developerMode: false }, item => { + if (item.developerMode) { + secretArea.classList.remove('hidden') + } else { + document.addEventListener('keydown', onKeyDownHandler) + } + }) const autoUpdateRulesets = document.getElementById("autoUpdateRulesets"); const enableMixedRulesets = document.getElementById("enableMixedRulesets"); @@ -246,7 +282,7 @@ document.addEventListener("DOMContentLoaded", () => { let remove = templateRemove.cloneNode(true); user_rule_host.className = "user-rules-list-item"; - user_rule_name.className = "user-rules-list-item-single" + user_rule_name.className = "user-rules-list-item-single"; user_rule_name.innerText = userRule.name; user_rule_host.appendChild(user_rule_name); user_rules_parent.appendChild(user_rule_host); @@ -265,10 +301,6 @@ document.addEventListener("DOMContentLoaded", () => { getOption_("disabledList", [], function(item) { let rule_host_parent = e("disabled-rules-wrapper"); - if( 0 === item.disabledList.length ) { - hide(rule_host_parent); - return; - } // img element "remove button" let templateRemove = document.createElement("img"); templateRemove.src = chrome.runtime.getURL("images/remove.png"); @@ -281,7 +313,7 @@ document.addEventListener("DOMContentLoaded", () => { let rule_host_site_name = document.createElement("p"); rule_host.className = "disabled-rule-list-item"; - rule_host_site_name.className = "disabled-rule-list-item_single" + rule_host_site_name.className = "disabled-rule-list-item_single"; rule_host_site_name.innerText = key; rule_host.appendChild( rule_host_site_name); rule_host_parent.appendChild(rule_host); @@ -295,6 +327,18 @@ document.addEventListener("DOMContentLoaded", () => { } }); + const add_disabled_site = document.getElementById("add-disabled-site"); + const disabled_site_input = document.getElementById("disabled-site"); + disabled_site_input.setAttribute("placeholder", chrome.i18n.getMessage("options_enterDisabledSite")); + + add_disabled_site.addEventListener("click", function() { + sendMessage("disable_on_site", disabled_site_input.value, okay => { + if (okay) { + chrome.tabs.reload(); + } + }); + }); + add_update_channel.addEventListener("click", () => { const update_channel_name = update_channel_name_div.value; if(update_channel_name.trim() == "") { @@ -336,11 +380,4 @@ document.addEventListener("DOMContentLoaded", () => { } update_channels_last_checked.innerText = chrome.i18n.getMessage("options_updatesLastChecked") + last_checked_string; }); - - document.onkeydown = function(evt) { - evt = evt || window.event; - if (evt.ctrlKey && evt.keyCode == 90) { - window.open("/pages/debugging-rulesets/index.html"); - } - }; }); diff --git a/data/extensions/https-everywhere@eff.org/pages/popup/index.html b/data/extensions/https-everywhere@eff.org/pages/popup/index.html index 03f76d2..9116280 100644 --- a/data/extensions/https-everywhere@eff.org/pages/popup/index.html +++ b/data/extensions/https-everywhere@eff.org/pages/popup/index.html @@ -2,6 +2,7 @@ <html> <head> <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> <title data-i18n="about_ext_name"></title> <link href="style.css" rel="stylesheet"> @@ -32,9 +33,9 @@ </section> <section id="HttpNowhere" class="options settings_block" style="visibility: hidden;"> - <h1 id="HttpNowhere__header" data-i18n="menu_encryptAllSitesEligible"></h1> + <h1 id="HttpNowhere__header"></h1> <input aria-hidden="true" id="http-nowhere-checkbox" type="checkbox"><label id="http-nowhere-checkbox_label" aria-label="Toggle on or off" for="http-nowhere-checkbox"></label> - <h2 id="HttpNowhere__explained" data-i18n="menu_httpNoWhereExplained"></h2> + <h2 id="HttpNowhere__explained"></h2> </section> <section id="RuleManagement" class="settings_block"> diff --git a/data/extensions/https-everywhere@eff.org/pages/popup/style.css b/data/extensions/https-everywhere@eff.org/pages/popup/style.css index 6207daa..38a35ac 100644 --- a/data/extensions/https-everywhere@eff.org/pages/popup/style.css +++ b/data/extensions/https-everywhere@eff.org/pages/popup/style.css @@ -76,7 +76,6 @@ footer a.button { /* Elements */ .settings_block { - display: inline-block; padding: 5px 1em 20px 1em; border-bottom: var(--light-grey) solid 1px; } @@ -104,6 +103,7 @@ footer a.button { font-size: 12px; float: right; margin: 5px 0; + padding: 10px 0; } .see_more__arrow { @@ -261,7 +261,7 @@ input:checked+label:after { #StableRules h3 { float: left; - margin-left: 10px; + margin: 10px; } #StableRules h2 { margin-left: 10px; @@ -271,12 +271,11 @@ input:checked+label:after { border-radius: 20px; color: #fff; display: block; - float: right; + float: left; font-size: 12px; font-weight: bold; height: 15px; - margin-top: 10px; - margin-right: 55%; + margin-top: 8px; padding: 5px; text-align: center; width: 15px; diff --git a/data/extensions/https-everywhere@eff.org/pages/popup/ux.js b/data/extensions/https-everywhere@eff.org/pages/popup/ux.js index 142c372..48de5b1 100644 --- a/data/extensions/https-everywhere@eff.org/pages/popup/ux.js +++ b/data/extensions/https-everywhere@eff.org/pages/popup/ux.js @@ -13,8 +13,8 @@ function toggleRuleLine(event) { getTab(activeTab => { const set_ruleset = { - active: event.target.parentNode.firstChild.checked, - name: event.target.innerText, + active: event.target.checked, + name: event.target.parentNode.innerText, tab_id: activeTab.id, }; @@ -47,10 +47,10 @@ function toggleSeeMore(event) { if(arrow.classList.contains('down')) { arrow.classList.replace('down', 'up'); - text.innerText = 'See less'; + text.innerText = chrome.i18n.getMessage("menu_seeLess"); } else if (arrow.classList.contains('up')) { arrow.classList.replace('up', 'down'); - text.innerText = 'See more'; + text.innerText = chrome.i18n.getMessage("menu_seeMore"); } if (content.classList.contains('hide')) { @@ -69,9 +69,6 @@ function toggleSeeMore(event) { */ function appendRulesToListDiv(rulesets, list_div, ruleType) { if (rulesets && rulesets.length) { - let counter = rulesets.length; - let counterElement = document.querySelector("#RuleManagement--counter"); - counterElement.innerText = counter; // template parent block for each ruleset let templateLine = document.createElement("div"); templateLine.className = "rule checkbox"; @@ -111,6 +108,9 @@ function appendRulesToListDiv(rulesets, list_div, ruleType) { checkbox.checked = ruleset.active; text.innerText = ruleset.name; + // Add listener to capture the toggle event + line.addEventListener("click", toggleRuleLine); + if (ruleset.note && ruleset.note.length) { line.title = ruleset.note; @@ -136,8 +136,11 @@ function showHttpNowhereUI() { getOption_('httpNowhere', false, function(item) { if (item.httpNowhere) { e('http-nowhere-checkbox').checked = true; - e('HttpNowhere__header').innerText = 'Encrypt All Sites Eligible is ON'; - e('HttpNowhere__explained').innerText = 'Unencrypted requests are currently blocked'; + e('HttpNowhere__header').innerText = chrome.i18n.getMessage("menu_encryptAllSitesEligibleOn"); + e('HttpNowhere__explained').innerText = chrome.i18n.getMessage("menu_httpNoWhereExplainedBlocked"); + } else { + e('HttpNowhere__header').innerText = chrome.i18n.getMessage("menu_encryptAllSitesEligibleOff"); + e('HttpNowhere__explained').innerText = chrome.i18n.getMessage("menu_httpNoWhereExplainedAllowed"); } e('HttpNowhere').style.visibility = "visible"; }); @@ -151,10 +154,11 @@ function updateEnabledDisabledUI() { // Hide or show the rules sections if (item.globalEnabled) { document.body.className = "" + e('onoffswitch_label').innerText = chrome.i18n.getMessage("menu_globalEnable"); showHttpNowhereUI(); } else { document.body.className = "disabled"; - e('onoffswitch_label').innerText = 'HTTPS Everywhere is OFF'; + e('onoffswitch_label').innerText = chrome.i18n.getMessage("menu_globalDisable"); } }); } @@ -180,16 +184,18 @@ function toggleEnabledDisabled() { * @param activeTab */ function listRules(activeTab) { - sendMessage("get_active_rulesets", activeTab.id, function(rulesets) { + sendMessage("get_applied_rulesets", activeTab.id, function(rulesets) { if (rulesets) { + // show the number of potentially applicable rulesets + let counter = rulesets.length; + let counterElement = document.querySelector("#RuleManagement--counter"); + counterElement.innerText = counter; + const stableRules = rulesets.filter(ruleset => ruleset.default_state); const unstableRules = rulesets.filter(ruleset => !ruleset.default_state); appendRulesToListDiv(stableRules, e("StableRules"), 'stable'); appendRulesToListDiv(unstableRules, e("UnstableRules"), 'unstable'); - - // Add listener to capture the toggle event - e("add-new-rule-button").addEventListener("click", toggleRuleLine); } // Only show the "Add a rule" section if we're on an HTTPS page @@ -378,11 +384,11 @@ function toggleHttpNowhere() { setOption_('httpNowhere', enabled, () => { if (enabled) { chrome.tabs.reload(tab.id); - e('HttpNowhere__header').innerText = 'Encrypt All Sites Eligible is ON'; - e('HttpNowhere__explained').innerText = 'Unencrypted requests are currently blocked'; + e('HttpNowhere__header').innerText = chrome.i18n.getMessage("menu_encryptAllSitesEligibleOn"); + e('HttpNowhere__explained').innerText = chrome.i18n.getMessage("menu_httpNoWhereExplainedBlocked"); } else { - e('HttpNowhere__header').innerText = 'Encrypt All Sites Eligible is OFF'; - e('HttpNowhere__explained').innerText = 'Unencrypted requests are currently allowed'; + e('HttpNowhere__header').innerText = chrome.i18n.getMessage("menu_encryptAllSitesEligibleOff"); + e('HttpNowhere__explained').innerText = chrome.i18n.getMessage("menu_httpNoWhereExplainedAllowed"); } }); }); diff --git a/data/extensions/https-everywhere@eff.org/pages/switch-planner/index.html b/data/extensions/https-everywhere@eff.org/pages/switch-planner/index.html deleted file mode 100644 index 5150fc2..0000000 --- a/data/extensions/https-everywhere@eff.org/pages/switch-planner/index.html +++ /dev/null @@ -1,11 +0,0 @@ -<!doctype html> -<html> - <head> - <meta charset="utf-8"> - <title></title> - </head> - <body> - <div id="content"></div> - <script src="ux.js"></script> - </body> -</html> diff --git a/data/extensions/https-everywhere@eff.org/pages/switch-planner/ux.js b/data/extensions/https-everywhere@eff.org/pages/switch-planner/ux.js deleted file mode 100644 index 1562f8f..0000000 --- a/data/extensions/https-everywhere@eff.org/pages/switch-planner/ux.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; - -document.addEventListener("DOMContentLoaded", () => { - const background = chrome.extension.getBackgroundPage().require('./background'); - var tab = document.location.search.match(/tab=([^&]*)/)[1]; - var content = document.getElementById("content"); - - var nrw_text_div = document.createElement("div"); - nrw_text_div.innerText = "Unrewritten HTTP resources loaded from this tab (enable HTTPS on these domains and add them to HTTPS Everywhere):" - var nrw_div = switchPlannerDetailsHtmlSection( - background.sortSwitchPlanner(tab, "nrw"), - background.switchPlannerInfo[tab]["nrw"] - ); - var rw_text_div = document.createElement("div"); - rw_text_div.style.marginTop = "20px"; - rw_text_div.innerText = "Resources rewritten successfully from this tab (update these in your source code):" - var rw_div = switchPlannerDetailsHtmlSection( - background.sortSwitchPlanner(tab, "rw"), - background.switchPlannerInfo[tab]["rw"] - ); - - content.appendChild(nrw_text_div); - content.appendChild(nrw_div); - content.appendChild(rw_text_div); - content.appendChild(rw_div); -}); - -/** - * Generate the detailed html fot the switch planner, by section - * */ -function switchPlannerDetailsHtmlSection(asset_host_list, link_keys) { - var wrapper_div = document.createElement("div"); - if (asset_host_list.length == 0) { - wrapper_div.style.fontWeight = "bold"; - wrapper_div.innerText = "none"; - return wrapper_div; - } - - for (var i = asset_host_list.length - 1; i >= 0; i--) { - var host = asset_host_list[i][3]; - var activeCount = asset_host_list[i][1]; - var passiveCount = asset_host_list[i][2]; - - var div = document.createElement("div"); - div.style.marginTop = "20px"; - var b = document.createElement("b"); - b.innerText = host; - div.appendChild(b); - - if (activeCount > 0) { - var active_div = document.createElement("div"); - active_div.appendChild(document.createTextNode(activeCount + " active")); - for (const link of linksFromKeys(link_keys[host][1])) { - active_div.appendChild(link); - } - div.appendChild(active_div); - } - if (passiveCount > 0) { - var passive_div = document.createElement("div"); - passive_div.appendChild(document.createTextNode(passiveCount + " passive")); - for (const link of linksFromKeys(link_keys[host][0])) { - passive_div.appendChild(link); - } - div.appendChild(passive_div); - } - wrapper_div.appendChild(div); - } - return wrapper_div; -} - -/** - * Generate a HTML link from urls in map - * map: the map containing the urls - * */ -function linksFromKeys(map) { - if (typeof map == 'undefined') return ""; - var links = []; - for (var key in map) { - if (map.hasOwnProperty(key)) { - var link = document.createElement("a"); - link.style.display = "block"; - link.href = key; - link.innerText = key; - links.push(link); - } - } - return links; -} |