Steam Screenshot Arrow and Wheel Controls

Allows you to use the arrow keys to switch screenshots.

  1. // ==UserScript==
  2. // @name Steam Screenshot Arrow and Wheel Controls
  3. // @namespace Steam Screenshot Arrow and Wheel Controls
  4. // @description Allows you to use the arrow keys to switch screenshots.
  5. // @author kriscross07
  6. // @include *.steampowered.com/app/*
  7. // @include *steamcommunity.com/sharedfiles/filedetails/*
  8. // @version 1
  9. // @run-at document-start
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. addEventListener('DOMContentLoaded',function(){
  14. $('#highlight_strip').addEventListener('wheel',function(e){
  15. e.preventDefault();
  16. e.deltaY<0&&prev();
  17. e.deltaY>0&&next();
  18. });
  19. addEventListener('keydown',function(e){
  20. e.which==37&&prev(),e.preventDefault();
  21. e.which==39&&next(),e.preventDefault();
  22. });
  23. function $(selector){
  24. if(!selector)return null;
  25. if(selector.charAt(0)=='#')return document.querySelector(selector);
  26. else return document.querySelectorAll(selector);
  27. }
  28. function next(){
  29. $('.focus')[0].nextSibling.nextSibling&&$('.focus')[0].nextSibling.nextSibling.click();
  30. }
  31. function prev(){
  32. $('.focus')[0].previousSibling.previousSibling&&$('.focus')[0].previousSibling.previousSibling.click();
  33. }
  34. });