Update 'DuckDuckGo Images Slideshow.user.js'

Use 'h'/'l' for previous/next, you can't disable Left/Right in DDG settings. 
(And stopping propagation doesn't seem to work? Or I'm doing it wrong...)
This commit is contained in:
Brian Buller 2021-02-18 10:53:22 -06:00
parent bf629f95c5
commit bece740d3f

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name DuckDuckGo Images Slideshow
// @namespace https://bullercodeworks.com
// @version 0.1
// @version 0.2
// @description Takes a DuckDuckGo Images page and turns it into a slideshow.
// @author You
// @match https://duckduckgo.com/*
@ -162,29 +162,39 @@
showImage(currimg);
}
document.addEventListener('keyup',(e)=>{
document.addEventListener('keydown',(e)=>{
if(!running) { return; }
var stopProp = false;
switch(e.code) {
case 'Space':
pause();
return true;
case 'ArrowLeft':
stopProp = true;
break;
case 'KeyH':
rewind();
return true;
case 'ArrowRight':
stopProp = true;
break;
case 'KeyL':
fastforward();
return true;
stopProp = true;
break;
case 'KeyT':
promptTime();
return true;
stopProp = true;
break;
case 'KeyG':
goto();
return true;
stopProp = true;
break;
case 'Escape':
clearTimeout(timer);
running = false;
lb.remove();
stopProp = true;
}
if(stopProp) {
e.stopPropagation();
}
return stopProp;
});
})();