diff ViewerPlugin/OrthancExplorer.js @ 263:14f182958ca7 iiif

added button to access IIIF manifest of series
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Jul 2023 09:44:28 +0200
parents b9eab260a372
children dab414e5b520
line wrap: on
line diff
--- a/ViewerPlugin/OrthancExplorer.js	Mon Jul 10 09:21:48 2023 +0200
+++ b/ViewerPlugin/OrthancExplorer.js	Mon Jul 10 09:44:28 2023 +0200
@@ -23,8 +23,9 @@
 $('#series').live('pagebeforeshow', function() {
   var seriesId = $.mobile.pageData.uuid;
 
+  $('#mirador-button').remove();
+  $('#series-iiif').remove();
   $('#wsi-button').remove();
-  $('#mirador-button').remove();
 
   // Test whether this is a whole-slide image by check the SOP Class
   // UID of one instance of the series
@@ -53,6 +54,29 @@
 
       }
 
+      if (${SERVE_IIIF}) {
+        var b = $('<a>')
+            .attr('id', 'series-iiif-button')
+            .attr('data-role', 'button')
+            .attr('href', '#')
+            .text('Copy link to IIIF manifest');
+
+        var li = $('<li>')
+            .attr('data-icon', 'gear')
+            .append(b);
+
+        $('#series-access').append(li);
+
+        b.click(function(e) {
+          if ($.mobile.pageData) {
+            e.preventDefault();
+            var url = new URL('${IIIF_PUBLIC_URL}' + seriesId + '/manifest.json', window.location.href);
+            navigator.clipboard.writeText(url.href);
+            $(e.target).closest('li').buttonMarkup({ icon: 'check' });
+          }
+        });
+      }
+
       if (${SERVE_MIRADOR}) {
         var b = $('<a>')
             .attr('id', 'mirador-button')