Last active
December 20, 2023 00:06
-
-
Save faucetlol/517ddb0fbc6400130d444f09b9c15ec4 to your computer and use it in GitHub Desktop.
Userscript to get original images from portfolio.commishes.com
This file contains 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 Portfolio Original Images | |
// @namespace https://e621.net/users/601225 | |
// @version 0.1 | |
// @description Replaces the preview image with original quality on portfolio.commishes.com | |
// @author faucet | |
// @match https://portfolio.commishes.com/upload/show/* | |
// @icon https://portfolio.commishes.com/assets/img/logo.png | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const script_containing_id = document.evaluate("//script[contains(text(), '/upload/tag/')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.textContent; | |
const match = script_containing_id.match(/\/(\d+)\/remove\//); | |
if (match && match.length > 1) { | |
const original_image_id = match[1]; | |
console.log("Original Image ID:", original_image_id); | |
document.getElementById("preview").src = `https://portfolio.commishes.com/image/${original_image_id}/original/`; | |
} | |
else { | |
console.log("Error: Original image ID not found"); | |
document.getElementById("preview-container").append("Error: Original image ID not found"); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment