Difetra / e621 big thumbs

// ==UserScript==
// @name        e621 big thumbs
// @namespace   difetra
// @include     https://e621.net/post/*
// @version     1
// @grant       none
// ==/UserScript==

var scale = 1.5; //multiplies original thumbnail size.

function injectCSS() {
  var css = [
    ".thumb {",
    " width: unset !important;",
    " height: unset !important;",
    " margin: 5px !important;",
    "}",
    ".post-score {",
    " width: unset !important;;",
    "}",
    ".post-score span {",
    " font-size: 90% !important;",
    "}",
    "img.preview {",
    " border-radius: 0 !important;",
    "}"
  ];
  var style = document.createElement("style");
  style.innerHTML = css.join("");
  document.head.appendChild(style);
 
}

function replaceThumbs() {
  var thumbImages = document.querySelectorAll(".thumb .preview");
  for (i = 0; i < thumbImages.length; i++) {
    var image = thumbImages[i];
    let imageSrc = image.src;
    if (image.alt.search("flash") == -1 || image.hasClassName("deleted") === false) {
     image.src = image.src.replace("preview", "sample"); 
    }
    image.setAttribute("width", image.getAttribute("width") * scale);
    image.setAttribute("height", image.getAttribute("height") * scale);
    image.addEventListener("error", function() {
      //now I can either go back to the old thumbnail or load the full image.
      this.src = imageSrc; //this.src.replace("sample/","");
    })
  }
}

injectCSS();
replaceThumbs();