thomascube
2012-02-29 7a32e9c7e82a884d58ec2774d0148e5075a4791c
skins/larry/ui.js
@@ -153,7 +153,7 @@
    }
    /***  login page  ***/
    else if (rcmail.env.task == 'login') {
      if (bw.ie && bw.vendver < 9) {
      if (bw.ie && bw.vendver < 8) {
        var popup = $('<div>')
          .addClass('readtext')
          .html("Roundcube will not work well with the crappy browser ya' using. Get yourself a new internet browsing software and don't come back without!<p>Sincerly,<br/>the Roundcube Dev Team</p>")
@@ -173,30 +173,44 @@
    // turn a group of fieldsets into tabs
    $('.tabbed').each(function(idx, elem){ init_tabs(elem); })
    $(document.body).bind('mouseup', function(e){
      var config, obj, target = e.target;
      for (var id in popups) {
        obj = popups[id];
        config = popupconfig[id];
        if (obj.is(':visible')
          && target.id != id+'link'
          && !config.toggle
          && (!config.editable || !target_overlaps(target, obj.get(0)))
          && (!config.sticky || !rcube_mouse_is_over(e, obj.get(0)))
        ) {
          var myid = id+'';
          window.setTimeout(function(){ show_popupmenu(myid, false) }, 10);
    // decorate select elements
    if (!bw.opera) {
      $('select.decorated').each(function(){
        var title = $('option', this).first().text();
        if ($('option:selected', this).val() != '')
          title = $('option:selected', this).text();
        var select = $(this)
          .change(function(){
            var val = $('option:selected', this).text();
            $(this).next().children().html(val);
          });
        $('<a class="menuselector dropdownselector"><span class="handle">' + title + '</span></a>')
          .offset(select.position())
          .insertAfter(select)
          .children().width(select.width() - 5);
        select.parent().css('position', 'relative');
      });
    }
    $(document.body)
      .bind('mouseup', body_mouseup)
      .bind('keyup', function(e){
        if (e.keyCode == 27) {
          for (var id in popups) {
            if (popups[id].is(':visible'))
              show_popup(id, false);
          }
        }
      }
      });
    $('iframe').load(function(e){
      // this = iframe
      var doc = this.contentDocument ? this.contentDocument : this.contentWindow ? this.contentWindow.document : null;
      $(doc).mouseup(body_mouseup);
    })
    .bind('keyup', function(e){
      if (e.keyCode == 27) {
        for (var id in popups) {
          if (popups[id].is(':visible'))
            show_popup(id, false);
        }
      }
    });
    .contents().mouseup(body_mouseup);
    $(window).resize(function(e) {
      // check target due to bugs in jquery
@@ -204,6 +218,28 @@
      // http://bugs.jquery.com/ticket/9841
      if (e.target == window) resize();
    });
  }
  /**
   * Handler for mouse-up events on the document body.
   * This will close all open popup menus
   */
  function body_mouseup(e)
  {
    var config, obj, target = e.target;
    for (var id in popups) {
      obj = popups[id];
      config = popupconfig[id];
      if (obj.is(':visible')
        && target.id != id+'link'
        && !config.toggle
        && (!config.editable || !target_overlaps(target, obj.get(0)))
        && (!config.sticky || !rcube_mouse_is_over(e, obj.get(0)))
      ) {
        var myid = id+'';
        window.setTimeout(function(){ show_popupmenu(myid, false) }, 10);
      }
    }
  }
  /**
@@ -237,7 +273,7 @@
          resizable: false,
          closeOnEscape: true,
          dialogClass: 'popupmessage ' + p.type,
          title: null,
          title: env.errortitle,
          close: function() {
            me.messagedialog.dialog('destroy').hide();
          },
@@ -448,17 +484,14 @@
  function toggle_preview_headers(button)
  {
    $('#preview-shortheaders').toggle();
    var full = $('#preview-allheaders').toggle();
    var full = $('#preview-allheaders').toggle(),
      button = $('a#previewheaderstoggle');
    // add toggle button to full headers table
    if (!full.data('mod')) {
      $('<a>').attr('href', '#hide')
        .addClass('iconlink remove')
        .html('Hide')
        .appendTo($('<td>').appendTo($('tr:first', full)))
        .click(function(){ toggle_preview_headers(this);return false });
      full.data('mod', true);
    }
    if (full.is(':visible'))
      button.attr('href', '#hide').removeClass('add').addClass('remove')
    else
      button.attr('href', '#details').removeClass('remove').addClass('add')
  }
@@ -712,8 +745,8 @@
   */
  function init_tabs(elem, current)
  {
    var id = elem.id,
      content = $(elem),
    var content = $(elem),
      id = content.get(0).id,
      fs = content.children('fieldset');
    if (!fs.length)
@@ -721,7 +754,7 @@
    if (!id) {
      id = 'rcmtabcontainer';
      elem.attr('id', id);
      content.attr('id', id);
    }
    // first hide not selected tabs
@@ -772,6 +805,7 @@
  {
    var frame = $('<iframe>').attr('id', 'aboutframe')
      .attr('src', rcmail.url('settings/about'))
      .attr('frameborder', '0')
      .appendTo(document.body);
    var h = Math.floor($(window).height() * 0.75);
@@ -798,7 +832,7 @@
/**
 * Roundcube splitter GUI class
 * Roundcube UI splitter class
 *
 * @constructor
 */
@@ -817,11 +851,16 @@
  this.callback = p.callback;
  var me = this;
  rcube_splitter._instances[this.id] = me;
  this.init = function()
  {
    this.p1 = $(this.p.p1);
    this.p2 = $(this.p.p2);
    // check if referenced elements exist, otherwise abort
    if (!this.p1.length || !this.p2.length)
      return;
    // create and position the handle for this splitter
    this.p1pos = this.relative ? this.p1.position() : this.p1.offset();
@@ -842,11 +881,9 @@
      this.handle.css({ left:left+'px', top:'0px' });
    }
    this.elm = this.handle.get(0);
    // listen to window resize on IE
    if (bw.ie)
      $(window).resize(function(e){ onResize(e) });
      $(window).resize(onResize);
    // read saved position from cookie
    var cookie = bw.get_cookie(this.id);
@@ -1016,3 +1053,11 @@
} // end class rcube_splitter
// static getter for splitter instances
rcube_splitter._instances = {};
rcube_splitter.get_instance = function(id)
{
  return rcube_splitter._instances[id];
};