-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the mirador config more easily alterable, Drupal-side. #22
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6804242
Make the mirador config more easily alterable, Drupal-side.
adam-vessey 1b1c312
Add the block title/description back, and wrap up the themed element.
adam-vessey 9d12ad1
Add reference to the plugins back.
adam-vessey 86daf66
Be more permissive, for if the plugins are not available.
adam-vessey 7013307
Add cache metadata, and fix array offsets...
adam-vessey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
window.miradorPlugins
thing here seems like we could have saner expectations? Like, have the integration itself include it itself, so there's not this arbitrary JS extension point?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With something like roblib/mirador-integration-islandora#1, could possibly avoid having to touch
window.miradorPlugins
here? Could just become: