Advertisement
Guest User

e621 swimmer march 2020

a guest
Mar 6th, 2020
209
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.         document.addEventListener('keydown', function (e) {
  14.             if (e.keyCode === 37 && prev != null && e.ctrlKey) {
  15.                 window.location = prev.href;
  16.             }
  17.             else if (e.keyCode === 39 && next != null && e.ctrlKey) {
  18.                 window.location = next.href;
  19.             }
  20.         }, false);
  21.     }
  22. }()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement