summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-09-11 00:08:38 -0700
committerBharat Mediratta <bharat@menalto.com>2010-09-11 00:08:38 -0700
commitb35886c0fc6f2d37ee1974a35b0cad50e6729757 (patch)
tree7f3f6b5ea30045c031d3d7619ef7ebfb5cb1c4db /lib
parent304dd9cb51b3514f2e663674d22f0d73c0f3e583 (diff)
Refactor $.fn.gallery_context_menu() to store some variables instead
of using CSS selector lookups for every operation. I assume (but have not verified) that this is more efficient.
Diffstat (limited to 'lib')
-rw-r--r--lib/gallery.common.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/gallery.common.js b/lib/gallery.common.js
index 548b2e7c..81e26e1b 100644
--- a/lib/gallery.common.js
+++ b/lib/gallery.common.js
@@ -131,20 +131,21 @@
// Initialize context menus
$.fn.gallery_context_menu = function() {
if ($(".g-context-menu li").length) {
- var hover_target = ".g-context-menu";
+ var hover_target = $(this).find(".g-context-menu");
+ var list = $(hover_target).find("ul");
var in_progress = 0;
- $(hover_target + " *").removeAttr('title');
- $(hover_target + " ul").hide();
- $(hover_target).hover(
+ hover_target.find("*").removeAttr('title');
+ list.hide();
+ hover_target.hover(
function() {
if (in_progress == 0) {
- $(this).find("ul").slideDown("fast", function() { in_progress = 1; });
+ list.slideDown("fast", function() { in_progress = 1; });
$(this).find(".g-dialog-link").gallery_dialog();
$(this).find(".g-ajax-link").gallery_ajax();
}
},
function() {
- $(this).find("ul").slideUp("slow", function() { in_progress = 0; });
+ list.slideUp("slow", function() { in_progress = 0; });
}
);
}