From ca0f446d2f3782a26af353b1afaa2a24b91b3d94 Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Sat, 7 Nov 2015 21:24:01 -0800 Subject: [PATCH] show controller on keyboard input --- inject.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/inject.js b/inject.js index c5683c8..83c02ee 100644 --- a/inject.js +++ b/inject.js @@ -15,6 +15,7 @@ chrome.extension.sendMessage({}, function(response) { } }; + var controllerAnimation; var readyStateCheckInterval; chrome.storage.sync.get(tc.settings, function(storage) { tc.settings.speed = Number(storage.speed); @@ -164,6 +165,27 @@ chrome.extension.sendMessage({}, function(response) { } else if (action === 'reset') { setSpeed(v, 1.0); } + + // show controller on keyboard input + var controller = v.parentElement + .getElementsByClassName('tc-videoController')[0]; + controller.style.visibility = 'visible'; + if (controllerAnimation != null + && controllerAnimation.playState != 'finished') { + controllerAnimation.cancel(); + } + controllerAnimation = controller.animate([ + {opacity: 0.3}, + {opacity: 0.3}, + {opacity: 0.0}, + ], { + duration: 3000, + iterations: 1, + delay: 0 + }); + player.onfinish = function(e) { + controller.style.visibility = 'hidden'; + } } }); }