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 #62 from Jackymancs4-Fork/master
Add native notification, options page and minor app refactoring.
- Loading branch information
Showing
6 changed files
with
57 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,20 @@ | ||
// tslint:disable-next-line:variable-name | ||
const __browser = chrome || browser; | ||
|
||
function saveOptions(e: Event) { | ||
e.preventDefault(); | ||
__browser.storage.local.set({ | ||
enableNotifications: document.querySelector<HTMLInputElement>('#enable-notifications')!.checked | ||
}); | ||
} | ||
|
||
function restoreOptions() { | ||
function setCurrentChoice(result: any) { | ||
document.querySelector<HTMLInputElement>('#enable-notifications')!.checked = result.enableNotifications; | ||
} | ||
|
||
__browser.storage.local.get('enableNotifications', setCurrentChoice); | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', restoreOptions); | ||
document.querySelector('form')!.addEventListener('submit', saveOptions); |
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,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
<form> | ||
<label>Show notifications: <input type="checkbox" id="enable-notifications" checked></label> | ||
<br> | ||
<br> | ||
<button type="submit">Save</button> | ||
</form> | ||
<script src="js/options.js"></script> | ||
</body> | ||
|
||
</html> |