From bece740d3fbd5007df34ed6f2fd9f6dbea9ff2a6 Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Thu, 18 Feb 2021 10:53:22 -0600 Subject: [PATCH] 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...) --- DuckDuckGo Images Slideshow.user.js | 30 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/DuckDuckGo Images Slideshow.user.js b/DuckDuckGo Images Slideshow.user.js index 2dca45a..0564d50 100644 --- a/DuckDuckGo Images Slideshow.user.js +++ b/DuckDuckGo Images Slideshow.user.js @@ -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; }); })(); \ No newline at end of file