Overview

This article explains the implementation for dynamically specifying the viewingDirection of the Mirador viewer via URL parameters. This feature allows the same manifest to be displayed left-to-right or right-to-left.

Implementation

1. Retrieving URL Parameters

Retrieve the viewingDirection parameter from the URL and set a default value:

ccoonnGssetttuvvriileePwwaiirnnaggmDsidri=ercentceitwoinoUnR=LfSureroalmrPcaUhrRPaLamrspa.amgrsea(tmw(ei'tnvediroesww.ilnogcDaitrieocnt.isoena'r)ch;'right-to-left';

In this implementation, when no parameter is specified, 'right-to-left' is used as the default.

2. Applying to Mirador Configuration

Incorporate the retrieved viewingDirection into the Mirador initial configuration:

c}o;nstiw}w}w}di]i,o,m:n,nriddkr"oilvoaaahseavwdoiwlllipndis:ae:llldaaoe:dwoooecbrw'ei{wwwWelCe[kdnCMFiCeor{nMglaunodn"oaDoxldn:f,wnisilotiniremswrfg-fe:icToaweczrill=istfeetPsntia:elae{d:olnen,onsf::ewm:eal-a,lft:invsardiielu{'fe,se,ewe,si,tnUgrDli,rection,UsetheURLparametervalue

3. Usage Examples

Right-to-Left Display (Default)

https://example.com/viewer.xml

or

https://example.com/viewer.xml?viewingDirection=right-to-left

Left-to-Right Display

https://example.com/viewer.xml?viewingDirection=left-to-right

XSLT Implementation

When implementing this feature within an XSLT template, add the following code to the script section (mirador.xsl:222-230):

<cc}!oo;-nn-sMstitiw}Grdi]evam:n,tidideor"oilvvwravwdoiiidis:aeenioe:dwowgnrw'eitiDiCe[kdnhnitor{nMgegrin"oaDreaf,wnidclinirsitg-feericwecteoo=isttcnnntiitf{d:oni=iongogwm:snuu-arrinvfladiirPt'feoai,ewmrosiantnUmUgRsrDL.lig,rpeeatcr(ta'imvoeinte,ewrisngDirection')'right-to-left';

Available Values

The following values can be used for Mirador’s viewingDirection:

  • left-to-right - Pages turn from left to right (e.g., Western books)
  • right-to-left - Pages turn from right to left (e.g., Japanese books, Arabic books)
  • top-to-bottom - Top to bottom (e.g., scrolls)
  • bottom-to-top - Bottom to top

Notes

  1. If viewingDirection is specified in the manifest file, the manifest setting takes priority. This method is primarily effective when the viewing direction is not specified in the manifest file
  2. This setting is applied per window
  3. URL parameters are evaluated only at page load time
  4. If the user changes the viewing direction through the Mirador UI, the URL parameter value is overwritten
  • xsl/mirador.xsl - XSLT transformation template (implementation location)