diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-04 19:54:38 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-04 19:54:38 +0000 |
commit | 99804a34b2440589e91d5fe06f8b39b44d6561f2 (patch) | |
tree | 8bf9614dacf2860709bf1a1e71e58fad6d490f33 /core/js/quick.js | |
parent | 63302ad49c6a5a956b396978ba45d74ea9891cd5 (diff) |
Rename:
gQuickEdit to gQuick
quick_edit -> quick
Diffstat (limited to 'core/js/quick.js')
-rw-r--r-- | core/js/quick.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/core/js/quick.js b/core/js/quick.js new file mode 100644 index 00000000..858ba3f2 --- /dev/null +++ b/core/js/quick.js @@ -0,0 +1,58 @@ +$(document).ready(function() { + $(".gQuick").hover(show_quick, function() {}); +}); + +var show_quick = function() { + var quick = $(this); + $("#gQuickPane").remove(); + quick.append("<div id=\"gQuickPane\"></div>"); + var img = quick.find("img"); + var pos = img.position(); + $("#gQuickPane").css({ + "position": "absolute", + "top": pos.top, + "left": pos.left, + "width": img.innerWidth() + 1, + "height": 32 + }); + quick.hover(function() { }, hide_quick); + $.get( + quick.attr("quick_link"), + {}, + function(data, textStatus) { + $("#gQuickPane").html(data); + $("#gQuickPane div").click(function() { + quick_do(quick, $(this), img); + }); + } + ); +}; + +var quick_do = function(quick, pane, img) { + img.css("opacity", "0.2"); + quick.addClass("gLoadingLarge"); + $.ajax({ + type: "GET", + url: pane.attr("quick_link"), + 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 + }); + } + }); +}; + +var hide_quick = function() { + $("#gQuickPane").remove(); +}; |