Created
October 18, 2022 07:56
-
-
Save doitian/6f4f579cd948685a217e6f43c20e821f to your computer and use it in GitHub Desktop.
Display the cached images in Pinboard
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
| document.querySelectorAll("a.cached").forEach(async (a) => { | |
| const cacheResp = await fetch(a.href); | |
| const htmlText = await cacheResp.text(); | |
| const doc = new DOMParser().parseFromString(htmlText, "text/html"); | |
| const iframes = doc.querySelectorAll("body > iframe"); | |
| const img = document.createElement("img"); | |
| img.setAttribute("src", iframes[1].src); | |
| img.setAttribute("style", "max-width: 100%"); | |
| a.innerHTML = ""; | |
| a.appendChild(img); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Pinboard Archive Accounts, this bookmarklet displays the cached images directly in the list.