-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added options page and show changelog functionality to extension.
Closes #317.
- Loading branch information
Showing
4 changed files
with
64 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Saves options to chrome.storage | ||
function save_options() { | ||
var showChangeLog = document.getElementById('show_changelog').checked; | ||
chrome.storage.sync.set({ | ||
showChangeLog: showChangeLog | ||
}, function () { | ||
// Update status to let user know options were saved. | ||
var status = document.getElementById('status'); | ||
status.textContent = 'Options saved.'; | ||
setTimeout(function () { | ||
status.textContent = ''; | ||
}, 750); | ||
}); | ||
} | ||
|
||
// Restores select box and checkbox state using the preferences | ||
// stored in chrome.storage. | ||
function restore_options() { | ||
// Use default value showChangeLog = true. | ||
chrome.storage.sync.get({ | ||
showChangeLog: true | ||
}, function (items) { | ||
document.getElementById('show_changelog').checked = items.showChangeLog; | ||
}); | ||
} | ||
document.addEventListener('DOMContentLoaded', restore_options); | ||
document.getElementById('save').addEventListener('click', | ||
save_options); |
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,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Altair Options</title> | ||
</head> | ||
|
||
<body> | ||
<div> | ||
<label> | ||
<input type="checkbox" id="show_changelog"> Show changelog on update | ||
</label> | ||
</div> | ||
|
||
<div id="status"></div> | ||
<button id="save">Save</button> | ||
|
||
<script src="js/options.js"></script> | ||
</body> | ||
|
||
</html> |