Advertisement
Guest User

Untitled

a guest
Mar 11th, 2019
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name             E621 Swimmer
  3. // @description      Navigate e621's pools with arrow keys
  4. // @include          http*://e621.net/post/show/*
  5. // @grant            none
  6. // ==/UserScript==
  7.  
  8. /*
  9.  * Remove these comments if you want images to
  10.  * automatically expand on load and the window
  11.  * to scroll to the image.
  12.  */
  13. // window.location = '#image' //moves the screen to the image. kinda buggy if the banner disappears.
  14. // var e = new Event('click');
  15. // document.getElementById('highres').dispatchEvent(e); //loads the highres image
  16.  
  17. var tags = document.getElementsByTagName('a');
  18.  
  19. for(var i = 0; i < tags.length; ++i) {
  20.     if(tags[i].innerText === '<< Previous') {
  21.         var prev = tags[i].href;
  22.     }
  23.     else if(tags[i].innerText === "Next >>") {
  24.         var next = tags[i].href;
  25.         break
  26.     }
  27. }
  28. document.addEventListener('keydown', function (e) {
  29.     if (e.keyCode === 37 && prev != null && e.ctrlKey) {
  30.         window.location = prev;
  31.     }
  32.     else if (e.keyCode === 39 && next != null && e.ctrlKey) {
  33.         window.location = next;
  34.     }
  35. }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement