From ac53d3ea2ba5ca508cc46e1295e81be36416e5af Mon Sep 17 00:00:00 2001 From: Yang Date: Thu, 14 Nov 2019 01:55:25 -0500 Subject: [PATCH] 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. --- inject.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/inject.js b/inject.js index a09e49e..2971df7 100644 --- a/inject.js +++ b/inject.js @@ -172,6 +172,8 @@ chrome.storage.sync.set({'lastSpeed': speed}, function() { console.log('Speed setting saved: ' + speed); }); + // show the controller for 1000ms if it's hidden. + runAction('blink', document, null, null); } }.bind(this)); @@ -494,6 +496,16 @@ } else if (action === 'display') { controller.classList.add('vsc-manual'); 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') { handleDrag(v, controller, e); } else if (action === 'fast') {