div#gallery_list { margin: 90pt 20pt; }
-div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: scroll; }
-div#gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; position: relative; overflow: hidden; color: #999; }
-div#gallery_album_box:hover { color: black; }
-.leftcontent div#gallery_album_box { margin: 5px; }
-div#gallery_album_box h1 { font-size: 9pt; font-family: Verdana; }
-div#gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; }
-div#gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0.5; visibility:hidden; padding: 0 5pt; }
-div#gallery_control_overlay a { color:white; }
+div.gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: scroll; }
+div.gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; position: relative; overflow: hidden; color: #999; }
+div.gallery_album_box:hover { color: black; }
+.leftcontent div.gallery_album_box { margin: 5px; }
+div.gallery_album_box h1 { font-size: 9pt; font-family: Verdana; }
+div.gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; }
+div.gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0; padding: 0 5pt; }
+div.gallery_album_box:hover div.gallery_control_overlay { opacity:0.5 }
+div.gallery_control_overlay a { color:white; }
#gallery_images.rightcontent { padding:10px 5px; position:absolute; bottom: 0px; overflow: scroll; }
if (confirm(t('gallery',"Do you wan't to remove album")+' ' + albumName + "?")) {
$.getJSON("ajax/galleryOp.php", {operation: "remove", name: albumName}, function(r) {
if (r.status == "success") {
- $("#gallery_album_box[title='"+albumName+"']").remove();
- Albums.remove(albumName);
+ $(".gallery_album_box").filterAttr('data-album',albumName).remove();
+ Albums.remove(albumName);
} else {
alert("Error: " + r.cause);
}
}
$.getJSON("ajax/galleryOp.php", {operation: "rename", oldname: name, newname: result}, function(r) {
if (r.status == "success") {
- Albums.rename($("#gallery_album_box[title='"+name+"']"), result);
+ Albums.rename($(".gallery_album_box").filterAttr('data-album',albumName), result);
} else {
alert("Error: " + r.cause);
}
// displays gallery in linear representation
// on given element, and apply default styles for gallery
display: function(element) {
- var displayTemplate = '<div id="gallery_album_box" title="*NAME*"><div id="gallery_control_overlay"><a href="#" onclick="galleryRename(\'*NAME*\');return false;">rename</a> | <a href="#" onclick="galleryRemove(\'*NAME*\');">remove</a></div><a href="?view=*NAME*"><div id="gallery_album_cover" title="*NAME*"></div></a><h1>*NAME*</h1></div></div>';
+ var displayTemplate = '<div class="gallery_album_box"><div class="gallery_control_overlay"><a href="#" class="rename">rename</a> | <a href="#" class="remove">remove</a></div><a class="view"><div class="gallery_album_cover"></div></a><h1></h1></div></div>';
for (var i in Albums.albums) {
var a = Albums.albums[i];
- var local = $(displayTemplate.replace(/\*NAME\*/g, a.name));
- $("#gallery_album_cover", local).css('background-repeat', 'no-repeat');
- $("#gallery_album_cover", local).css('background-position', '0');
- $("#gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+a.name+'")');
- local.mouseover(function(e) {
- $("#gallery_control_overlay", this).css('visibility','visible');
- });
- local.mouseout(function(e) {
- $("#gallery_control_overlay", this).css('visibility','hidden');
- });
- $("#gallery_album_cover", local).mousemove(function(e) {
+ var local=$(displayTemplate);
+ local.attr('data-album',a.name);
+ $(".gallery_control_overlay a.rename", local).click(function(name,event){
+ event.preventDefault();
+ galleryRename(name);
+ }.bind(null,a.name));
+ $(".gallery_control_overlay a.remove", local).click(function(name,event){
+ event.preventDefault();
+ galleryRemove(name);
+ }.bind(null,a.name));
+ $("a.view", local).attr('href','?view='+a.name);
+ $('h1',local).text(a.name);
+ $(".gallery_album_cover", local).attr('title',a.name);
+ $(".gallery_album_cover", local).css('background-repeat', 'no-repeat');
+ $(".gallery_album_cover", local).css('background-position', '0');
+ $(".gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+a.name+'")');
+ $(".gallery_album_cover", local).mousemove(function(e) {
var albumMetadata = Albums.find(this.title);
if (albumMetadata == undefined) {