| 19 |
if (BUE.popups[id]) { |
if (BUE.popups[id]) { |
| 20 |
return BUE.popups[id]; |
return BUE.popups[id]; |
| 21 |
} |
} |
| 22 |
var P = BUE.popups[id] = $html(BUE.popHtml).appendTo('body').attr('id', id).find('.bue-popup-title').html(title || '').end().find('.bue-popup-content').html(content || '').end().get(0); |
var $P = $html(BUE.popHtml).appendTo('body').attr('id', id); |
| 23 |
|
var $title = $P.find('.bue-popup-title').html(title || ''); |
| 24 |
|
var $content = $P.find('.bue-popup-content').html(content || ''); |
| 25 |
|
var P = BUE.popups[id] = $P[0]; |
| 26 |
//open |
//open |
| 27 |
P.open = function (title, content, effect) { |
P.open = function (title, content, effect) { |
| 28 |
var E = P.bue = BUE.active, B = E.buttons[E.bindex], pos = $(B).offset(); |
var E = P.bue = BUE.active, B = E.buttons[E.bindex], pos = $(B).offset(); |
|
$(P).css({left: pos.left - 20, top: pos.top + 10}); |
|
| 29 |
if (typeof title != 'undefined' && title != null) { |
if (typeof title != 'undefined' && title != null) { |
| 30 |
$('.bue-popup-title', P).html(title); |
$title.html(title); |
| 31 |
} |
} |
| 32 |
if (typeof content != 'undefined' && content != null) { |
if (typeof content != 'undefined' && content != null) { |
| 33 |
$('.bue-popup-content', P).html(content); |
$content.html(content); |
| 34 |
} |
} |
| 35 |
$(P)[effect || 'show'](); |
$P.css({left: Math.max(10, pos.left - $P.width()/2 + 20), top: pos.top + 10})[effect || 'show'](); |
| 36 |
B.pops = true; |
B.pops = true; |
| 37 |
P.focus && P.focus(); |
P.focus && P.focus(); |
| 38 |
return P; |
return P; |
| 39 |
}; |
}; |
| 40 |
//close |
//close |
| 41 |
P.close = function (effect) {return $(P)[effect || 'hide']()[0]}; |
P.close = function (effect) {return $(P)[effect || 'hide']()[0]}; |
| 42 |
$('.bue-popup-close', P).click(function() {P.close()}); |
$P.find('.bue-popup-close').click(function() {P.close()}); |
| 43 |
//drag |
//drag |
| 44 |
$('.bue-popup-head', P).mousedown(function (e) { |
$P.find('.bue-popup-head').mousedown(function (e) { |
| 45 |
var pos = {X: parseInt($(P).css('left')) - e.pageX, Y: parseInt($(P).css('top')) - e.pageY}; |
var pos = {X: parseInt($P.css('left')) - e.pageX, Y: parseInt($P.css('top')) - e.pageY}; |
| 46 |
var drag = function(e) {$(P).css({left: pos.X + e.pageX, top: pos.Y + e.pageY});return false;}; |
var drag = function(e) {$P.css({left: pos.X + e.pageX, top: pos.Y + e.pageY});return false;}; |
| 47 |
var undrag = function(e) {$(document).unbind('mousemove', drag).unbind('mouseup', undrag)}; |
var undrag = function(e) {$(document).unbind('mousemove', drag).unbind('mouseup', undrag)}; |
| 48 |
$(document).mousemove(drag).mouseup(undrag); |
$(document).mousemove(drag).mouseup(undrag); |
| 49 |
}); |
}); |
| 69 |
var E = D.bue; |
var E = D.bue; |
| 70 |
$(E.textArea).unbind('focus', foc); |
$(E.textArea).unbind('focus', foc); |
| 71 |
E.buttonsDisabled(false).stayClicked(false); |
E.buttonsDisabled(false).stayClicked(false); |
| 72 |
E == BUE.active && E.makeSelection(D.esp.start, D.esp.end).focus(); |
E == BUE.active && E.makeSelection(D.esp.start, D.esp.end); |
| 73 |
D.esp = null; |
D.esp = null; |
| 74 |
return Dc(effect); |
return Dc(effect); |
| 75 |
}; |
}; |