PC link - protondb.com

12/16/2022, 6:51:45 AM

  1. // ==UserScript==
  2. // @name PC link - protondb.com
  3. // @namespace monnef.eu
  4. // @match https://www.protondb.com/app/*
  5. // @grant none
  6. // @version 1.1
  7. // @author -
  8. // @description 12/16/2022, 6:51:45 AM
  9. // @require https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js
  10. // @license GPLv3
  11. // ==/UserScript==
  12.  
  13. const prefix = 'pcLink';
  14. const linkId = prefix + '-link';
  15.  
  16. const work = () => {
  17. if ($('#' + linkId).length) return;
  18. const el = $('[data-testid=DesktopWindowsIcon]');
  19. if (!el.length) return;
  20. const pcLink = $('<a>')
  21. .text('▼ PC 🖥️')
  22. .click(() => el[0].scrollIntoView())
  23. .css({ marginRight: '10px', cursor: 'pointer', textDecoration: 'underline' })
  24. .attr('id', linkId)
  25. ;
  26. $('a:contains("Steam")[href*="store.steam"]').first().before(pcLink);
  27. }
  28.  
  29. $(() => setInterval(work, 500));