Steam Game Guides Navigation Tweak

Converts onclick javascript into a big nasty <a> element. Not HTML4 valid, but browsers understand it fine.

  1. // ==UserScript==
  2. // @name Steam Game Guides Navigation Tweak
  3. // @description Converts onclick javascript into a big nasty <a> element. Not HTML4 valid, but browsers understand it fine.
  4. // @license GPLv3
  5. // @namespace StupidWeasel/SteamCommunity/SteamGameGuidesNavigationTweak
  6. // @include /^https?://steamcommunity\.com/app/.*/guides/.*$/
  7. // @version 1.00
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /*
  12. Steam Game Guides Navigation Tweak - A GreaseMonkey script for easier gameguide navigation
  13. Copyright (C) 2016 Alex "StupidWeasel" Bolton
  14.  
  15. This program is free software: you can redistribute it and/or modify
  16. it under the terms of the GNU General Public License as published by
  17. the Free Software Foundation, either version 3 of the License, or
  18. (at your option) any later version.
  19.  
  20. This program is distributed in the hope that it will be useful,
  21. but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. GNU General Public License for more details.
  24.  
  25. You should have received a copy of the GNU General Public License
  26. along with this program. If not, see <http://www.gnu.org/licenses/>.
  27. */
  28. var guides = document.getElementsByClassName('workshopItemCollectionContainer');
  29. for(var i=0;i<guides.length;i++){
  30. var thisGuide = guides[i].childNodes[1];
  31. var oldMarkup = thisGuide.innerHTML;
  32. if (thisGuide.getAttribute("onclick")){ // If the markup changes or if the script has already run, we dont want to break things.
  33. var thisonclick = thisGuide.getAttribute("onclick")
  34. thisGuide.innerHTML = '<a href="' + thisonclick.slice(19,thisonclick.length-1) + '" />' + oldMarkup + '</a>';
  35. thisGuide.removeAttribute("onclick")
  36. }
  37. }