-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom.js
28 lines (25 loc) · 1.07 KB
/
custom.js
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
options = {
success: function(files) {
var fileData = JSON.stringify(files[0], undefined, 2);
document.getElementById("chosenFile").innerHTML = fileData;
// Turn on if you want Chooser to auto generate an Embedder
// let embedContainer = document.getElementById("embedContainer")
// Dropbox.embed({link: files[0].link, appKey: "oyntl3uf6didmij"}, embedContainer);
},
cancel: function() {
},
linkType: "preview", // or "direct"
multiselect: false,
folderselect: true
};
// inject Chooser button
let button = Dropbox.createChooseButton(options);
document.getElementById("chooserContainer").appendChild(button);
// generate embeds on button click
embedButton.onclick = function(){
let linkToEmbed = document.getElementById("userSharedLink").value;
let embedContainer = document.getElementById("embedContainer")
Dropbox.embed({link: linkToEmbed}, embedContainer)
document.getElementById("userSharedLink").value = "";
document.getElementById("embedContainer").appendChild(document.createElement("hr"))
}