-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added two options (including options page):
Ignore YouTube (to not being logged into Google on YouTube, originally done by https://github.com/yoasif/contain-google-minus-youtube, but without having that optionally) Ignore search pages (to not being logged into Google for Google searches, includes maps and flight search)
- Loading branch information
Showing
4 changed files
with
98 additions
and
2 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
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,32 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
<form> | ||
|
||
<p> | ||
<label> | ||
<input type="checkbox" id="ignore_youtube" value="1"> | ||
Ignore YouTube | ||
</label> | ||
</p> | ||
|
||
<p> | ||
<label> | ||
<input type="checkbox" id="ignore_searchpages" value="1"> | ||
Ignore search pages | ||
</label> | ||
</p> | ||
|
||
<button type="submit">Save settings</button> | ||
|
||
</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,26 @@ | ||
function onOptionsPageSave(e) | ||
{ | ||
e.preventDefault(); | ||
|
||
// Save settings | ||
browser.storage.sync.set({ | ||
"ignore_youtube": document.querySelector("#ignore_youtube").checked, | ||
"ignore_searchpages": document.querySelector("#ignore_searchpages").checked | ||
}); | ||
|
||
browser.runtime.reload(); | ||
} | ||
|
||
function onOptionsPageLoaded() | ||
{ | ||
// Load saved settings or use defaults when nothing was saved yet | ||
var storageItem = browser.storage.sync.get(); | ||
storageItem.then((res) => | ||
{ | ||
document.querySelector("#ignore_youtube").checked = res.ignore_youtube || false; | ||
document.querySelector("#ignore_searchpages").checked = res.ignore_searchpages || false; | ||
}); | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", onOptionsPageLoaded); | ||
document.querySelector("form").addEventListener("submit", onOptionsPageSave); |