From d25a4a0084018be64fdd9a552a50899c0b3ce5d0 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Tue, 7 May 2019 11:45:16 -0400 Subject: [PATCH] Respect incoming hash parameters. --- index.html | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/index.html b/index.html index d601eaa..5cd80cd 100644 --- a/index.html +++ b/index.html @@ -32,25 +32,26 @@

My Collection

var uv, $uv, urlDataProvider, manifest; - function openManifest() { - + function openManifest(resetHash) { window.scrollTo(0, 0); - + var params = { + root: './uv', + iiifResourceUri: manifest, + configUri: 'uv-config.json', + locales: [ + { + name: 'en-GB' + } + ] + }; + if (resetHash) { + params.collectionIndex = 0; + params.manifestIndex = 0; + params.sequenceIndex = 0; + params.canvasIndex = 0; + } $uv.slideDown("fast", function() { - uv.set({ - root: './uv', - iiifResourceUri: manifest, - configUri: 'uv-config.json', - collectionIndex: 0, - manifestIndex: 0, - sequenceIndex: 0, - canvasIndex: 0, - locales: [ - { - name: 'en-GB' - } - ] - }); + uv.set(params); }); } @@ -60,6 +61,8 @@

My Collection

urlDataProvider = new UV.URLDataProvider(); + // are there uv hash parameters? + manifest = urlDataProvider.get('manifest', null); var data = { root: './uv', iiifResourceUri: manifest, @@ -76,7 +79,6 @@

My Collection

} ] }; - uv = createUV('#uv', data, urlDataProvider); uv.on('created', function() { @@ -87,19 +89,17 @@

My Collection

iiifGallery.addEventListener('selectManifest', function (evt) { manifest = evt.detail.id; - openManifest(); + openManifest(true); }); iiifGallery.addEventListener('selectCollection', function (evt) { manifest = evt.detail.id; - openManifest(); + openManifest(true); }); - // are there uv hash parameters? - manifest = Utils.Urls.getHashParameter('manifest'); - + // If a manifest was specified in the parameters, display it now: if (manifest) { - openManifest(); + openManifest(false); } }, false); @@ -109,4 +109,4 @@

My Collection

- \ No newline at end of file +