Skip to content

Instantly share code, notes, and snippets.

@doitian
Created October 18, 2022 07:56
Show Gist options
  • Select an option

  • Save doitian/6f4f579cd948685a217e6f43c20e821f to your computer and use it in GitHub Desktop.

Select an option

Save doitian/6f4f579cd948685a217e6f43c20e821f to your computer and use it in GitHub Desktop.
Display the cached images in Pinboard
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);
});
@doitian
Copy link
Copy Markdown
Author

doitian commented Oct 18, 2022

For Pinboard Archive Accounts, this bookmarklet displays the cached images directly in the list.

@doitian
Copy link
Copy Markdown
Author

doitian commented Oct 18, 2022

Tool to create bookmarklet: https://caiorss.github.io/bookmarklet-maker/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment