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

目前為 2020-03-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         e621 Thumbnail Enhancer 2
// @version      1.00
// @description  Resizes thumbnails on e621.net and replaces them with hi-rez version. Modified for the new site design sometime around 2020-03-06
// @author       justrunmyscripts
// @include      http://*e621.net/post*
// @include      https://*e621.net/post*
// @include      http://*e621.net/pool*
// @include      https://*e621.net/pool*
// @grant        GM.xmlHttpRequest
// @namespace    https://sleazyfork.org/en/users/96703-justrunmyscripts
// ==/UserScript==

// original script creator https://greasyfork.org/de/users/398891
// 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)

var sty =document.createElement("style");
sty.innerHTML=[
     ""
    ,".thumbEnh_cont {"
    ,"    display: flex;"
    ,"    flex-flow: row wrap;"
    ,"}"
    ,".thumbEnh_cont img.thumbEnh_img {"
    ,"    max-height: 100%;"
    ,"    max-width: 100%;"
    ,"}"
    ,"article.post-preview {"
    ,"    height: 700px !important;"
    ,"    width: 700px !important;"
    ,"}"
    ,"article.post-preview > a, article.post-preview > a > picture {"
    ,"    height: 94%;"
    ,"    width: 100%;"
    ,"}"
].join("");
document.head.appendChild(sty);


(function () {
    var contDiv = document.querySelector("#posts-container");
    contDiv.className = "thumbEnh_cont";

    function replacerHiRez(element, property) {
        element[property] = element[property].replace('/preview/', '/sample/');
    }

    var imgs = document.querySelectorAll('article.post-preview img');
    for (img of imgs) {
      img.className = "thumbEnh_img";
      replacerHiRez(img, 'src');
    }
    var sources = document.querySelectorAll('article.post-preview source');
    for (source of sources) {
      replacerHiRez(source, 'srcset');   
    }
})();