Skip to content

Instantly share code, notes, and snippets.

View aeschylus's full-sized avatar

Drew Winget aeschylus

View GitHub Profile
@aeschylus
aeschylus / mirador-api-examples.md
Last active June 5, 2017 07:36
Some descriptions of common API operations in Mirador.

Common Mirador API Task Examples

Mirador exposes a fairly powerful set of events as its primary API, and it is possible to introspect the state of Mirador with a number of convenience methods to react to changes and export and import data and viewer state. In the following examples, we'll go through some common tasks that can be accomplished programmatically, and answer any questions for improving our documentation. To follow along, simply visit projectMirador.org/demo and open the javascript console. We will work through these examples by manipulating Mirador programmatically in the console.

The projectMirador.org/demo page exposes an instance of Mirador called myMiradorInstance. All methods, events, and state can be accessed here. Let's start by retrieving different pieces of information about the current viewer state.

Getting State Information

The saveController is the central state manager of Mirador. Though it is not fully implemented, most state of interest can be accessed through it. Type `m

https://searchworks.stanford.edu (drag and drop)
https://wdl.org/ (copy paste)
https://wellcomelibrary.org/ (drag and drop)
https://www.digitale-sammlungen.de/index.html (BSB, drag and drop)
https://digital.library.wayne.edu/ (copy paste) (note: add the "s" to the manifest URI)
https://open.library.ubc.ca/ (copy paste from “Embed.” Add the "s" to the manifest URI)
Internet Archive (construct manifest URI)
example: https://iiif.archivelab.org/iiif/ [Internet archive item id here] /manifest.json
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://wellcomelibrary.org/iiif/b18035723/manifest",
"@type": "sc:Manifest",
"label": "Wunder der Vererbung",
"metadata": [
{
"label": "Title",
"value": "Wunder der Vererbung"
},
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://wellcomelibrary.org/iiif/b18035723/manifest",
"@type": "sc:Manifest",
"label": "Wunder der Vererbung",
"metadata": [
{
"label": "Title",
"value": "Wunder der Vererbung"
@aeschylus
aeschylus / manfiest.json
Created August 15, 2016 19:23
Case 4 IIIF 2.0 manfiest - multiple
{
@context: "http://iiif.io/api/presentation/2/context.json",
@id: "http://wellcomelibrary.org/iiif/b18035723/manifest",
@type: "sc:Manifest",
label: "Wunder der Vererbung",
metadata: [
{
label: "Title",
value: "Wunder der Vererbung"
},
<a target=”_blank” href=”http://mirador.britishart.yale.edu/?manifest=http://manifests.britishart.yale.edu/manifest/1079">
<img src=”http://manifests.britishart.yale.edu/logo-iiif.png" alt=”IIIF Manifest”>
</a>
<!---
To link to an image instead of a manifest, use "image=[link_to_info.json]" instead of "manifest=".
To make Mirador open to a specific canvas or page of a manifest, add another query parameter:
"...&canvas=[the_id_of_my_IIIF_canvas]"
-->
@aeschylus
aeschylus / treeData.json
Created March 2, 2014 06:52
Sample Tree Data - The important aspect here is that the children objects be stored as elements in an array under a "children" key in the nested structure.
{
"name": "MyClass",
"children": [{
"name": "1",
"children": [{
"name": "1",
"children": [{
"name": "7"
}, {
"name": "8"
@aeschylus
aeschylus / Manifest.json
Created November 30, 2013 02:48
Fixture Manifest.json for IIIF Metadata API 1.0 Ranges feature.
This file has been truncated, but you can view the full file.
{
"@context":"http://www.shared-canvas.org/ns/context.json",
"@id":"http://demos.biblissima-condorcet.fr/iiif/metadata/ark:/12148/btv1b84473026/manifest.json",
"@type":"sc:Manifest",
"label":"Paris, BnF, MSS Français 1728",
"metadata":
{
"Repository":"Bibliothèque nationale de France / National Library of France",
"Provider" : "Biblissima",
(function($) {
$.AnnotationsLayer = function(options) {
jQuery.extend(true, this, {
sidePanel: null,
bottomPanel: null,
regionController: null,
width: $.DEFAULT_SETTINGS.imageView.annotationsList.width,
parent: null,
@aeschylus
aeschylus / module
Created November 19, 2013 22:43
Binding a method with self context.
(function($) {
$.AnnotationsLayer = function(options) {
jQuery.extend(true, this, {
sidePanel: null,
bottomPanel: null,
regionController: null,
width: $.DEFAULT_SETTINGS.imageView.annotationsList.width,
parent: null,