-
Token:
-
-
+
+
+
Token:
+
+
+
+
+
+
File ID:
+
+
+
+
+
+
+
-
-
File ID:
-
-
-
-
-
-
+
+
+
Collection:
+
+
+
+
Enter 2+ comma separated list of file ids
+
@@ -67,6 +103,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 +131,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 +157,7 @@
// Try to load all properties from storage on page load
setProperty('token');
setProperty('fileid');
+ setProperty('collection');
loadPreview();