Skip to content

Instantly share code, notes, and snippets.

@mchelem
Last active February 14, 2022 04:34
Show Gist options
  • Save mchelem/9cce462de5e663e3a4b03d59b0b00927 to your computer and use it in GitHub Desktop.
Save mchelem/9cce462de5e663e3a4b03d59b0b00927 to your computer and use it in GitHub Desktop.
Bookmarklet do display all images in a GCP bucket path
javascript:(function() {
let table = document.getElementsByTagName("table")[0];
let linkList = table.querySelectorAll("a.object-link");
let imageElements = [...linkList].map(url => {
let path = url.href.split("_details")[1];
let name = url.href.split("/").pop().split("?")[0];
return "<img height=200 src='https://storage.cloud.google.com" + path + "' title='" + name + "'/>";
});
imageElements = Array.from(new Set(imageElements));
table.insertAdjacentHTML("beforebegin", "<div>" + imageElements.join("") + "</div>");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment