Thomas Bruederli
2014-08-14 29f7b272a54ccb268148c48c2eefb00748dc2512
skins/larry/ui.js
@@ -47,6 +47,7 @@
  this.update_quota = update_quota;
  this.get_pref = get_pref;
  this.save_pref = save_pref;
  this.folder_search_init = folder_search_init;
  // set minimal mode on small screens (don't wait for document.ready)
@@ -211,6 +212,25 @@
        new rcube_splitter({ id:'composesplitterv', p1:'#composeview-left', p2:'#composeview-right',
          orientation:'v', relative:true, start:206, min:170, size:12, render:layout_composeview }).init();
        // enable zen-mode for message body
        if ($.fn.zenForm) {
            $('#composebody').zenForm({ theme: 'light' })
                .on('zf-initialized', function(event, zenbox) {
                    var subject = $('#compose-subject').val(),
                        $zenbox = $(zenbox);
                    $('<h2>').addClass('zen-forms-subject')
                        .text(subject ? subject : rcmail.gettext('nosubject'))
                        .insertBefore('.zen-forms-close-button', zenbox);
                    $zenbox.find('.zen-forms-close-button').attr('title', env.exitfullscreen)
                    $zenbox.find('.zen-forms-theme-switch').attr('title', env.switchtheme)
                    $zenbox.find('.input').first().focus();
                })
                .on('zf-destroyed', function(event) {
                    $('#composebody').focus();
                });
        }
      }
      else if (rcmail.env.action == 'list' || !rcmail.env.action) {
        var previewframe = $('#mailpreviewframe').is(':visible');
@@ -255,6 +275,8 @@
          orientation:'v', relative:true, start:266, min:180, size:12 }).init();
        rcmail.addEventListener('setquota', update_quota);
        folder_search_init($('#folderslist'));
      }
      else if (rcmail.env.action == 'identities') {
        new rcube_splitter({ id:'identviewsplitter', p1:'#identitieslist', p2:'#identity-details',
@@ -494,7 +516,7 @@
    form.css('overflow', ovflw > 0 ? 'auto' : 'hidden');
    w = body.parent().width() - 5;
    h = body.parent().height() - 8;
    h = body.parent().height() - 16;
    body.width(w).height(h);
    $('#composebodycontainer > div').width(w+8);
@@ -505,6 +527,9 @@
    var abooks = $('#directorylist');
    $('#compose-contacts .scroller').css('top', abooks.position().top + abooks.outerHeight());
    // hide zen-mode switch in HTML mode
    $('a.go-zen')[($('#composebody_ifr').is(':visible') ? 'hide' : 'show')]();
  }
@@ -531,6 +556,38 @@
    }
  }
  function folder_search_init(container)
  {
    // animation to unfold list search box
    $('.boxtitle a.search', container).click(function(e) {
      var title = $('.boxtitle', container),
        box = $('.listsearchbox', container),
        dir = box.is(':visible') ? -1 : 1,
        height = 34 + ($('select', box).length ? 22 : 0);
      box.slideToggle({
        duration: 160,
        progress: function(animation, progress) {
          if (dir < 0) progress = 1 - progress;
            $('.scroller', container).css('top', (title.outerHeight() + height * progress) + 'px');
        },
        complete: function() {
          box.toggleClass('expanded');
          if (box.is(':visible')) {
            box.find('input[type=text]').focus();
            height = 34 + ($('select', box).length ? $('select', box).outerHeight() + 4 : 0);
            $('.scroller', container).css('top', (title.outerHeight() + height) + 'px');
          }
          else {
            $('a.reset', box).click();
          }
          // TODO: save state in localStorage
        }
      });
      return false;
    });
  }
  function enable_command(p)
  {