Skip to content

Commit

Permalink
Fix bug detected in #6
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus-87 committed Jan 3, 2019
1 parent 3ed9a05 commit 739339e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion DownloadMenu/downloadMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ var DownloadButton = {
'</span>'
].join('')),

sizes: ['full', '250,'],

/* extracts image urls from the viewer window */
extractImageUrls: function(viewerWindow){
var currentImgIndex = viewerWindow.focusModules.ImageView.currentImgIndex;
Expand All @@ -35,7 +37,7 @@ var DownloadButton = {
var ratio = currentImage.height / currentImage.width;

var imageUrls = [];
['full', '250,'].forEach(function(size){
this.sizes.forEach(function(size){
imageUrls.push({
'href': viewerWindow.currentImageMode !== 'ImageView' ? '#' : this.imageUrlTemplate({
'imageBaseUrl': imageBaseUrl, 'size': size
Expand Down Expand Up @@ -86,6 +88,17 @@ var DownloadButton = {
if(this.id !== data.id || !data.viewType){
return;
}
if(this.element.find('.mirador-icon-download').length === 0){
var manifestUrl = this.manifest.jsonLd['@id'];
var windowButtons = this.element.find('.window-manifest-navigation');
this_.injectButtonToMenu(windowButtons, manifestUrl, this_.sizes.reduce(function(fakeImageUrls){
fakeImageUrls.push({
'href': '#',
'title': 'n.a.'
});
return fakeImageUrls;
}, []));
}
if(data.viewType === 'ImageView'){
var imageUrls = this_.extractImageUrls(this);
this.element.find('.image-link').removeClass('disabled').attr(
Expand Down

0 comments on commit 739339e

Please sign in to comment.