Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name e621 Post Stuff
- // @version 0.1
- // @description Shtuff
- // @author Chronos Ouroboros
- // @match https://e621.net/post/show/*
- // @match http://e621.net/post/show/*
- // @grant none
- // ==/UserScript==
- //176827
- //Previous: <a href="/post/show/"><<</a>
- //Next: <a href="/post/show/">>></a>
- var links = document.getElementsByTagName ("a");
- var previousLink = "";
- var nextLink = "";
- for (var i = 0; i < links.length; i++) {
- if (links [i].innerHTML == "<<") {
- previousLink = links[i].href;
- break;
- }
- }
- for (var i = 0; i < links.length; i++) {
- if (links [i].innerHTML == ">>") {
- nextLink = links[i].href;
- break;
- }
- }
- document.onkeypress = function (e) {
- e = e || window.event;
- if (document.activeElement.tagName.toUpperCase() != "TEXTAREA" &&
- document.activeElement.tagName.toUpperCase() != "INPUT") {
- if ((e.keyCode == 101 || e.keyCode == 69) &&
- (nextLink != ""))
- document.location.href = nextLink;
- else if ((e.keyCode == 113 || e.keyCode == 81)
- && (previousLink != ""))
- document.location.href = previousLink;
- if (e.keyCode == 119 ||
- e.keyCode == 87)
- window.scrollBy(0, -40);
- else if (e.keyCode == 115 || e.keyCode == 83)
- window.scrollBy(0, 40);
- if (e.keyCode == 97 || e.keyCode == 65)
- window.scrollBy(-40, 0);
- else if (e.keyCode == 100 || e.keyCode == 68)
- window.scrollBy(40, 0);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement