From 83b5834360f7863227e4ce4e43415d26d1b74e23 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 12 Jan 2015 13:02:29 -0500
Subject: [PATCH] Skip .skip-on-drag elements when producing long subject title

---
 program/js/common.js |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/program/js/common.js b/program/js/common.js
index 48e8555..2b96a8a 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -31,7 +31,6 @@
 var SHIFT_KEY = 2;
 var CONTROL_SHIFT_KEY = 3;
 
-
 /**
  * Default browser check class
  * @constructor
@@ -104,7 +103,7 @@
   this.xmlhttp_test = function()
   {
     var activeX_test = new Function("try{var o=new ActiveXObject('Microsoft.XMLHTTP');return true;}catch(err){return false;}");
-    this.xmlhttp = (window.XMLHttpRequest || (window.ActiveXObject && activeX_test()));
+    this.xmlhttp = window.XMLHttpRequest || (('ActiveXObject' in window) && activeX_test());
     return this.xmlhttp;
   };
 
@@ -279,6 +278,28 @@
   e.cancelBubble = true;
 
   return false;
+},
+
+/**
+ * Determine whether the given event was trigered from keyboard
+ */
+is_keyboard: function(e)
+{
+  return e && (
+      (e.pointerType !== undefined && e.pointerType !== 'mouse') ||       // IE 11+
+      (e.mozInputSource && e.mozInputSource == e.MOZ_SOURCE_KEYBOARD) ||  // Firefox
+      (e.offsetX === 0 && e.offsetY === 0) || // Opera
+      (!e.pageX && (e.pageY || 0) <= 0 && !e.clientX && (e.clientY || 0) <= 0) ||  // others
+      (bw.ie && rcube_event._last_keyboard_event && rcube_event._last_keyboard_event.target == e.target)  // hack for IE <= 10
+    );
+},
+
+/**
+ * Accept event if triggered from keyboard action (e.g. <Enter>)
+ */
+keyboard_only: function(e)
+{
+  return rcube_event.is_keyboard(e) ? true : rcube_event.cancel(e);
 },
 
 touchevent: function(e)
@@ -593,6 +614,11 @@
   };
 }
 
+// array utility function
+jQuery.last = function(arr) {
+  return arr && arr.length ? arr[arr.length-1] : undefined;
+}
+
 // jQuery plugin to emulate HTML5 placeholder attributes on input elements
 jQuery.fn.placeholder = function(text) {
   return this.each(function() {

--
Gitblit v1.9.1