Commit 232b393e authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Utilisation de la lib max-mirador depuis le plugin mirador-viewer

parent a329aa61
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
    "install": "^0.12.1",
    "jquery": "^3.3.1",
    "mathjax": "^2.7.7",
    "mirador": "^3.1.1",
    "openseadragon": "^2.4.2",
    "popper.js": "^1.14.7",
    "readline": "^1.3.0",
+115 −0

File added.

Preview size limit exceeded, changes collapsed.

+0 −1
Original line number Diff line number Diff line
../../node_modules/mirador/dist
 No newline at end of file
+8 −82
Original line number Diff line number Diff line
function    openInMirador(link,canvasId,canvasIndex) {
    if (canvasId === "" && canvasIndex === "") {
        canvasIndex = 0;
	canvasId = "";
    } else if (canvasId === "") {
        canvasIndex = canvasIndex-1;
	canvasId = "";
    } else {
	canvasIndex = "";
	canvasId = canvasId;
    }
    
    var mirador = Mirador.viewer({
	"id": "mirador-viewer",
	"language":"fr",
	"selectedTheme": "dark",
	"window": { //global window defaults
	    "allowClose": false, // Configure if windows can be closed or not
	    "allowFullscreen": false, // Configure to show a "fullscreen" button in the WindowTopBar
	    "allowMaximize": true, // Configure if windows can be maximized or not
	    "allowTopMenuButton": true, // Configure if window view and thumbnail display menu are visible or not
	    "allowWindowSideBar": true, // Configure if side bar menu is visible or not
	    "authNewWindowCenter": 'parent', // Configure how to center a new window created by the authentication flow. Options: parent, screen
	    "sideBarPanel": 'info', // Configure which sidebar is selected by default. Options: info, attribution, canvas, annotations, search
	    "defaultSidebarPanelHeight": 201,  // Configure default sidebar height in pixels
	    "defaultSidebarPanelWidth": 235, // Configure default sidebar width in pixels
	    "defaultView": 'single',  // Configure which viewing mode (e.g. single, book, gallery) for windows to be opened in
	    "forceDrawAnnotations": false,
	    "hideWindowTitle": false, // Configure if the window title is shown in the window title bar or not
	    "highlightAllAnnotations": false, // Configure whether to display annotations on the canvas by default
	    "showLocalePicker": false, // Configure locale picker for multi-lingual metadata
	    "sideBarOpen": false, // Configure if the sidebar (and its content panel) is open by default
	    "switchCanvasOnSearch": false, // Configure if Mirador should automatically switch to the canvas of the first search result
	    "panels": { // Configure which panels are visible in WindowSideBarButtons
		"info": false,
		"attribution": false,
		"canvas": false,
		"annotations": false,
		"search": false,
		"layers": false,
	    }
	},
	"windows": [
	    {
		"loadedManifest": link,
		"canvasIndex": canvasIndex,
		"canvasId": canvasId,
		"thumbnailNavigationPosition": 'far-right'
	    }
	],
	"workspace": {
	    "draggingEnabled": true,
	    "allowNewWindows": true,
	    "id": "my-panel",
	    "isWorkspaceAddVisible": false, // Catalog/Workspace add window feature visible by default
	    "exposeModeOn": false, // unused?
	    "height": 5000, // height of the elastic mode's virtual canvas
	    "showZoomControls": true, // Configure if zoom controls should be displayed by default
	    "type": 'mosaic', // Which workspace type to load by default. Other possible values are "elastic". If "mosaic" or "elastic" are not selected no worksapce type will be used.
	    "viewportPosition": { // center coordinates for the elastic mode workspace
		"x": 0,
		"y": 0,
	    },
	    "width": 5000, // width of the elastic mode's virtual canvas
	},
	"workspaceControlPanel": {
	    "enabled": false, // Configure if the control panel should be rendered.  Useful if you want to lock the viewer down to only the configured manifests
	},
    });
}

//load thumbnails from IIIF server
document.addEventListener("DOMContentLoaded", function(event){
    var imgsIIIF = document.querySelectorAll('img.mirador-link'); //img with class mirador-link
document.addEventListener("DOMContentLoaded", function () {
    let imgsIIIF = document.querySelectorAll('img.mirador-link'); //img with class mirador-link

    for (var e = 0, len = imgsIIIF.length; e < len; ++e) {
	var currentId = imgsIIIF[e].id
    for (let e = 0, len = imgsIIIF.length; e < len; ++e) {
        let currentId = imgsIIIF[e].id
        getThumbnail(imgsIIIF[e].src).then((thumbnail) => {
	    var currentImg = document.getElementById(currentId)
            let currentImg = document.getElementById(currentId)
            currentImg.setAttribute("src", thumbnail)
        })
    }
@@ -89,6 +18,3 @@ async function getThumbnail(url) {
    return thumbnail
}

//MAX.addPlugin(new MiradorViewer('mirador_viewer'));
+6 −9
Original line number Diff line number Diff line
@@ -17,18 +17,15 @@ declare
%rest:query-param("canvasIndex", "{$canvasIndex}")
%rest:path("/{$project}/mirador")
function max.plugin.mirador:loadViewer($project,$link,$canvasId,$canvasIndex){
let $publicjs := max.config:getBaseURI() || "plugins/" || $max.plugin.mirador:PLUGIN_ID || '/' || $max.plugin.mirador:PLUGIN_ID || '.js'
let $libJs := max.config:getBaseURI() || 'plugins/mirador_viewer/mirador_dist/mirador.min.js'
let $libJs := max.config:getBaseURI() || 'plugins/mirador_viewer/max-mirador/MaxMirador.js'

let $htmlPage := <html>
  <head>
    <script type='text/javascript' src='{$libJs}'></script>
  </head>
<body onload='openInMirador("{$link}","{$canvasId}","{$canvasIndex}")'>
  <body onload='MaxMirador.open("{$link}","{$canvasId}","{$canvasIndex}")'>
    <div id='mirador-viewer'/>
  <script type='text/javascript' src='{$libJs}'></script>
  <script type='text/javascript' src='{$publicjs}'></script>
  </body>
</html>

return $htmlPage
  };
 No newline at end of file
Loading