blob: d4fb1f0475e83094854e8c4bd6746f5f2a1a5f12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
var actual_cover;
$('body').ready(function() {
$('div[class=gallery_album_box]').each(function(i, e) {
$.getJSON('ajax/getCovers.php', { album: $(e).children('h1:last').text() }, function(a) {
if (a.status == "success") {
e.ic = a.imageCount;
e.images = a.images;
if (e.ic > 0) {
$(e).find('img[class=gallery_album_cover]').attr('src', 'ajax/thumbnail.php?img=' + e.images[0]);
actual_cover = 0;
}
}
});
});
$('img[class=gallery_album_cover]').each(function(i, e) {
$(e).mousemove(function(a) {
if (e.parentNode.parentNode.ic!=0) {
var x = Math.min(Math.floor((a.clientX - this.offsetLeft)/(200/e.parentNode.parentNode.ic)), e.parentNode.parentNode.ic-1);
if (actual_cover != x) {
$(e).attr('src', 'ajax/thumbnail.php?img=' + e.parentNode.parentNode.images[x]);
actual_cover = x;
}
}
});
});
});
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);
}
});
}
|