Internet Archive

Get Manifest

Opens the IIIF Manifest or Collection URL of the current page on archive.org. If the manifest cannot be loaded, it prompts the user to create a GitHub issue in the iiif repository of the Internet Archive.

Installation

Drag the button below to the favorites bar of your browser in order to install this bookmarklet. Alternatively, you can copy the code below and paste it in the address or URL field of a new bookmark.

Get IIIF Manifest

Testing

Some links to test the bookmarklet:

The IIIF implementation at the Internet Archive is still being tested, and many items might not (yet) be available. This bookmarklet will be adapted when the official documentation of the APIs is published.

Source code

javascript: (async function () {
  // Check if visiting a page on archive.org
  if (window.location.href.includes('archive.org/details/')) {
    // Find the id of the current page
    const id = window.location.href.match(/https:\/\/archive.org\/details\/([^/?]*)/)[1];
    // Check if the page is an item or collection
    const type = document.head.querySelector('[property~=mediatype][content]') ? 'manifest' : 'collection';
    // Construct the manifest uri
    const manifestUri = `https://iiif.archive.org/iiif/3/${id}/${type}.json`;
    try {
      // Try to fetch the manifest
      await fetch(manifestUri).then((response) => response.json());
      // If successfull, change the location to the manifest uri
      location = manifestUri;
    } catch {
      // If unsuccessfull, prompt user to create an issue on github
      if (window.confirm(`Cannot load ${type}. Would you like to create an issue on GitHub?`)) {
        // Prefill the issue form
        location = `https://github.com/internetarchive/iiif/issues/new?title=Cannot+load+IIIF+${type}&body=Hi,+I+was+not+able+to+load+the+IIIF+${type}+for+the+page+${window.location.href}.+I+tried+the+following+uri:+${manifestUri}.+Thank+you+for+taking+a+look!`
      }
    }
  }
})()

Minimized version (used to create the link above):

For the minimized version, comments, spaces and newlines are removed from the code above. You can copy this code, create a new bookmark, and paste it in the address or url field.

javascript:(async function(){if(window.location.href.includes('archive.org/details/')){const id=window.location.href.match(/https:\/\/archive.org\/details\/([^/?]*)/)[1];const type=document.head.querySelector('[property~=mediatype][content]')?'manifest':'collection';const manifestUri=`https://iiif.archive.org/iiif/3/${id}/${type}.json`;try{await fetch(manifestUri).then(response=>response.json());location=manifestUri}catch{if(window.confirm(`Cannot load ${type}. Would you like to create an issue on GitHub?`)){location=`https://github.com/internetarchive/iiif/issues/new?title=Cannot+load+IIIF+${type}&body=Hi,+I+was+not+able+to+load+the+IIIF+${type}+for+the+page+${window.location.href}.+I+tried+the+following+uri:+${manifestUri}.+Thank+you+for+taking+a+look!`}}}})();

Open in Allmaps Editor

Opens the IIIF Manifest or Collection URL directly in Allmaps Editor.

Installation

Drag the button below to the favorites bar of your browser in order to install this bookmarklet. Alternatively, you can copy the code below and paste it in the address or URL field of a new bookmark.

Open in Allmaps Editor

Source code

javascript: (async function () {
  // Editor base URL
  const editorBaseUrl = "https://editor.allmaps.org/#/collection?url=";
  // Check if visiting a page on archive.org
  if (window.location.href.includes("archive.org/details/")) {
    // Find the id of the current page
    const id = window.location.href.match(
      /https:\/\/archive.org\/details\/([^/?]*)/
    )[1];
    // Check if the page is an item or collection
    const type = document.head.querySelector("[property~=mediatype][content]")
      ? "manifest"
      : "collection";
    // Construct the manifest uri
    const manifestUri = `https://iiif.archive.org/iiif/3/${id}/${type}.json`;
    try {
      // Try to fetch the manifest
      await fetch(manifestUri).then((response) => response.json());
      // If successfull, load the manifest in Allmaps Editor
      location = editorBaseUrl + encodeURIComponent(manifestUri);
    } catch {
      // If unsuccessfull, prompt user to create an issue on github
      if (
        window.confirm(
          `Cannot load ${type}. Would you like to create an issue on GitHub?`
        )
      ) {
        // Prefill the issue form
        location = `https://github.com/internetarchive/iiif/issues/new?title=Cannot+load+IIIF+${type}&body=Hi,+I+was+not+able+to+load+the+IIIF+${type}+for+the+page+${window.location.href}.+I+tried+the+following+uri:+${manifestUri}.+Thank+you+for+taking+a+look!`;
      }
    }
  }
})();

Minimized version (used to create the link above):

For the minimized version, comments, spaces and newlines are removed from the code above. You can copy this code, create a new bookmark, and paste it in the address or url field.

javascript:(async function(){const editorBaseUrl='https://editor.allmaps.org/#/collection?url=';if(window.location.href.includes('archive.org/details/')){const id=window.location.href.match(/https:\/\/archive.org\/details\/([^/?]*)/)[1];const type=document.head.querySelector('[property~=mediatype][content]')?'manifest':'collection';const manifestUri=`https://iiif.archive.org/iiif/3/${id}/${type}.json`;try{await fetch(manifestUri).then(response=>response.json());location=editorBaseUrl+encodeURIComponent(manifestUri)}catch{if(window.confirm(`Cannot load ${type}. Would you like to create an issue on GitHub?`)){location=`https://github.com/internetarchive/iiif/issues/new?title=Cannot+load+IIIF+${type}&body=Hi,+I+was+not+able+to+load+the+IIIF+${type}+for+the+page+${window.location.href}.+I+tried+the+following+uri:+${manifestUri}.+Thank+you+for+taking+a+look!`}}}})();

See also