Use keyboard to change pagination

Use '<' and '>' to change LinkedIn's pagination

  1. // ==UserScript==
  2. // @name Use keyboard to change pagination
  3. // @namespace https://github.com/gslin/use-keyboard-to-change-linkedin-pagination
  4. // @match https://www.linkedin.com/*
  5. // @grant none
  6. // @version 0.20240109.0
  7. // @author Gea-Suan Lin <gslin@gslin.com>
  8. // @description Use '<' and '>' to change LinkedIn's pagination
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (() => {
  13. 'use strict';
  14.  
  15. document.addEventListener('keyup', function(ev) {
  16. const ae = document.activeElement.tagName.toLowerCase();
  17. if ('input' === ae || 'textarea' === ae) {
  18. return;
  19. }
  20. if ('<' === ev.key) {
  21. document.querySelector('button[aria-label="Previous"]')?.click();
  22. return;
  23. }
  24. if ('>' === ev.key) {
  25. document.querySelector('button[aria-label="Next"]')?.click();
  26. return;
  27. }
  28. });
  29. })();