2010-08-05 16:34:07 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<script src="http://oxjs.org/js/jquery-1.4.2.min.js"></script>
|
2010-08-03 20:49:30 +00:00
|
|
|
<script>
|
2010-08-05 16:34:07 +00:00
|
|
|
|
2010-08-03 20:49:30 +00:00
|
|
|
var ox = new OxFF();
|
|
|
|
ox.access(true);
|
2010-08-05 16:34:07 +00:00
|
|
|
ox.login('username');
|
2010-08-03 20:49:30 +00:00
|
|
|
|
2010-08-05 16:34:07 +00:00
|
|
|
//ox.get('b2c8f0aa3a447d09', 'stills', function(result) { console.log(result);});
|
2010-08-03 20:49:30 +00:00
|
|
|
//ox.files(function(result) { console.log(result);});
|
|
|
|
|
2010-08-05 16:34:07 +00:00
|
|
|
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();
|
|
|
|
}
|
2010-08-03 20:49:30 +00:00
|
|
|
|
2010-08-05 16:34:07 +00:00
|
|
|
function addVolume() {
|
|
|
|
console.log(ox.addVolume())
|
|
|
|
}
|
2010-08-03 20:49:30 +00:00
|
|
|
</script>
|
2010-08-05 16:34:07 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<input type="button" onClick="addVolume()" value="Add Volume">
|
|
|
|
<input type="button" onClick="update()" value="Update">
|
|
|
|
<div id="files">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|