Skip to content

Instantly share code, notes, and snippets.

@wragge
Created September 8, 2025 02:51
Show Gist options
  • Save wragge/a37a4db854deffad956abc7bf918f6b0 to your computer and use it in GitHub Desktop.
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
// ==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);
});
@wragge
Copy link
Author

wragge commented Sep 8, 2025

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

  1. Add a userscript manager to your browser, for example TamperMonkey or ViolentMonkey.
  2. Click on the 'Raw' button in the header of the code box above. The userscript manager will then ask you if you really want to install it. Click install!

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