Created
September 8, 2025 02:51
-
-
Save wragge/a37a4db854deffad956abc7bf918f6b0 to your computer and use it in GitHub Desktop.
Userscript to display the IIIF Manifest URL in the State Library of Victoria's image viewer
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
// ==UserScript== | |
// @name Display SLV IIIF urls | |
// @namespace wraggelabs.com/display_slv_iiif_urls | |
// @match *://viewer.slv.vic.gov.au/?entity=IE* | |
// @grant GM.setClipboard | |
// @version 1.0 | |
// @author Tim Sherratt ([email protected]) | |
// @description Displays the IIIF Manifest URL in the State Library of Victoria's image viewer. | |
// @require https://cdn.jsdelivr.net/gh/CoeJoder/[email protected]/waitForKeyElements.js | |
// ==/UserScript== | |
waitForKeyElements("#handleURL", (handleInput) => { | |
const iiifId = location.href.match(/entity=(IE\d+)/)[1]; | |
const iiifUrl = "https://rosetta.slv.vic.gov.au/delivery/iiif/presentation/2.1/" + iiifId + "/manifest.json"; | |
// Create an input element to display the manifest URL | |
let iiifElem = document.createElement("input"); | |
iiifElem.value = iiifUrl; | |
iiifElem.id = "iiifURL"; | |
iiifElem.className = "input-group-field"; | |
iiifElem.style = "background-color: #fff; border: 1px solid #B4B4B4; -ms-flex-preferred-size: 78%; flex-basis: 78%; font-size: 16px; line-height: 32px; padding: 0 0.85em; height: 32px; overflow: hidden; word-break: break-all"; | |
// Add a button to copy url to clipboard | |
let iiifButton = document.createElement("button"); | |
iiifButton.textContent = "Copy IIIF"; | |
iiifButton.className = "copyURL button small-12 medium-12"; | |
iiifButton.addEventListener("click", function() { | |
GM.setClipboard(iiifUrl); | |
}); | |
// Create an group to contain the input and button | |
let iiifGroup = document.createElement("div"); | |
iiifGroup.className = "small-12 medium-12 columns input-group"; | |
iiifGroup.append(iiifElem); | |
iiifGroup.append(iiifButton); | |
// Add the new group after the handle | |
handleInput.parentElement.after(iiifGroup); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Display SLV IIIF urls
This userscript displays the IIIF manifest url in the State Library of Victoria's image viewer. It also includes a button to copy the manifest url to the clipboard.
Installation