Code Monkey home page Code Monkey logo

mirador-plugins's Introduction

Mirador plugins

This repository contains multiple extensions for the IIIF viewer Mirador (see http://projectmirador.org/).

Physical Document Ruler

Adds a vertical and a horizontal ruler with metric or imperial units to the canvas display if the canvas has a physical dimensions service set.

Demo

To enable it, simply include the JavaScript (after loading Mirador):

<script src="<url to the plugin>/physicalRuler.js"></script>

You can configure the ruler with the physicalRuler configuration attribute in your Mirador configuration:

var mirador = Mirador({
  physicalRuler: {
    color: "#ffffff",         // The color for the rulers and labels
    location: "bottom-left",  // Location of the reference point of the rulers
    smallDashSize: 10,        // Size of the small dashes in pixels
    largeDashSize: 15,        // Size of the large dashes in pixels
    labelsEvery: 5,           // Draw ruler labels every n centimeters/inches
    imperialUnits: false      // Use imperial units instead of metric
  }
});

Bookmarkable Viewer State

Modifies Mirador to dynamically update the URL to reflect the currently selected view type (image, book, etc), manifest and canvas and to reconstruct a Mirador session from such an URL hash. This allows users to bookmark the (partial) state of Mirador and restore it at a later time.

The syntax of the URL is compatible with the work-in-progress IIIF Drag-and-Drop pattern.

This plugins comes with a major caveat, namely that the URL is only updated if there is a single slot in the viewer. This is due to the fact that more complicated workspace layouts carry a lot more state that would be too unwieldy to store in the URL hash. Use Mirador's built-in bookmarking functionality (via JSONBlob) for these use cases.

To enable it, just include the JavaScript after loading Mirador.

Keyboard Navigation

Adds keyboard nagivation features to Mirador. If there are multiple windows, the action are applied to all of them.

Key Action
Go to previous page.
or SPACE Go to next page.
ctrl + Go to first page.
ctrl + Go to last page.
i Show or hide information/metadata.
Toggle fullscreen using the largest possible option.

Installation:

<script src="build/mirador/mirador.js"></script>
<script src="path/to/keyboardNavigation.js"></script>
<script>
// Creating Mirador instance
// ...
</script>

Piwik Tracking of Mirador Events

This plugin records user interactions with Mirador to a Piwik instance.

You can configure the plugin with the piwikTracking configuration Key:

{
    // Only set trackerUrl and siteId if you did not use the Piwik
    // JavaScript snippet
    trackerUrl: undefined,
    siteId: undefined,

    // Can be 'event' or 'content', what kind of interaction to record
    // in Piwik. 'event' will trigger an Event, 'content' a Content Interaction.
    method: 'event',
    events: [
      'change-page',
      'zoom',
      'enable-annotations',
      'add-annotation',
      'add-window'
    ]
}

mirador-plugins's People

Contributors

bitzl avatar datazuul avatar dependabot-preview[bot] avatar dependabot[bot] avatar jbaiter avatar jbhoward-dublin avatar morpheus-87 avatar nakamura196 avatar stefan-it avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mirador-plugins's Issues

breaks if physdim metadata embedded in or referenced by info.json instead of manifest.json

Per the IIIF services annex document, there are four ways to include physical dimension metadata:

  1. embedded in manifest.json
  2. as a separate resource, referenced by manifest.json
  3. embedded in info.json
  4. as a separate resource, referenced by info.json

The problem is that right now, the ImageView module of Mirador doesn't export the info.json metadata after it is fetched; it just uses the metadata internally to instantiate an instance of OpenSeadragon, and then throws the metadata away. So right now it is impossible to modify this plugin to support options 3) and 4) above without making custom modifications to the Mirador source code.

My solution requires two steps:

  • somewhere in that callback function declared on line 540, set a property on _this (the ImageView object) that exports the value of the infoJson local variable (e.g., _this.currentInfoJson = infoJson;)
  • change this line to var service = _this.currentImg.service || _this.currentInfoJson.service;

I will open a related issue on the Mirador project, and will reference it here.

ProjectMirador/mirador#1378

Download plugin disappears if more than one Mirador-Windows displayed

Wenn man über Ihr IIIF-Shelf ein Fenster öffnet, erscheint dort auch (am linken Ende der Symbolleiste oben rechts im Bild) die sehr komfortable Download-Funktion, die ja meines Wissens von Ihnen entwickelt wurde. Wenn man jedoch daneben noch ein zweites Fenster öffnet, verschwindet diese Funktion in allen Fenstern und kommt auch nicht wieder, wenn das zweite Fenster wieder geschlossen wird. (Wenn man das Dokument im Hauptfenster durch ein anderes Dokument der BSB ersetzt, bleibt die Downloadfunktion offenbar erhalten, jedoch nicht, wenn hier ein fremdes Dokument eingesetzt wird - gibt es da Downloadsperren in Manifesten mancher Institutionen?).

Mirador plugins not displayed

Hello,

some of the plugins downloaded from here are workin fine; some others they are not working.
As example, as per instructions of the physical rules plugin we've added the phisycalRuls.js reference atfer loading Mirador, then we added the physicalRuler tag along with its metadata; however, the rules is failing to be displayed in the corresponding Mirador instance. Are we missing something other than modifying the container?

Thanks
Simone

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.