-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - Curators can upload multiple images for an item
- Loading branch information
Showing
31 changed files
with
1,397 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Overrides openseadragon/jquery.js from openseadragon-rails gem to add custom page binding for pagination | ||
|
||
(function($) { | ||
$.fn.openseadragon = function() { | ||
var __osd_counter = 0; | ||
function generateOsdId() { | ||
__osd_counter++; | ||
|
||
return "Openseadragon" + __osd_counter; | ||
} | ||
|
||
$(this).each(function() { | ||
var $picture = $(this); | ||
$picture.addClass('openseadragon-viewer'); | ||
|
||
if (typeof $picture.attr('id') === "undefined") { | ||
$picture.attr('id', generateOsdId()); | ||
} | ||
|
||
var collectionOptions = $picture.data('openseadragon'); | ||
|
||
var sources = $picture.find('source[media="openseadragon"]'); | ||
|
||
var tilesources = $.map(sources, function(e) { | ||
if ($(e).data('openseadragon')) { | ||
return $(e).data('openseadragon'); | ||
} else { | ||
return $(e).attr('src'); | ||
} | ||
}); | ||
|
||
$picture.css('height', $picture.css('height')); | ||
|
||
// BEGIN CUSTOMIZATION | ||
var viewer = OpenSeadragon( | ||
$.extend({ id: $picture.attr('id') }, collectionOptions, { tileSources: tilesources }) | ||
); | ||
|
||
viewer.addHandler('page', function (data) { | ||
$picture.siblings().find('[id*="currentpage"]')[0].innerHTML = ( data.page + 1 ); | ||
}); | ||
|
||
$picture.data('osdViewer', viewer); | ||
// END CUSTOMIZATION | ||
|
||
}); | ||
|
||
return this; | ||
}; | ||
})(jQuery); |
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
Oops, something went wrong.