From ba6c070edd92ca0fc8a6ee85d51769d64a19ee7c Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Sun, 4 Sep 2011 13:52:43 +0200 Subject: tmp --- lib/scripts/toolbar.js | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'lib/scripts/toolbar.js') diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js index 2306ef5db..7a113ecbf 100644 --- a/lib/scripts/toolbar.js +++ b/lib/scripts/toolbar.js @@ -1,4 +1,3 @@ - // used to identify pickers var pickercounter=0; @@ -202,13 +201,13 @@ function tb_autohead(btn, props, edid){ * @return boolean If button should be appended * @author Gabriel Birke */ -function addBtnActionPicker(btn, props, edid) { +function addBtnActionPicker($btn, props, edid) { var pickerid = 'picker'+(pickercounter++); createPicker(pickerid, props, edid); - btn.click( + $btn.click( function() { - pickerToggle(pickerid,btn); + pickerToggle(pickerid,$btn); return false; } ); @@ -240,19 +239,17 @@ function addBtnActionLinkwiz(btn, props, edid) { * * @author Andreas Gohr */ -function pickerToggle(pickerid,btn){ - var picker = jQuery('#' + pickerid); - if (picker.css('marginLeft') == '-10000px'){ - var x = findPosX(btn[0]); - var y = findPosY(btn[0]); - - picker.css('left',(x+3)+'px') - .css('top', (y+btn[0].offsetHeight+3)+'px') - .css('marginLeft', '0px') - .css('marginTop', '0px'); +function pickerToggle(pickerid,$btn){ + var $picker = jQuery('#' + pickerid); + if ($picker.hasClass('hiddenpicker')) { + var pos = $btn.offset(); + $picker.hide().removeClass('hiddenpicker') + .dw_show() + .offset({left: pos.left+3, top: pos.top+$btn[0].offsetHeight+3}) } else { - picker.css('marginLeft', '-10000px') - .css('marginTop', '-10000px'); + $picker.dw_hide(function () { + jQuery(this).addClass('hiddenpicker').show(); + }); } } @@ -262,11 +259,7 @@ function pickerToggle(pickerid,btn){ * @author Andreas Gohr */ function pickerClose(){ - var pobjs = jQuery('#picker'); - for(var i=0; i