diff options
author | Chad Kieffer <chad@2tbsp.com> | 2009-01-14 06:36:47 +0000 |
---|---|---|
committer | Chad Kieffer <chad@2tbsp.com> | 2009-01-14 06:36:47 +0000 |
commit | c383b2fc35bbe1864acb79b784b4cd3a2f82a95e (patch) | |
tree | 2cd09ea90f3c56adca6ecd45f29f3016196d52fa /core/js | |
parent | 2a7d4b43653d8d340bae185c48dde4de4f8741be (diff) |
Visually attach the quick edit menu to the thumbnail container. Added more edit options (move, select as album cover, delete, additional options).
Need to decide which belong in the bar and which belong in a dropdown menu under "options."
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/quick.js | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/core/js/quick.js b/core/js/quick.js index d934bd72..0462e939 100644 --- a/core/js/quick.js +++ b/core/js/quick.js @@ -1,21 +1,22 @@ $(document).ready(function() { - $(".gQuick").hover(show_quick, function() {}); + $(".gItem").hover(show_quick, function() {}); }); var show_quick = function() { - var quick = $(this); + var cont = $(this); + var quick = $(this).find(".gQuick"); $("#gQuickPane").remove(); - quick.append("<div id=\"gQuickPane\"></div>"); - var img = quick.find("img"); - var pos = img.position(); + cont.append("<div id=\"gQuickPane\"></div>"); + var img = cont.find(".gThumbnail"); + var pos = cont.position(); $("#gQuickPane").css({ "position": "absolute", "top": pos.top, "left": pos.left, - "width": img.innerWidth(), + "width": cont.innerWidth(), "height": 32 }); - quick.hover(function() { }, hide_quick); + cont.hover(function() { }, hide_quick); $.get( quick.attr("href"), {}, @@ -23,36 +24,33 @@ var show_quick = function() { $("#gQuickPane").html(data); $("#gQuickPane a").click(function(e) { e.preventDefault(); - quick_do(quick, $(this), img); + quick_do(cont, $(this), img); }); } ); }; -var quick_do = function(quick, pane, img) { +var quick_do = function(cont, pane, img) { if (pane.hasClass("gDialogLink")) { openDialog(pane, function() { window.location.reload(); }); } else { - img.css("opacity", "0.2"); - quick.addClass("gLoadingLarge"); + img.css("opacity", "0.1"); + cont.addClass("gLoadingLarge"); $.ajax({ type: "GET", url: pane.attr("href"), dataType: "json", success: function(data) { - img.css("opacity", "1"); - img.attr("width", data.width); - img.attr("height", data.height); - img.attr("src", data.src); - var pos = img.position(); - quick.removeClass("gLoadingLarge"); - $("#gQuickPane").css({ - "position": "absolute", - "top": pos.top, - "left": pos.left, - "width": img.innerWidth() + 1, - "height": 32 - }); + img.css("opacity", "1"); + img.attr("width", data.width); + img.attr("height", data.height); + img.attr("src", data.src); + if (data.height > data.width) { + img.css("margin-top", -$("#gQuickPane").height()); + } else { + img.css("margin-top", 0); + } + cont.removeClass("gLoadingLarge"); } }); } |