Sleazy Fork is available in English.

Derpibooru - Scroll-to

Immediately go to the part-scaled image, fill the screen as much as possible. Also adds more convenient next/prev navigation

  1. // ==UserScript==
  2. // @name Derpibooru - Scroll-to
  3. // @namespace Selbi
  4. // @include http*://*derpibooru.org/images/*
  5. // @version 2.1.2
  6. // @description Immediately go to the part-scaled image, fill the screen as much as possible. Also adds more convenient next/prev navigation
  7. // ==/UserScript==
  8.  
  9. let prev = document.querySelector(".js-prev").cloneNode(true);
  10. let next = document.querySelector(".js-next").cloneNode(true);
  11. prev.querySelector("i").classList = "fa fa-play fa-flip-horizontal";
  12. next.querySelector("i").classList = "fa fa-play";
  13.  
  14. let jk = document.createElement("div");
  15. jk.innerHTML = prev.outerHTML + " " + next.outerHTML;
  16. jk.style.position = "fixed";
  17. jk.style.right = "10px";
  18. jk.style.bottom = "10px";
  19. jk.style.opacity = "0.1";
  20. jk.style.fontSize = "6em";
  21.  
  22. let body = document.querySelector("body");
  23. body.appendChild(jk);
  24.  
  25. document.onkeyup = function(e) {
  26. if (document.activeElement.tagName.toLowerCase() == "body") {
  27. if (e.key == "ArrowLeft") {
  28. prev.click();
  29. } else if (e.key =="ArrowRight") {
  30. next.click();
  31. }
  32. }
  33. };
  34.  
  35. ///
  36.  
  37. document.querySelector("body").style.minHeight = "1600px";
  38.  
  39. window.addEventListener('load', function() {
  40. clickAndScroll();
  41. }, true);
  42.  
  43. function clickAndScroll() {
  44. let img = document.querySelector(".image-show-container .image-target");
  45. img.click();
  46. let y = getTargetY(img)
  47. scrollToY(y);
  48. }
  49.  
  50. function getTargetY(elem) {
  51. let y = Math.round(elem.getBoundingClientRect().top + window.scrollY - 3);
  52. return y;
  53. }
  54.  
  55. function scrollToY(y) {
  56. window.scrollTo({top: y});
  57. }