diff --git a/src/index.html b/src/index.html index 1aa8714854..756a155021 100644 --- a/src/index.html +++ b/src/index.html @@ -56,6 +56,14 @@ +
+
Collection:
+ + + +
Enter 2+ comma separated list of file ids
+
+
@@ -67,6 +75,14 @@ /* global Box */ preview = new Box.Preview(); + function clearProperty(selector) { + var inputEl = document.getElementById(selector + '-set'); + var displayEl = document.getElementById(selector + '-display'); + inputEl.value = ''; + displayEl.textContent = ''; + localStorage.setItem(selector, ''); + } + function setProperty(selector) { // Get new value, fallback to local storage var inputValue = document.querySelector('#' + selector + '-set'); @@ -87,12 +103,20 @@ function loadPreview(options) { var token = localStorage.getItem('token'); var fileid = localStorage.getItem('fileid'); + var fileidList = localStorage.getItem('collection') || ''; if (!token || !fileid) { return; } + var collection = + fileidList && + fileidList.split(',').map(function(fileid) { + return fileid.trim(); + }); + var previewOptions = options || { + collection, enableThumbnailsSidebar: true, showAnnotations: true, showDownload: true, @@ -105,6 +129,7 @@ // Try to load all properties from storage on page load setProperty('token'); setProperty('fileid'); + setProperty('collection'); loadPreview();