Advertisement
Guest User

Untitled

a guest
Oct 30th, 2020
272
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/posts/*
  5. // @grant            none
  6. // ==/UserScript==
  7.  
  8. window.onload = function () {
  9.     if (document.getElementsByClassName('pool-category-series')[0]) {
  10.         let poolNavList = Array.prototype.slice.call(document.getElementsByClassName('pool-category-series')[0].childNodes);
  11.         var prev = poolNavList.find(c => c.className === 'prev');
  12.         var next = poolNavList.find(c => c.className === 'next');
  13.         console.log(next.href);
  14.         document.addEventListener('keydown', function (e) {
  15.             if (e.keyCode === 37 && prev.href && e.ctrlKey) {
  16.                 window.location = prev.href;
  17.             }
  18.             else if (e.keyCode === 39 && next.href && e.ctrlKey) {
  19.                 window.location = next.href;
  20.             }
  21.         }, false);
  22.     }
  23. }()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement