-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from adam-vessey/feature/alterability
Make the mirador config more easily alterable, Drupal-side.
- Loading branch information
Showing
5 changed files
with
58 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,30 @@ | ||
/*jslint browser: true*/ | ||
/*global Mirador, textOverlayPlugin, Drupal*/ | ||
/*jslint browser: true, esversion: 6 */ | ||
/*global Mirador, Drupal, once*/ | ||
/** | ||
* @file | ||
* Displays Mirador viewer. | ||
*/ | ||
(function ($, Drupal) { | ||
(function (Drupal, once) { | ||
'use strict'; | ||
|
||
/** | ||
* If initialized. | ||
* @type {boolean} | ||
*/ | ||
var initialized; | ||
/** | ||
* Unique HTML id. | ||
* @type {string} | ||
*/ | ||
var base; | ||
|
||
function init(context,settings){ | ||
if (!initialized){ | ||
initialized = true; | ||
|
||
/* | ||
Mirador | ||
*/ | ||
var miradorInstance = Mirador.viewer({ | ||
"id": base, | ||
"manifests": { | ||
[settings.iiif_manifest_url]: {provider: "Islandora"} | ||
}, | ||
"window": settings.mirador_window_settings, | ||
"windows": [ | ||
{ | ||
"manifestId": settings.iiif_manifest_url, | ||
"thumbnailNavigationPosition": 'far-bottom' | ||
} | ||
] | ||
}, window.miradorPlugins); | ||
} | ||
} | ||
Drupal.Mirador = Drupal.Mirador || {}; | ||
|
||
/** | ||
* Initialize the Mirador Viewer. | ||
*/ | ||
Drupal.behaviors.Mirador = { | ||
attach: function (context, settings) { | ||
base = settings.mirador_view_id; | ||
init(context,settings); | ||
Object.entries(settings.mirador.viewers).forEach(entry => { | ||
const [base, values] = entry; | ||
once('mirador-viewer', base, context).forEach(() => | ||
Mirador.viewer(values, window.miradorPlugins || {}) | ||
); | ||
}); | ||
}, | ||
detach: function () { | ||
detach: function (context, settings) { | ||
Object.entries(settings.mirador.viewers).forEach(entry => { | ||
const [base, ] = entry; | ||
once.remove('mirador-viewer', base, context); | ||
}); | ||
} | ||
}; | ||
|
||
})(jQuery, Drupal); | ||
})(Drupal, once); |
This file contains 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
This file contains 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