From a3b85d7b8560cdc1057fcaffa3acbd247b4b5b7a Mon Sep 17 00:00:00 2001
From: Thomas B. <thomas@roundcube.net>
Date: Mon, 07 Oct 2013 13:19:03 -0400
Subject: [PATCH] Merge pull request #133 from cwickert/release-0.9-canned-responses

---
 skins/larry/ui.js |   49 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 12dae31..19f8a51 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -1,7 +1,7 @@
 /**
  * Roundcube functions for default skin interface
  *
- * Copyright (c) 2011, The Roundcube Dev Team
+ * Copyright (c) 2013, The Roundcube Dev Team
  *
  * The contents are subject to the Creative Commons Attribution-ShareAlike
  * License. It is allowed to copy, distribute, transmit and to adapt the work
@@ -43,6 +43,19 @@
   this.hide_header_row = hide_header_row;
 
 
+  // set minimal mode on small screens (don't wait for document.ready)
+  if (window.$ && document.body) {
+    var minmode = rcmail.get_cookie('minimalmode');
+    if (parseInt(minmode) || (minmode === null && $(window).height() < 850)) {
+      $(document.body).addClass('minimal');
+    }
+
+    if (bw.tablet) {
+      $('#viewport').attr('content', "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0");
+    }
+  }
+
+
   /**
    *
    */
@@ -58,6 +71,17 @@
   function init()
   {
     rcmail.addEventListener('message', message_displayed);
+
+    /*** prepare minmode functions ***/
+    $('#taskbar a').each(function(i,elem){
+      $(elem).append('<span class="tooltip">' + $('.button-inner', this).html() + '</span>')
+    });
+
+    $('#taskbar .minmodetoggle').click(function(e){
+      var ismin = $(document.body).toggleClass('minimal').hasClass('minimal');
+      rcmail.set_cookie('minimalmode', ismin?1:0);
+      $(window).resize();
+    });
 
     /***  mail task  ***/
     if (rcmail.env.task == 'mail') {
@@ -95,6 +119,11 @@
           layout_composeview();
           return false;
         }).css('cursor', 'pointer');
+
+        // toggle compose options if opened in new window and they were visible before
+        var opener_rc = rcmail.opener();
+        if (opener_rc && opener_rc.env.action == 'compose' && $('#composeoptionstoggle', opener.document).hasClass('remove'))
+          $('#composeoptionstoggle').click();
 
         new rcube_splitter({ id:'composesplitterv', p1:'#composeview-left', p2:'#composeview-right',
           orientation:'v', relative:true, start:248, min:170, size:12, render:layout_composeview }).init();
@@ -219,8 +248,13 @@
 
     $('iframe').load(function(e){
       // this = iframe
-      var doc = this.contentDocument ? this.contentDocument : this.contentWindow ? this.contentWindow.document : null;
-      $(doc).mouseup(body_mouseup);
+      try {
+        var doc = this.contentDocument ? this.contentDocument : this.contentWindow ? this.contentWindow.document : null;
+        $(doc).mouseup(body_mouseup);
+      }
+      catch (e) {
+        // catch possible "Permission denied" error in IE
+      };
     })
     .contents().mouseup(body_mouseup);
 
@@ -635,8 +669,6 @@
     $('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop('checked', true);
     $('input[name="sort_ord"][value="DESC"]').prop('checked', rcmail.env.sort_order == 'DESC');
     $('input[name="sort_ord"][value="ASC"]').prop('checked', rcmail.env.sort_order != 'DESC');
-    $('input[name="view"][value="thread"]').prop('checked', rcmail.env.threading ? true : false);
-    $('input[name="view"][value="list"]').prop('checked', rcmail.env.threading ? false : true);
 
     // set checkboxes
     $('input[name="list_col[]"]').each(function() {
@@ -665,11 +697,10 @@
 
     var sort = $('input[name="sort_col"]:checked').val(),
       ord = $('input[name="sort_ord"]:checked').val(),
-      thread = $('input[name="view"]:checked').val(),
       cols = $('input[name="list_col[]"]:checked')
         .map(function(){ return this.value; }).get();
 
-    rcmail.set_list_options(cols, sort, ord, thread == 'thread' ? 1 : 0);
+    rcmail.set_list_options(cols, sort, ord, rcmail.env.threading);
   }
 
 
@@ -916,11 +947,11 @@
   this.delay = 500;
 
   this.top
-    .mouseenter(function() { ref.ts = window.setTimeout(function() { ref.scroll('down'); }, ref.delay); })
+    .mouseenter(function() { if (rcmail.drag_active) ref.ts = window.setTimeout(function() { ref.scroll('down'); }, ref.delay); })
     .mouseout(function() { if (ref.ts) window.clearTimeout(ref.ts); });
 
   this.bottom
-    .mouseenter(function() { ref.ts = window.setTimeout(function() { ref.scroll('up'); }, ref.delay); })
+    .mouseenter(function() { if (rcmail.drag_active) ref.ts = window.setTimeout(function() { ref.scroll('up'); }, ref.delay); })
     .mouseout(function() { if (ref.ts) window.clearTimeout(ref.ts); });
 
   this.scroll = function(dir)

--
Gitblit v1.9.1