update blocking in oxd + callback in oxff, split modules in ox.jsm and oxff.jsm
This commit is contained in:
parent
9cf7c84558
commit
1be85a89d8
7 changed files with 153 additions and 120 deletions
|
|
@ -1,10 +1,59 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="http://oxjs.org/js/jquery-1.4.2.min.js"></script>
|
||||
<script>
|
||||
|
||||
var ox = new OxFF();
|
||||
ox.access(true);
|
||||
ox.get('b2c8f0aa3a447d09', 'stills', function(result) { console.log(result);});
|
||||
ox.login('j');
|
||||
ox.login('username');
|
||||
|
||||
//ox.get('b2c8f0aa3a447d09', 'stills', function(result) { console.log(result);});
|
||||
//ox.files(function(result) { console.log(result);});
|
||||
|
||||
function update() {
|
||||
var updating = true;
|
||||
ox.update(function(result) {
|
||||
console.log('updating done', result);
|
||||
updating = false });
|
||||
var getFiles = function() {
|
||||
ox.volumes(function(result) {
|
||||
var volumes = JSON.parse(result);
|
||||
for(volume in volumes) {
|
||||
(function(volume) {
|
||||
var volumeId = volume.replace(/[ \/]/g, '_');
|
||||
var $volume = $('#'+volumeId);
|
||||
if($volume.length==0)
|
||||
$volume = $('<div>').attr('id', volumeId);
|
||||
$volume.html('<h1>'+volume+'</h1>');
|
||||
$('#files').append($volume);
|
||||
ox.files(volume, function(result) {
|
||||
var files = JSON.parse(result);
|
||||
$.each(files, function(folder, f) {
|
||||
$file = $('<div>').html(folder);
|
||||
$volume.append($file);
|
||||
});
|
||||
});
|
||||
}(volume));
|
||||
}
|
||||
if(updating) {
|
||||
setTimeout(getFiles, 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
getFiles();
|
||||
}
|
||||
|
||||
function addVolume() {
|
||||
console.log(ox.addVolume())
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<input type="button" onClick="addVolume()" value="Add Volume">
|
||||
<input type="button" onClick="update()" value="Update">
|
||||
<div id="files">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue