e621 Thumbnail Enhancer 2

Resizes thumbnails on e621.net and replaces them with hi-rez version. Modified for the new site design sometime around 2020-03-06

Från och med 2020-03-06. Se den senaste versionen.

  1. // ==UserScript==
  2. // @name e621 Thumbnail Enhancer 2
  3. // @version 1.01
  4. // @description Resizes thumbnails on e621.net and replaces them with hi-rez version. Modified for the new site design sometime around 2020-03-06
  5. // @author justrunmyscripts
  6. // @include *://*e621.net*
  7. // @grant GM.xmlHttpRequest
  8. // @namespace https://sleazyfork.org/en/users/96703-justrunmyscripts
  9. // ==/UserScript==
  10.  
  11. // original script creator https://greasyfork.org/de/users/398891
  12. // to edit the size of the thumbnails, change the 700px values below (the ones marked with !important... I know, I know... I got lazy, but I think user scripts are perhaps the one time it's actually "fine" to use !important >:D)
  13.  
  14. var sty =document.createElement("style");
  15. sty.innerHTML=[
  16. ""
  17. ,".thumbEnh_cont {"
  18. ," display: flex;"
  19. ," flex-flow: row wrap;"
  20. ,"}"
  21. ,".thumbEnh_cont img.thumbEnh_img {"
  22. ," max-height: 100%;"
  23. ," max-width: 100%;"
  24. ,"}"
  25. ,"article.post-preview {"
  26. ," height: 700px !important;"
  27. ," width: 700px !important;"
  28. ,"}"
  29. ,"article.post-preview > a, article.post-preview > a > picture {"
  30. ," height: 94%;"
  31. ," width: 100%;"
  32. ,"}"
  33. ].join("");
  34. document.head.appendChild(sty);
  35.  
  36.  
  37. (function () {
  38. var contDiv = document.querySelector("#posts-container");
  39. contDiv.className = "thumbEnh_cont";
  40.  
  41. function replacerHiRez(element, property) {
  42. element[property] = element[property].replace('/preview/', '/sample/');
  43. }
  44.  
  45. var imgs = document.querySelectorAll('article.post-preview img');
  46. for (img of imgs) {
  47. img.className = "thumbEnh_img";
  48. replacerHiRez(img, 'src');
  49. }
  50. var sources = document.querySelectorAll('article.post-preview source');
  51. for (source of sources) {
  52. replacerHiRez(source, 'srcset');
  53. }
  54. })();