' +
+ '
';
+
+ if (this.options.showNavigation) {
+ html += '
' +
+ '
' +
+ '
' +
+ '1 / ' +
+ '' + this.options.images.length + '' +
+ '
' +
+ '
' +
+ '
' +
+ '
';
+ }
+
+ if (this.options.showThumbnails) {
+ html += '
';
+ }
+
+ html += '
';
+
+ this.$element.html(html);
+ this.$viewerContainer = this.$element.find('.iiif-viewer-container');
+ this.viewerId = this.$viewerContainer.attr('id');
+ },
+
+ initializeViewer: function() {
+ if (typeof OpenSeadragon === 'undefined') {
+ console.error('OpenSeadragon library is required for IIIF viewer');
+ return;
+ }
+
+ this.viewer = OpenSeadragon({
+ id: this.viewerId,
+ prefixUrl: '/plugins/arDominionPlugin/images/openseadragon/',
+ tileSources: this.getTileSource(0),
+ showNavigationControl: true,
+ navigationControlAnchor: OpenSeadragon.ControlAnchor.TOP_RIGHT,
+ showRotationControl: true,
+ showHomeControl: true,
+ showFullPageControl: true,
+ showZoomControl: true,
+ sequenceMode: false,
+ preserveViewport: false,
+ constrainDuringPan: true,
+ visibilityRatio: 1.0,
+ minZoomImageRatio: 0.8,
+ maxZoomPixelRatio: 2
+ });
+
+ this.loadThumbnails();
+ },
+
+ getTileSource: function(index) {
+ if (!this.options.images[index]) {
+ return null;
+ }
+
+ var imageUrl = this.options.images[index];
+
+ // Check if it's a full info.json URL or just the base IIIF URL
+ if (imageUrl.indexOf('info.json') === -1) {
+ imageUrl = imageUrl + '/info.json';
+ }
+
+ return imageUrl;
+ },
+
+ loadThumbnails: function() {
+ if (!this.options.showThumbnails) {
+ return;
+ }
+
+ var $thumbnailContainer = this.$element.find('.iiif-carousel-thumbnails');
+ var self = this;
+
+ this.options.images.forEach(function(imageUrl, index) {
+ var thumbnailUrl = imageUrl.replace('/info.json', '') + '/full/150,/0/default.jpg';
+
+ var $thumb = $('