-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preference to change maximum cookie expiry from 15 to 1-30 days.
- Loading branch information
Showing
4 changed files
with
89 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,21 @@ | |
"manifest_version": 2, | ||
"name": "Fresh Cookies", | ||
"description": "Limit the maximum age of web cookies for your privacy benefit.", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
|
||
"applications": { | ||
"gecko": { | ||
"strict_min_version": "54.0a1" | ||
} | ||
"options_ui": { | ||
"page": "options.html" | ||
}, | ||
|
||
"background": { | ||
"scripts": ["background.js"] | ||
}, | ||
|
||
"permissions": [ "cookies", "http://*/*", "https://*/*" ] | ||
"permissions": ["cookies", "http://*/*", "https://*/*", "storage"], | ||
|
||
"browser_specific_settings": { | ||
"gecko": { | ||
"id": "[email protected]" | ||
} | ||
} | ||
} |
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,24 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
|
||
<form style="padding-top:0.5em"> | ||
<label><strong>Maximum cookie expiry:</strong><br> | ||
<input type="range" step="1" min="1" max="30" value="15" id="maxExpiryDays" style="width:70%"> | ||
<input type="text" id="cc" type="number" size=1 min="1" max="30"> days | ||
</label> | ||
<div style="margin-top: 0.5em"> | ||
<button type="submit">Save</button> | ||
</div> | ||
</form> | ||
|
||
<script src="options.js"></script> | ||
|
||
</body> | ||
|
||
</html> |
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,36 @@ | ||
function saveOptions(e) { | ||
e.preventDefault(); | ||
browser.storage.sync.set({ | ||
maxExpiryDays: document.querySelector("#maxExpiryDays").value | ||
}); | ||
browser.runtime.reload(); | ||
} | ||
|
||
function restoreOptions() { | ||
|
||
function setCurrentChoice(result) { | ||
document.querySelector("#maxExpiryDays").value = result.maxExpiryDays || "15"; | ||
document.querySelector("#cc").value = result.maxExpiryDays || "15"; | ||
} | ||
|
||
function onError(error) { | ||
console.log(`Error: ${error}`); | ||
} | ||
|
||
let getting = browser.storage.sync.get("maxExpiryDays"); | ||
getting.then(setCurrentChoice, onError); | ||
document.querySelector("#maxExpiryDays") | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", restoreOptions); | ||
document.querySelector("form").addEventListener("submit", saveOptions); | ||
let myinput = document.querySelector("#maxExpiryDays"); | ||
myinput.addEventListener("input", () => { | ||
document.getElementById("cc").value = myinput.value; | ||
}); | ||
|
||
let cc = document.querySelector("#cc"); | ||
cc.addEventListener("input", () => { | ||
document.getElementById("maxExpiryDays").value = cc.value; | ||
}); | ||
document.addEventListener("DOMContentLoaded", restoreOptions); |