-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.js
59 lines (50 loc) · 1.28 KB
/
main.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
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
var client = new Dropbox.Client({ 'key': '75g7txpckgllo8y'});
client.authDriver(new Dropbox.AuthDriver.Redirect({ 'rememberUser': true }));
if (! client.isAuthenticated()) {
client.authenticate(function (error, client) {
if (error) {
console.log(error);
}
console.log(client);
});
}
listDirInHTML(client, "/");
$('#parentDirectory').hide();
$('#newFile').click(function () {
resetEditor();
showEditor();
});
$('#closeButton').click(function(){
resetEditor();
hideEditor();
});
$('#newDir').click(function () {
Modal.prompt({
title: "Create directory",
input_type:"text",
optional: {
affirmative_label: "Create"
},
success: function (value) {
if (value === null || value === "") {
displayError("Need a directory name");
}
else {
createDirectory(client, pathString(), value);
}
}
});
});
$('#saveFileButton').click(function () {
if ($('#key').val() === $('#verify_key').val()){
createFile(client, pathString(), $('#newFileName').text(), $('#fileContent').html(), $('#key').val());
}
else{
displayError("Passwords don't match");
}
});
$('#reloadDir').click(function () {
console.log("Reloading...");
delete dirResults[pathString()];
listDirInHTML(client, pathString());
});