Last active
December 14, 2023 13:55
-
-
Save aont/f805412aacc061b10b95c0d18158ea78 to your computer and use it in GitHub Desktop.
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
Array.from(document.querySelectorAll("img[src^=\"https://private-user-images.githubusercontent.com/\"]")).forEach((img, index, array)=>{ | |
if(img.complete) { | |
var anchor = img.parentElement; | |
anchor.removeAttribute("href") | |
// console.log(img) | |
var canvas = document.createElement("canvas") | |
canvas.height = img.naturalHeight | |
canvas.width = img.naturalWidth | |
canvas.style.maxWidth = "100%" | |
var context = canvas.getContext("2d") | |
context.drawImage(img, 0, 0) | |
anchor.appendChild(canvas) | |
anchor.removeChild(img) | |
} | |
}) |
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
javascript:Array.from(document.querySelectorAll('img[src^="https://private-user-images.githubusercontent.com/"]')).forEach((img,index,array)=>{if(img.complete){var anchor=img.parentElement;anchor.removeAttribute("href");var canvas=document.createElement("canvas"),context;canvas.height=img.naturalHeight,canvas.width=img.naturalWidth,canvas.style.maxWidth="100%",canvas.getContext("2d").drawImage(img,0,0),anchor.appendChild(canvas),anchor.removeChild(img)}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment