FreshRSS Open in Background Tab

Open the selected link in a new background tab

  1. // ==UserScript==
  2. // @name FreshRSS Open in Background Tab
  3. // @namespace https://github.com/hiroki-miya
  4. // @version 1.0.0
  5. // @description Open the selected link in a new background tab
  6. // @author hiroki-miya
  7. // @license MIT
  8. // @match https://freshrss.example.net
  9. // @grant GM_openInTab
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Shortcut key setting(Default: ";")
  16. const shortcutKey = ';';
  17.  
  18. // Function to execute when the shortcut key is pressed
  19. function handleShortcut(event) {
  20. if (event.key === shortcutKey) {
  21. const activeLink = document.querySelector('.current .item.titleAuthorSummaryDate a[href^="http"]');
  22. if (activeLink) {
  23. GM_openInTab(activeLink.href);
  24. }
  25. }
  26. }
  27.  
  28. // Add event listener for the shortcut key
  29. document.addEventListener('keydown', handleShortcut);
  30. })();