mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-22 02:18:45 -04:00
YT fix: show on keyboard input
This commit is contained in:
@@ -11,6 +11,11 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ytp-autohide .vcs-show {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
/* YouTube embedded player */
|
/* YouTube embedded player */
|
||||||
/* e.g. https://www.igvita.com/2012/09/12/web-fonts-performance-making-pretty-fast/ */
|
/* e.g. https://www.igvita.com/2012/09/12/web-fonts-performance-making-pretty-fast/ */
|
||||||
.full-frame .html5-video-player:not(.ytp-fullscreen) .vsc-controller {
|
.full-frame .html5-video-player:not(.ytp-fullscreen) .vsc-controller {
|
||||||
|
30
inject.js
30
inject.js
@@ -15,7 +15,6 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var controllerAnimation;
|
|
||||||
chrome.storage.sync.get(tc.settings, function(storage) {
|
chrome.storage.sync.get(tc.settings, function(storage) {
|
||||||
tc.settings.speed = Number(storage.speed);
|
tc.settings.speed = Number(storage.speed);
|
||||||
tc.settings.speedStep = Number(storage.speedStep);
|
tc.settings.speedStep = Number(storage.speedStep);
|
||||||
@@ -209,8 +208,7 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
|
|
||||||
videoTags.forEach(function(v) {
|
videoTags.forEach(function(v) {
|
||||||
var id = v.dataset['vscid'];
|
var id = v.dataset['vscid'];
|
||||||
var controller = document.querySelector(`div[data-vscid="${id}"]`)
|
var controller = document.querySelector(`div[data-vscid="${id}"]`);
|
||||||
.shadowRoot.querySelector('#controller');
|
|
||||||
|
|
||||||
if (keyboard)
|
if (keyboard)
|
||||||
showController(controller);
|
showController(controller);
|
||||||
@@ -240,23 +238,19 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var timer;
|
||||||
|
var animation = false;
|
||||||
function showController(controller) {
|
function showController(controller) {
|
||||||
controller.style.visibility = 'visible';
|
controller.classList.add('vcs-show');
|
||||||
if (controllerAnimation != null
|
|
||||||
&& controllerAnimation.playState != 'finished') {
|
|
||||||
controllerAnimation.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO : if controller is visible, do not start animation.
|
if (animation)
|
||||||
controllerAnimation = controller.animate([
|
clearTimeout(timer);
|
||||||
{opacity: 0.3},
|
|
||||||
{opacity: 0.3},
|
animation = true;
|
||||||
{opacity: 0.0},
|
timer = setTimeout(function() {
|
||||||
], {
|
controller.classList.remove('vcs-show');
|
||||||
duration: 2000,
|
animation = false;
|
||||||
iterations: 1,
|
}, 2000);
|
||||||
delay: 0
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeWhenReady(document);
|
initializeWhenReady(document);
|
||||||
|
Reference in New Issue
Block a user