A better way of intercepting dialog position in larry

pull/5838/head
Aleksander Machniak 8 years ago
parent 7ef975490b
commit 48d9ee4f1f

@ -47,21 +47,6 @@ class jqueryui extends rcube_plugin
$this->include_stylesheet("themes/larry/jquery-ui.css");
}
if ($ui_theme == 'larry') {
// patch dialog position function in order to fully fit the close button into the window
$rcmail->output->add_script("jQuery.extend(jQuery.ui.dialog.prototype.options.position, {
using: function(pos) {
var me = jQuery(this),
offset = me.css(pos).offset(),
topOffset = offset.top - 12;
if (topOffset < 0)
me.css('top', pos.top - topOffset);
if (offset.left + me.outerWidth() + 12 > jQuery(window).width())
me.css('left', pos.left - 12);
}
});", 'foot');
}
// jquery UI localization
$jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array('datepicker'));
if (count($jquery_ui_i18n) > 0) {

@ -123,6 +123,13 @@ function rcube_mail_ui()
{
rcmail.addEventListener('message', message_displayed);
$.widget('ui.dialog', $.ui.dialog, {
open: function() {
this._super();
dialog_open(this);
return this;
}});
/*** prepare minmode functions ***/
$('#taskbar a').each(function(i,elem){
$(elem).append('<span class="tooltip">' + $('.button-inner', this).html() + '</span>')
@ -460,6 +467,22 @@ function rcube_mail_ui()
}
}
// modify dialog position to fully fit the close button into the window
function dialog_open(dialog)
{
var me = $(dialog.uiDialog),
offset = me.offset(),
position = me.position(),
width = me.outerWidth(),
maxWidth = $(window).width(),
topOffset = offset.top - 12;
if (topOffset < 0)
me.css('top', position.top - topOffset);
if (offset.left + width + 12 > maxWidth)
me.css('left', position.left - 12);
}
// Mail view layout initialization and change handler
function mail_layout(p)
{

Loading…
Cancel
Save