mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-22 02:18:45 -04:00
fix settings page, closes #9
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Video Speed Controller",
|
"name": "Video Speed Controller",
|
||||||
"short_name": "videospeed",
|
"short_name": "videospeed",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Speed up, slow down, and rewind any HTML5 video with quick shortcuts.",
|
"description": "Speed up, slow down, and rewind any HTML5 video with quick shortcuts.",
|
||||||
"homepage_url": "https://github.com/igrigorik/videospeed",
|
"homepage_url": "https://github.com/igrigorik/videospeed",
|
||||||
|
28
options.js
28
options.js
@@ -81,7 +81,6 @@ function restore_options() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function restore_defaults() {
|
function restore_defaults() {
|
||||||
|
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
speedStep: 0.1,
|
speedStep: 0.1,
|
||||||
rewindTime: 10,
|
rewindTime: 10,
|
||||||
@@ -98,23 +97,24 @@ function restore_defaults() {
|
|||||||
status.textContent = '';
|
status.textContent = '';
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event Listeners
|
|
||||||
document.addEventListener('DOMContentLoaded', restore_options);
|
|
||||||
document.getElementById('save').addEventListener('click', save_options);
|
|
||||||
document.getElementById('restore').addEventListener('click', restore_defaults);
|
|
||||||
|
|
||||||
initShortcutInput('rewindKeyInput');
|
|
||||||
initShortcutInput('slowerKeyInput');
|
|
||||||
initShortcutInput('fasterKeyInput');
|
|
||||||
|
|
||||||
document.getElementById('rewindTime').addEventListener('keypress', inputFilterNumbersOnly);
|
|
||||||
document.getElementById('speedStep').addEventListener('keypress', inputFilterNumbersOnly);
|
|
||||||
|
|
||||||
function initShortcutInput(inputId) {
|
function initShortcutInput(inputId) {
|
||||||
document.getElementById(inputId).addEventListener('focus', inputFocus);
|
document.getElementById(inputId).addEventListener('focus', inputFocus);
|
||||||
document.getElementById(inputId).addEventListener('blur', inputBlur);
|
document.getElementById(inputId).addEventListener('blur', inputBlur);
|
||||||
document.getElementById(inputId).addEventListener('keypress', recordKeyPress);
|
document.getElementById(inputId).addEventListener('keypress', recordKeyPress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
restore_options();
|
||||||
|
|
||||||
|
document.getElementById('save').addEventListener('click', save_options);
|
||||||
|
document.getElementById('restore').addEventListener('click', restore_defaults);
|
||||||
|
|
||||||
|
initShortcutInput('rewindKeyInput');
|
||||||
|
initShortcutInput('slowerKeyInput');
|
||||||
|
initShortcutInput('fasterKeyInput');
|
||||||
|
|
||||||
|
document.getElementById('rewindTime').addEventListener('keypress', inputFilterNumbersOnly);
|
||||||
|
document.getElementById('speedStep').addEventListener('keypress', inputFilterNumbersOnly);
|
||||||
|
})
|
||||||
|
Reference in New Issue
Block a user