-
Notifications
You must be signed in to change notification settings - Fork 317
/
Copy pathpreview.html
94 lines (85 loc) · 3.03 KB
/
preview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Box Content Explorer/Preview Test Page</title>
<style>
body {
display: flex;
}
body,
html {
background: #ccc;
border: 0 none;
box-sizing: border-box !important;
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
.inputs {
padding: 15px;
}
.inputs input {
margin-bottom: 10px;
}
.preview {
display: flex;
flex-grow: 1;
}
</style>
<link rel="stylesheet" type="text/css" href="../dev/en-US/explorer.css" />
<script src="../dev/en-US/explorer.js"></script>
</head>
<body>
<div class="inputs">
<div>
<label>
<div>Folder Id</div>
<input class="folder" type="text" placeholder="Enter folder id" />
</label>
<label>
<div>Auth Token</div>
<input class="token" type="text" placeholder="Enter auth token" />
</label>
</div>
<button type="button" onclick="load()">Submit</button>
</div>
<div class="preview"></div>
<script>
function load() {
const { ContentExplorer } = Box;
const token = document.querySelector('.token').value || localStorage.getItem('token');
const folderId = document.querySelector('.folder').value || localStorage.getItem('folder');
if (!token || !folderId) {
return;
}
localStorage.setItem('token', token);
document.querySelector('.token').value = token;
localStorage.setItem('folder', folderId);
document.querySelector('.folder').value = folderId;
const explorer = new ContentExplorer();
explorer.show(folderId, token, {
sharedLink: 'https://app.box.com/s/sdfsdf',
currentFolderId: folderId,
container: '.preview',
contentPreviewProps: {
contentSidebarProps: {
hasSkills: true,
hasMetadata: true,
detailsSidebarProps: {
hasProperties: true,
},
hasActivityFeed: true,
getUserProfileUrl: id => {
return Promise.resolve('#');
},
},
},
});
}
load();
</script>
</body>
</html>