Skip to content

Instantly share code, notes, and snippets.

@book000
Last active April 30, 2024 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save book000/0326c9b0635d99b7c4ab891ccb5e67be to your computer and use it in GitHub Desktop.
Save book000/0326c9b0635d99b7c4ab891ccb5e67be to your computer and use it in GitHub Desktop.
Replace square images displayed on pixiv.net with full-size images
// ==UserScript==
// @name pixiv replace full image
// @namespace https://tomacheese.com
// @version 1.0.1
// @description Replace square images displayed on pixiv.net with full-size images
// @author Tomachi
// @match https://www.pixiv.net/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=pixiv.net
// @updateURL https://gist.github.com/book000/0326c9b0635d99b7c4ab891ccb5e67be/raw/pixiv-full-image.user.js
// @downloadURL https://gist.github.com/book000/0326c9b0635d99b7c4ab891ccb5e67be/raw/pixiv-full-image.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
setInterval(() => {
const regex =
/https:\/\/i\.pximg\.net\/c\/[a-z0-9_]+\/(?:custom-thumb|img-master)\/img\/([0-9\/]+)\/([0-9_p]+)_(?:custom|square)1200\.jpg/;
document.querySelectorAll('div[type="illust"] div.fxGVAF').forEach((div) => {
const img = div.querySelector('img');
if(!img) return;
const match = regex.exec(img.src);
if (!match) {
console.log("no match", img.src);
return;
}
const newUrl = `https://i.pximg.net/c/600x1200_90/img-master/img/${match[1]}/${match[2]}_master1200.jpg`;
img.src = newUrl;
// remove fxGVAF class
div.classList.remove("fxGVAF");
});
}, 300)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment