-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rudimentary but functional Firefox options panel with checkbox to offer 5.1 audio if available.
- Loading branch information
1 parent
907f966
commit 85dccfb
Showing
5 changed files
with
96 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
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,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<style> | ||
body { | ||
margin: 2em 3em; | ||
} | ||
.pref-box { | ||
display: block; | ||
margin: 1em 0;; | ||
} | ||
label, input { | ||
line-height: 150%; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="pref-box"> | ||
<label> | ||
<input type="checkbox" id="5.1">Use 5.1 audio when available</input> | ||
</label> | ||
</div> | ||
|
||
<div id="status"></div> | ||
|
||
<div class="pref-box"> | ||
<button id="save">Save</button> | ||
</div> | ||
|
||
<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,35 @@ | ||
function save_options(e) { | ||
e.preventDefault(); | ||
var use6Channels = document.getElementById('5.1').checked; | ||
// var setMaxBitrate = document.getElementById('setMaxBitrate').checked; | ||
browser.storage.sync.set({ | ||
use6Channels: use6Channels, | ||
// setMaxBitrate: setMaxBitrate | ||
}, function() { | ||
var status = document.getElementById('status'); | ||
status.textContent = 'Options saved.'; | ||
setTimeout(function() { | ||
status.textContent = ''; | ||
}, 750); | ||
}); | ||
} | ||
|
||
function restore_options() { | ||
function setCurrentChoice(result) { | ||
document.getElementById('5.1').checked = result.use6Channels; | ||
// document.getElementById('setMaxBitrate').checked = result.setMaxBitrate; | ||
} | ||
function onError(error) { | ||
console.log(`Error: ${error}`); | ||
} | ||
|
||
var getting = browser.storage.sync.get({ | ||
use6Channels: false, | ||
// setMaxBitrate: false | ||
}); | ||
getting.then(setCurrentChoice, onError); | ||
|
||
} | ||
|
||
document.addEventListener('DOMContentLoaded', restore_options); | ||
document.getElementById('save').addEventListener('click', save_options); |