Loading plugins-available/default/img_viewer/img_viewer.js +24 −2 Changes for plugins-available/default/img_viewer/img_viewer.js: 24 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ class ImageViewer extends Plugin{ var viewables = document.querySelectorAll('#text .img_viewer_link'); //img + pb var images = document.querySelectorAll('#text img');//img only if(viewables.length > 0) { $('body').append('<script type="text/javascript" src="' +baseURI + '/core/ui/lib/openseadragon/openseadragon.min.js"></script>'); $('body').append('<script type="text/javascript" src="' +baseURI + 'core/ui/lib/openseadragon/openseadragon.min.js"></script>'); $('body').prepend('<div id="img_dialog_wrap" class="modal" tabindex="-1" role="dialog">'+ '<div>'+ '<div class="modal-content">'+ Loading @@ -34,12 +34,34 @@ class ImageViewer extends Plugin{ } } openImageInDialog(href){ let tiled = href.endsWith('dzi') || href.endsWith('json') ; this.showImages(tiled ? href : {type: 'image', url: href }) } async getData(file) { const response = await fetch(file); let tiles = await response.json(); return tiles } openCollectionInDialog(resource){ console.log(resource); let tabImages = [] this.getData(resource).then((tiles) => { tabImages = tiles['images']; document.querySelector('#img_dialog_wrap .modal-body').innerHTML = '<div id="osd-viewer" style="display: flex;"></div>' OpenSeadragon({ id: "osd-viewer", prefixUrl: baseURI + "core/ui/lib/openseadragon/images/", tileSources: tabImages, sequenceMode: true }); document.getElementById('img_dialog_wrap').style.display='block'; }); } showImages(tileSources){ //document.querySelector('#img_dialog_wrap .modal-body')innerHTML = ''; document.querySelector('#img_dialog_wrap .modal-body').innerHTML = '<div id="osd-viewer" style="display: flex;"></div>' Loading plugins-available/default/img_viewer/img_viewer.xsl +28 −2 Changes for plugins-available/default/img_viewer/img_viewer.xsl: 28 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -5,7 +5,9 @@ <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="tei xsl"> xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ead="urn:isbn:1-931666-22-9" exclude-result-prefixes="tei xsl ead xlink"> <xsl:param name="imagesRepository"/> Loading Loading @@ -39,13 +41,23 @@ </xsl:template> <xsl:template match="tei:graphic"> <xsl:template match="tei:graphic|ead:dao"> <xsl:variable name="href"> <xsl:value-of select="concat($baseuri,$project,'/',$imagesRepository ,@url)"/> </xsl:variable> <xsl:variable name="id"> <xsl:value-of select="generate-id(.) "/> </xsl:variable> <xsl:variable name="link"> <xsl:choose> <xsl:when test="@url"> <xsl:value-of select="@url"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="xlink:href"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <img class="viewable img_viewer_link" id="{$id}"> <xsl:attribute name="onclick">MAX.plugins['img_viewer'].openImageInDialog('<xsl:value-of select="$href"/>')</xsl:attribute> <xsl:attribute name="src"> Loading @@ -54,5 +66,19 @@ </img> </xsl:template> <xsl:template match="ead:dao[@xlink:role!='']"> <xsl:variable name="resource"> <xsl:value-of select="concat($baseuri,$project,'/ui/js/')"/> <xsl:value-of select="ancestor::ead:c[@otherlevel='manuscrit'][1]/@id"/> <xsl:text>.js</xsl:text> </xsl:variable> <img src="grou.gif" class="img_viewer_link"> <xsl:attribute name="onclick"> <xsl:text>MAX.plugins['img_viewer'].openCollectionInDialog('</xsl:text> <xsl:value-of select="$resource"/> <xsl:text>')</xsl:text> </xsl:attribute> </img> </xsl:template> </xsl:stylesheet> No newline at end of file Loading
plugins-available/default/img_viewer/img_viewer.js +24 −2 Changes for plugins-available/default/img_viewer/img_viewer.js: 24 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ class ImageViewer extends Plugin{ var viewables = document.querySelectorAll('#text .img_viewer_link'); //img + pb var images = document.querySelectorAll('#text img');//img only if(viewables.length > 0) { $('body').append('<script type="text/javascript" src="' +baseURI + '/core/ui/lib/openseadragon/openseadragon.min.js"></script>'); $('body').append('<script type="text/javascript" src="' +baseURI + 'core/ui/lib/openseadragon/openseadragon.min.js"></script>'); $('body').prepend('<div id="img_dialog_wrap" class="modal" tabindex="-1" role="dialog">'+ '<div>'+ '<div class="modal-content">'+ Loading @@ -34,12 +34,34 @@ class ImageViewer extends Plugin{ } } openImageInDialog(href){ let tiled = href.endsWith('dzi') || href.endsWith('json') ; this.showImages(tiled ? href : {type: 'image', url: href }) } async getData(file) { const response = await fetch(file); let tiles = await response.json(); return tiles } openCollectionInDialog(resource){ console.log(resource); let tabImages = [] this.getData(resource).then((tiles) => { tabImages = tiles['images']; document.querySelector('#img_dialog_wrap .modal-body').innerHTML = '<div id="osd-viewer" style="display: flex;"></div>' OpenSeadragon({ id: "osd-viewer", prefixUrl: baseURI + "core/ui/lib/openseadragon/images/", tileSources: tabImages, sequenceMode: true }); document.getElementById('img_dialog_wrap').style.display='block'; }); } showImages(tileSources){ //document.querySelector('#img_dialog_wrap .modal-body')innerHTML = ''; document.querySelector('#img_dialog_wrap .modal-body').innerHTML = '<div id="osd-viewer" style="display: flex;"></div>' Loading
plugins-available/default/img_viewer/img_viewer.xsl +28 −2 Changes for plugins-available/default/img_viewer/img_viewer.xsl: 28 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -5,7 +5,9 @@ <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="tei xsl"> xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ead="urn:isbn:1-931666-22-9" exclude-result-prefixes="tei xsl ead xlink"> <xsl:param name="imagesRepository"/> Loading Loading @@ -39,13 +41,23 @@ </xsl:template> <xsl:template match="tei:graphic"> <xsl:template match="tei:graphic|ead:dao"> <xsl:variable name="href"> <xsl:value-of select="concat($baseuri,$project,'/',$imagesRepository ,@url)"/> </xsl:variable> <xsl:variable name="id"> <xsl:value-of select="generate-id(.) "/> </xsl:variable> <xsl:variable name="link"> <xsl:choose> <xsl:when test="@url"> <xsl:value-of select="@url"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="xlink:href"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <img class="viewable img_viewer_link" id="{$id}"> <xsl:attribute name="onclick">MAX.plugins['img_viewer'].openImageInDialog('<xsl:value-of select="$href"/>')</xsl:attribute> <xsl:attribute name="src"> Loading @@ -54,5 +66,19 @@ </img> </xsl:template> <xsl:template match="ead:dao[@xlink:role!='']"> <xsl:variable name="resource"> <xsl:value-of select="concat($baseuri,$project,'/ui/js/')"/> <xsl:value-of select="ancestor::ead:c[@otherlevel='manuscrit'][1]/@id"/> <xsl:text>.js</xsl:text> </xsl:variable> <img src="grou.gif" class="img_viewer_link"> <xsl:attribute name="onclick"> <xsl:text>MAX.plugins['img_viewer'].openCollectionInDialog('</xsl:text> <xsl:value-of select="$resource"/> <xsl:text>')</xsl:text> </xsl:attribute> </img> </xsl:template> </xsl:stylesheet> No newline at end of file