Last active
February 14, 2022 04:34
-
-
Save mchelem/9cce462de5e663e3a4b03d59b0b00927 to your computer and use it in GitHub Desktop.
Bookmarklet do display all images in a GCP bucket path
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:(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