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

Commit 1d94da1

Browse files
committed
Add buttons to open the URL or close the page
1 parent 6016aad commit 1d94da1

File tree

4 files changed

+67
-18
lines changed

4 files changed

+67
-18
lines changed

chromium/pages/cancel/index.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,22 @@
88
<link rel="stylesheet" href="style.css" type="text/css" />
99
</head>
1010
<body>
11-
<h1 id="https-everywhere"><img src="../../images/banner-red.png" alt="HTTPS Everywhere" /></h1>
12-
<p data-i18n="cancel_he_blocking_explainer"></p>
13-
<p id="url-paragraph"><span id="url-label">URL: </span><a href="#" id="originURL"></a></p>
14-
<script src="../translation.js"></script>
15-
<script src="../util.js"></script>
16-
<script src="ux.js"></script>
11+
<div class="content">
12+
<h1 id="https-everywhere"><img src="../../images/banner-red.png" alt="HTTPS Everywhere" /></h1>
13+
<p data-i18n="cancel_he_blocking_explainer"></p>
14+
15+
<p id="url-paragraph">
16+
<span id="url-label">URL: </span><a href="#" id="url-value">PLACEHOLDER</a>
17+
</p>
18+
19+
<form method="get" action="#" id="url-actions">
20+
<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>
21+
<button type="button" name="close" formaction="#" id="close-button" data-i18n="cancel_close_page">Close the page</button>
22+
</form>
23+
24+
<script src="../translation.js"></script>
25+
<script src="../util.js"></script>
26+
<script src="ux.js"></script>
27+
</div>
1728
</body>
1829
</html>

chromium/pages/cancel/style.css

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
11
body{
22
margin-top: 6em;
3-
left: 50%;
43
position: relative;
5-
overflow: hidden;
4+
text-align: center;
65
}
76

8-
h1 img{
9-
position: relative;
10-
left: -289px;
7+
.content{
8+
width: 600px;
9+
margin: auto;
10+
text-align: left;
1111
}
1212

13-
p{
14-
width: 600px;
15-
position: relative;
16-
left: -300px;
13+
h1{
14+
text-align: center;
15+
}
16+
17+
form, button, p{
1718
font-size: 12pt;
1819
font-family: sans-serif;
1920
line-height: 150%;
2021
}
22+
23+
form button{
24+
padding: 1em;
25+
background-color: #aaa;
26+
color: #fff;
27+
border: none;
28+
border-radius: 5px;
29+
cursor: pointer;
30+
}
31+
32+
#close-button{
33+
display: inline-block;
34+
float: right;
35+
background-color: #23489f;
36+
}
37+
38+
#open-url-button{
39+
display: inline-block;
40+
float: left;
41+
background-color: #ec1e1e;
42+
}

chromium/pages/cancel/ux.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,29 @@ function replaceLink(explainer) {
2828
function displayURL() {
2929
const cancelURL = new URL(window.location.href);
3030
const originURL = decodeURI(cancelURL.searchParams.get('originURL'));
31-
const originURLLink = document.getElementById('originURL');
32-
originURLLink.innerText = originURL;
31+
const originURLLink = document.getElementById('url-value');
32+
const openURLButton = document.getElementById('open-url-button');
33+
const closeButton = document.getElementById('close-button');
3334

34-
originURLLink.addEventListener("click", function() {
35+
originURLLink.innerHTML = originURL;
36+
originURLLink.href = originURL;
37+
38+
openURLButton.addEventListener("click", function() {
3539
if (confirm(chrome.i18n.getMessage("chrome_disable_on_this_site") + '?')) {
3640
const url = new URL(originURL);
3741
sendMessage("disable_on_site", url.host, () => {
3842
window.location = originURL;
3943
});
4044
}
45+
46+
return false;
47+
});
48+
49+
closeButton.addEventListener("click", function() {
50+
chrome.tabs.getCurrent(function(tab) {
51+
chrome.tabs.remove(tab.id, function() { });
52+
});
53+
54+
return false;
4155
});
4256
}

src/chrome/locale/en/https-everywhere.dtd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
<!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.">
3737
<!ENTITY https-everywhere.cancel.he_blocking_network "network-based downgrade attacks">
38+
<!ENTITY https-everywhere.cancel.add_rule_and_open_insecurely "Open insecurely and add permanent rule">
39+
<!ENTITY https-everywhere.cancel.close_page "Close the page">
3840

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

0 commit comments

Comments
 (0)