mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
var CloudCommander, DOM, Dropbox;
|
|
/* module for work with github */
|
|
|
|
(function(){
|
|
"use strict";
|
|
|
|
var cloudcmd = CloudCommander,
|
|
CHOOSER_API = 'https://www.dropbox.com/static/api/1/dropbox.js',
|
|
CLIENT_ID,
|
|
DropBoxStore = {},
|
|
options = {
|
|
linkType: "direct",
|
|
success: function(files) {
|
|
console.log("Here's the file link:" + files[0].link);
|
|
},
|
|
cancel: function() {
|
|
console.log('Chose something');
|
|
}
|
|
};
|
|
|
|
/* PRIVATE FUNCTIONS */
|
|
|
|
/**
|
|
* function loads dropbox.js
|
|
*/
|
|
function load(){
|
|
console.time('dropbox load');
|
|
|
|
cloudcmd.getConfig(function(pConfig){
|
|
var lElement = DOM.anyload({
|
|
src : CHOOSER_API,
|
|
not_append : true,
|
|
id : 'dropboxjs',
|
|
func : DropBoxStore.choose
|
|
|
|
});
|
|
|
|
var lDropBoxId = pConfig.dropbox_chooser_key;
|
|
lElement.setAttribute('data-app-key', lDropBoxId);
|
|
document.body.appendChild(lElement);
|
|
|
|
console.timeEnd('dropbox load');
|
|
});
|
|
}
|
|
|
|
DropBoxStore.choose = function(){
|
|
Dropbox.choose(options);
|
|
};
|
|
|
|
DropBoxStore.init = function(){
|
|
load();
|
|
};
|
|
|
|
cloudcmd.DropBox = DropBoxStore;
|
|
})();
|