Last active
August 30, 2024 22:10
-
-
Save bitWolfy/4a3e72fafa3f26e0a11a0198cf55259f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name E621 ReScaler | |
// @namespace bitwolfy.com | |
// @version 1.3 | |
// @description Scales up the thumbnails on e621.net | |
// @author bitWolfy | |
// @match https://e621.net/posts | |
// @match https://e621.net/posts/ | |
// @match https://e621.net/posts?* | |
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js#sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo= | |
// @grant none | |
// ==/UserScript== | |
// Settings | |
const cropImages = true, | |
thumbWidth = 280, | |
thumbHeight = 320; | |
// Main Script | |
(function() { | |
'use strict'; | |
// Reset the attached stylesheet | |
$("<style>") | |
.appendTo("head") | |
.html(` | |
div#posts-container { | |
display: grid; | |
grid-template-columns: repeat(auto-fill, ${thumbWidth}px); | |
justify-content: space-between; | |
} | |
article.post-preview { | |
width: ${thumbWidth}px; | |
${cropImages ? ("height: " + thumbHeight + "px") : ""}; | |
} | |
article.post-preview img { | |
max-width: 100%; | |
max-height: 100%; | |
width: ${thumbWidth}px; | |
${cropImages ? ("height: " + (thumbHeight - 16) + "px") : ""}; | |
object-fit: ${cropImages ? "cover" : "contain"}; | |
} | |
`); | |
// Rewrite the thumbnail URLs | |
$("article.post-preview").each((index, entry) => { | |
let $thumb = $(entry); | |
$thumb.find("source").remove(); | |
let $img = $thumb.find("img").first(); | |
if($thumb.attr("data-large-url")) { $img.attr("src", $thumb.attr("data-large-url")); } | |
}); | |
})(); |
It's a matter of preference, I suppose.
Personally, I like having a bit of padding between thumbnails. But to each their own.
Updated my post... somehow I had an older set of code in the clipboard last time.
But thanks for looking. Just figured I'd send it in case you like it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did a little mod of your script...
A little less wasted space i think.
Im not coder by trade, so this probably isnt perfect, but i like it.
(function() {
'use strict';
})();