diff --git a/yr.user.js b/yr.user.js index e7c7b10..cb2c0d3 100644 --- a/yr.user.js +++ b/yr.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name YR.no - Hotkeys // @namespace https://git.ntnu.no/M365-Drift/MonkeyMagic/ -// @version 1.3.0 +// @version 1.3.1 // @description Navigate the yr.no navbar using `Ctrl` + `←`/`→`. Navigate to 21-day forecast, radar map or daily table view using `Alt` + `L`, `Alt` + `R` or `Alt` + `V`. Show a menu to navigate through favorite locations with `Ctrl` + `Shift` + `F`. // @author Øyvind Nilsen (on@ntnu.no) // @match https://www.yr.no/* @@ -71,7 +71,6 @@ menu.innerHTML = ''; menu.style.display = 'block'; @@ -108,9 +107,11 @@ if (event.key === 'Escape') { hideMenu(); } else if (event.key === 'ArrowUp') { + event.preventDefault(); // Prevent default scrolling behavior selectedIndex = (selectedIndex > 0) ? selectedIndex - 1 : items.length - 1; highlightSelected(); } else if (event.key === 'ArrowDown') { + event.preventDefault(); // Prevent default scrolling behavior selectedIndex = (selectedIndex < items.length - 1) ? selectedIndex + 1 : 0; highlightSelected(); } else if (event.key === 'Enter') {