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')
  }
@@ -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);