2011-09-26 00:32:08 +04:00
|
|
|
var actual_cover;
|
2011-10-01 13:26:47 +04:00
|
|
|
$(document).ready(function() {
|
|
|
|
$.getJSON('ajax/getAlbums.php', function(r) {
|
|
|
|
if (r.status == 'success') {
|
|
|
|
for (var i in r.albums) {
|
|
|
|
var a = r.albums[i];
|
2011-10-18 23:43:33 +04:00
|
|
|
Albums.add(a.name, a.numOfItems, a.bgPath);
|
2011-09-26 00:32:08 +04:00
|
|
|
}
|
2011-10-01 13:26:47 +04:00
|
|
|
var targetDiv = document.getElementById('gallery_list');
|
|
|
|
if (targetDiv) {
|
|
|
|
Albums.display(targetDiv);
|
|
|
|
} else {
|
|
|
|
alert('Error occured: no such layer `gallery_list`');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
alert('Error occured: ' + r.message);
|
|
|
|
}
|
2011-09-26 00:32:08 +04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
function createNewAlbum() {
|
|
|
|
var name = prompt("album name", "");
|
|
|
|
if (name != null && name != "") {
|
|
|
|
$.getJSON("ajax/createAlbum.php", {album_name: name}, function(r) {
|
|
|
|
if (r.status == "success") {
|
|
|
|
var v = '<div class="gallery_album_box"><a href="?view='+r.name+'"><img class="gallery_album_cover"/></a><h1>'+r.name+'</h1></div>';
|
|
|
|
$('div#gallery_list').append(v);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function scanForAlbums() {
|
|
|
|
$.getJSON('ajax/scanForAlbums.php', function(r) {
|
|
|
|
if (r.status == 'success') {
|
|
|
|
window.location.reload(true);
|
|
|
|
} else {
|
|
|
|
alert('Error occured: ' + r.message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|