2009-01-04 19:54:38 +00:00
|
|
|
$(document).ready(function() {
|
2009-01-15 06:19:26 +00:00
|
|
|
if ($("#gAlbumGrid").length) {
|
2009-02-07 21:37:42 +00:00
|
|
|
// @todo Add quick edit pane for album (meta, move, permissions, delete)
|
|
|
|
|
$(".gItem").hover(show_quick, function() {});
|
2009-01-15 06:19:26 +00:00
|
|
|
}
|
2009-03-31 05:14:40 +00:00
|
|
|
if ($("#gPhoto").length) {
|
|
|
|
|
$("#gPhoto").hover(show_quick, function() {});
|
2009-01-15 06:19:26 +00:00
|
|
|
}
|
2009-01-04 19:54:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var show_quick = function() {
|
2009-01-14 06:36:47 +00:00
|
|
|
var cont = $(this);
|
|
|
|
|
var quick = $(this).find(".gQuick");
|
2009-07-11 05:52:50 -07:00
|
|
|
var img = cont.find(".gThumbnail,.gResize");
|
2009-07-21 13:39:40 -07:00
|
|
|
cont.find(".gQuickPane").remove();
|
|
|
|
|
cont.append("<div class=\"gQuickPane\"></div>");
|
|
|
|
|
cont.find(".gQuickPane").hide();
|
|
|
|
|
cont.hover(function() {}, function() { cont.find(".gQuickPane").remove(); });
|
2009-01-04 19:54:38 +00:00
|
|
|
$.get(
|
2009-01-05 08:05:50 +00:00
|
|
|
quick.attr("href"),
|
2009-01-04 19:54:38 +00:00
|
|
|
{},
|
|
|
|
|
function(data, textStatus) {
|
2009-07-21 13:39:40 -07:00
|
|
|
cont.find(".gQuickPane").html(data).slideDown("fast");
|
2009-03-05 06:03:04 +00:00
|
|
|
$(".ui-state-default").hover(
|
2009-07-11 06:15:44 -07:00
|
|
|
function() {
|
2009-03-05 06:03:04 +00:00
|
|
|
$(this).addClass("ui-state-hover");
|
|
|
|
|
},
|
2009-07-11 06:15:44 -07:00
|
|
|
function() {
|
2009-03-05 06:03:04 +00:00
|
|
|
$(this).removeClass("ui-state-hover");
|
|
|
|
|
}
|
|
|
|
|
);
|
2009-07-21 13:39:40 -07:00
|
|
|
cont.find(".gQuickPane a:not(.options)").click(function(e) {
|
2009-01-13 06:20:35 +00:00
|
|
|
e.preventDefault();
|
2009-01-14 06:36:47 +00:00
|
|
|
quick_do(cont, $(this), img);
|
2009-01-04 19:54:38 +00:00
|
|
|
});
|
2009-07-21 13:39:40 -07:00
|
|
|
cont.find(".gQuickPane a.options").click(function(e) {
|
2009-02-08 00:42:17 +00:00
|
|
|
e.preventDefault();
|
2009-07-21 13:39:40 -07:00
|
|
|
cont.find(".gQuickPaneOptions").slideToggle("fast");
|
2009-02-08 00:42:17 +00:00
|
|
|
});
|
2009-01-04 19:54:38 +00:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2009-01-14 06:36:47 +00:00
|
|
|
var quick_do = function(cont, pane, img) {
|
2009-05-13 22:56:51 +00:00
|
|
|
if (pane.hasClass("ui-state-disabled")) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2009-01-05 08:05:50 +00:00
|
|
|
if (pane.hasClass("gDialogLink")) {
|
2009-07-11 06:51:21 -07:00
|
|
|
openDialog(pane);
|
2009-01-05 08:05:50 +00:00
|
|
|
} else {
|
2009-01-14 06:36:47 +00:00
|
|
|
img.css("opacity", "0.1");
|
|
|
|
|
cont.addClass("gLoadingLarge");
|
2009-01-05 08:05:50 +00:00
|
|
|
$.ajax({
|
|
|
|
|
type: "GET",
|
|
|
|
|
url: pane.attr("href"),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function(data) {
|
2009-05-30 15:25:24 -06:00
|
|
|
img.css("opacity", "1");
|
|
|
|
|
cont.removeClass("gLoadingLarge");
|
|
|
|
|
if (data.src) {
|
|
|
|
|
img.attr("width", data.width);
|
|
|
|
|
img.attr("height", data.height);
|
|
|
|
|
img.attr("src", data.src);
|
|
|
|
|
if (data.height > data.width) {
|
|
|
|
|
img.css("margin-top", -32);
|
|
|
|
|
} else {
|
|
|
|
|
img.css("margin-top", 0);
|
|
|
|
|
}
|
2009-01-29 09:26:39 +00:00
|
|
|
} else if (data.location) {
|
2009-07-27 12:39:12 -07:00
|
|
|
$.gallery_location(data.location);
|
2009-05-30 15:25:24 -06:00
|
|
|
} else if (data.reload) {
|
2009-07-27 12:39:12 -07:00
|
|
|
$.gallery_reload();
|
2009-05-30 15:25:24 -06:00
|
|
|
}
|
2009-01-05 08:05:50 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2009-01-13 06:20:35 +00:00
|
|
|
return false;
|
2009-01-04 19:54:38 +00:00
|
|
|
};
|