59 lines
1.7 KiB
HTML
59 lines
1.7 KiB
HTML
<!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.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>
|