Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Add buttons for opening the URL and closing the page
Browse files Browse the repository at this point in the history
  • Loading branch information
patch-malone committed Feb 1, 2019
1 parent 6016aad commit cf79f52
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 18 deletions.
23 changes: 17 additions & 6 deletions chromium/pages/cancel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<h1 id="https-everywhere"><img src="../../images/banner-red.png" alt="HTTPS Everywhere" /></h1>
<p data-i18n="cancel_he_blocking_explainer"></p>
<p id="url-paragraph"><span id="url-label">URL: </span><a href="#" id="originURL"></a></p>
<script src="../translation.js"></script>
<script src="../util.js"></script>
<script src="ux.js"></script>
<div class="content">
<h1 id="https-everywhere"><img src="../../images/banner-red.png" alt="HTTPS Everywhere" /></h1>
<p data-i18n="cancel_he_blocking_explainer"></p>

<p id="url-paragraph">
<span id="url-label">URL: </span><a href="#" id="url-value">PLACEHOLDER</a>
</p>

<form method="get" action="#" id="url-actions-form">
<button type="button" name="open" formaction="#" id="open-url-button" data-i18n="cancel_add_rule_and_open_insecurely">Open insecurely and add permanent rule</button>
<button type="button" name="close" formaction="#" id="close-button" data-i18n="cancel_close_page">Close the page</button>
</form>

<script src="../translation.js"></script>
<script src="../util.js"></script>
<script src="ux.js"></script>
</div>
</body>
</html>
45 changes: 36 additions & 9 deletions chromium/pages/cancel/style.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,47 @@
body{
margin-top: 6em;
left: 50%;
position: relative;
overflow: hidden;
text-align: center;
}

h1 img{
position: relative;
left: -289px;
.content{
width: 600px;
margin: auto;
text-align: left;
}

p{
width: 600px;
position: relative;
left: -300px;
h1{
text-align: center;
}

form, button, p{
font-size: 12pt;
font-family: sans-serif;
line-height: 150%;
}

#url-actions-form{
overflow: auto;
margin-bottom: 1em;
}

#url-actions-form button{
padding: .5em 1em;
background-color: #aaa;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}

#close-button{
display: inline-block;
float: right;
background-color: #23489f;
}

#open-url-button{
display: inline-block;
float: left;
background-color: #ec1e1e;
}
20 changes: 17 additions & 3 deletions chromium/pages/cancel/ux.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,29 @@ function replaceLink(explainer) {
function displayURL() {
const cancelURL = new URL(window.location.href);
const originURL = decodeURI(cancelURL.searchParams.get('originURL'));
const originURLLink = document.getElementById('originURL');
originURLLink.innerText = originURL;
const originURLLink = document.getElementById('url-value');
const openURLButton = document.getElementById('open-url-button');
const closeButton = document.getElementById('close-button');

originURLLink.addEventListener("click", function() {
originURLLink.innerHTML = 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;
});
}

return false;
});

closeButton.addEventListener("click", function() {
chrome.tabs.getCurrent(function(tab) {
chrome.tabs.remove(tab.id, function() { });
});

return false;
});
}
2 changes: 2 additions & 0 deletions src/chrome/locale/en/https-everywhere.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

<!ENTITY https-everywhere.cancel.he_blocking_explainer "HTTPS Everywhere noticed you were navigating to a non-HTTPS page, and tried to send you to the HTTPS version instead. The HTTPS version is unavailable. Most likely this site does not support HTTPS, but it is also possible that an attacker is blocking the HTTPS version. If you wish to view the unencrypted version of this page, you can still do so by disabling the 'Block all unencrypted requests' option in your HTTPS Everywhere extension. Be aware that disabling this option could make your browser vulnerable to network-based downgrade attacks on websites you visit.">
<!ENTITY https-everywhere.cancel.he_blocking_network "network-based downgrade attacks">
<!ENTITY https-everywhere.cancel.add_rule_and_open_insecurely "Open insecurely and add permanent rule">
<!ENTITY https-everywhere.cancel.close_page "Close the page">

<!ENTITY https-everywhere.chrome.stable_rules "Stable rules">
<!ENTITY https-everywhere.chrome.stable_rules_description "Force encrypted connections to these websites:">
Expand Down

0 comments on commit cf79f52

Please sign in to comment.