-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to disable https by default for a domain
- Loading branch information
Showing
5 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<style> | ||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
#domains_without_https { | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 9em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
HTTPS is enabled by default for all navigations from the location bar and bookmarks. | ||
If a site does not support https, you can opt in to using http by default for that site by adding the domain to the following list. | ||
When https by default is turned off for a domain, its subdomains will also not use https by default. | ||
<textarea id="domains_nohttps_input"></textarea> | ||
<input id="save_button" type="button" value="Save"> | ||
<script src="options.js"></script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
var domains_nohttps_input = document.getElementById('domains_nohttps_input'); | ||
var save_button = document.getElementById('save_button'); | ||
|
||
browser.storage.local.get({ | ||
domains_nohttps: '', | ||
}).then(({domains_nohttps}) => { | ||
if (domains_nohttps) { | ||
domains_nohttps_input.value = domains_nohttps; | ||
} | ||
}); | ||
|
||
|
||
let throttle; | ||
|
||
function commitChange() { | ||
clearTimeout(throttle); | ||
|
||
let domains_nohttps = domains_nohttps_input.value; | ||
// TODO: Validate? | ||
browser.storage.local.set({domains_nohttps}).then(() => { | ||
if (domains_nohttps_input.value === domains_nohttps) { | ||
save_button.value = 'Saved!'; | ||
} | ||
}); | ||
} | ||
|
||
save_button.onclick = commitChange; | ||
domains_nohttps_input.onchange = commitChange; | ||
domains_nohttps_input.oninput = () => { | ||
save_button.value = 'Save'; | ||
clearTimeout(throttle); | ||
throttle = setTimeout(commitChange, 1000); | ||
}; |