forked from containers-everywhere/contain-google
-
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.
Merge pull request containers-everywhere#43 from berrnd/feature-ignor…
…e-optionally-youtube-and-searchpages Add options to ignore YouTube and Google Search Pages
- Loading branch information
Showing
4 changed files
with
122 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,40 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
<form> | ||
|
||
<h1>Settings</h1> | ||
|
||
<hr> | ||
|
||
<p> | ||
<label> | ||
<input type="checkbox" id="ignore_youtube" value="1"> | ||
Ignore YouTube<br> | ||
<em>(Means don't use Google Container for YouTube sites.)<em> | ||
</label> | ||
</p> | ||
|
||
<p> | ||
<label> | ||
<input type="checkbox" id="ignore_searchpages" value="1"> | ||
Ignore search pages<br> | ||
<em>(Means don't use Google Container on Google sites with a path of <code>/search</code>, <code>/maps</code> or <code>/flights</code>.)<em> | ||
</label> | ||
</p> | ||
|
||
<button type="submit">Save settings</button> | ||
|
||
<hr> | ||
|
||
</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); |