mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 18:08:46 -04:00
Adding feature - Show the controller briefly when adjusting speed and the controller is set to hidden. (#538)
Adding new feature: when the controller is hidden and the user changes rate, show the controller briefly. A new action called `blink` is added, and is called when the rate changes. Then if the controller is hidden, remove `vsc-hidden` and add it back after `value` millisecends.
This commit is contained in:
12
inject.js
12
inject.js
@@ -172,6 +172,8 @@
|
|||||||
chrome.storage.sync.set({'lastSpeed': speed}, function() {
|
chrome.storage.sync.set({'lastSpeed': speed}, function() {
|
||||||
console.log('Speed setting saved: ' + speed);
|
console.log('Speed setting saved: ' + speed);
|
||||||
});
|
});
|
||||||
|
// show the controller for 1000ms if it's hidden.
|
||||||
|
runAction('blink', document, null, null);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
@@ -494,6 +496,16 @@
|
|||||||
} else if (action === 'display') {
|
} else if (action === 'display') {
|
||||||
controller.classList.add('vsc-manual');
|
controller.classList.add('vsc-manual');
|
||||||
controller.classList.toggle('vsc-hidden');
|
controller.classList.toggle('vsc-hidden');
|
||||||
|
} else if (action === 'blink') {
|
||||||
|
// if vsc is hidden, show it briefly to give the use visual feedback that the action is excuted.
|
||||||
|
if(controller.classList.contains('vsc-hidden') || controller.blinkTimeOut !== undefined){
|
||||||
|
clearTimeout(controller.blinkTimeOut);
|
||||||
|
controller.classList.remove('vsc-hidden');
|
||||||
|
controller.blinkTimeOut = setTimeout(()=>{
|
||||||
|
controller.classList.add('vsc-hidden');
|
||||||
|
controller.blinkTimeOut = undefined;
|
||||||
|
}, value ? value : 1000);
|
||||||
|
}
|
||||||
} else if (action === 'drag') {
|
} else if (action === 'drag') {
|
||||||
handleDrag(v, controller, e);
|
handleDrag(v, controller, e);
|
||||||
} else if (action === 'fast') {
|
} else if (action === 'fast') {
|
||||||
|
Reference in New Issue
Block a user