From 9df2ee3166db7a3f3623f0ef73bc8feaecaa85cd Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 9 Jan 2008 01:51:43 +0000 Subject: [PATCH] Moving popup menu javascript to galaxy.panel.js (will be used in main interface eventually) --- static/scripts/galaxy.panels.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/static/scripts/galaxy.panels.js b/static/scripts/galaxy.panels.js index b249313a120..4f4081d9501 100644 --- a/static/scripts/galaxy.panels.js +++ b/static/scripts/galaxy.panels.js @@ -14,6 +14,16 @@ function ensure_dd_helper() { } e.appendTo("body").hide(); } + // And the helper below the popup menus + if ( jq( "#popup-helper" ).length == 0 ) { + var e = jq(""); + if ( jq.browser.ie ) { + // Element will not capture drags in ie without nonzero opacity, + // but causes flashing in firefox with nonzero opacity + e.css( "opacity", "0.01" ); + } + e.appendTo("body").hide(); + } } function make_left_panel( panel_el, center_el, border_el ) { @@ -174,3 +184,23 @@ function make_right_panel( panel_el, center_el, border_el ) { ).find( "div" ).show(); return { handle_minwidth_hint: handle_minwidth_hint }; }; + +function make_popupmenu( button_element, options ) { + var menu_element = $( "
" ).appendTo( "body" ); + $.each( options, function( k, v ) { + $( "
" ).html( k ).click( v ).appendTo( menu_element ); + }); + var clean = function() { + $(menu_element).unbind().hide(); + $("#popup-helper").unbind().hide(); + }; + var click = function() { + var o = $(button_element).offset(); + $("#popup-helper").mousedown( clean ).show(); + $( menu_element ).click( clean ).css( { top: -1000 } ).show().css( { + top: o.top + $(button_element).height() + 9, + left: o.left + $(button_element).width() - $(menu_element).width() + } ); + }; + $( button_element ).click( click ); +}; \ No newline at end of file