Greasy Fork is available in English.

Next/Previous navigation with arrow keys!

Use the arrow keys to navigate the next or previous pages of tutorials ;)

2025-03-05 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

  1. // ==UserScript==
  2. // @name Next/Previous navigation with arrow keys!
  3. // @namespace Violentmonkey Scripts
  4. // @match https://www.w3schools.com/*/*
  5. // @grant none
  6. // @version 1.1
  7. // @author AvinashReddy3108 (assisted by ChatGPT)
  8. // @license WTFPL
  9. // @description Use the arrow keys to navigate the next or previous pages of tutorials ;)
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. document.addEventListener('keydown', function(event) {
  16. if (event.target.tagName.toLowerCase() === 'input' || event.target.tagName.toLowerCase() === 'textarea') {
  17. return; // Ignore inputs and textareas
  18. }
  19.  
  20. // Container which has the next/previous buttons
  21. let container = document.querySelector("div.w3-clear.nextprev");
  22. if (!container) return;
  23.  
  24. // The Next/Previous buttons
  25. let prevButton = container.querySelector("a.w3-left.w3-btn");
  26. let nextButton = container.querySelector("a.w3-right.w3-btn");
  27.  
  28. if (event.key === 'ArrowLeft' && prevButton) {
  29. window.location.href = prevButton.href;
  30. } else if (event.key === 'ArrowRight' && nextButton) {
  31. window.location.href = nextButton.href;
  32. }
  33. });
  34. })();