diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2014-06-05 09:18:07 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2014-06-05 09:18:07 +0200 |
commit | 99cdca46b7bcc46fe6affd9e9f9f60a546b2e5b8 (patch) | |
tree | e3d0bec8e981825e98681fb4d5ec1ec73ee65c40 /program/js/common.js | |
parent | 17a76c3fd7665e92d2160f2178e31b3821a98e1e (diff) | |
parent | 3412e50b54e3daac8745234e21ab6e72be0ed165 (diff) |
Merge branch 'dev-accessibility'
Conflicts:
program/include/rcmail_output_html.php
program/js/app.js
program/js/treelist.js
program/lib/Roundcube/html.php
skins/larry/styles.css
skins/larry/templates/compose.html
Diffstat (limited to 'program/js/common.js')
-rw-r--r-- | program/js/common.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/program/js/common.js b/program/js/common.js index 48e85558f..5ac4febce 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -281,6 +281,25 @@ cancel: function(evt) return false; }, +/** + * Determine whether the given event was trigered from keyboard + */ +is_keyboard: function(e) +{ + return e && ( + (e.mozInputSource && e.mozInputSource == e.MOZ_SOURCE_KEYBOARD) || + (!e.pageX && (e.pageY || 0) <= 0 && !e.clientX && (e.clientY || 0) <= 0) + ); +}, + +/** + * 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) { return { pageX:e.pageX, pageY:e.pageY, offsetX:e.pageX - e.target.offsetLeft, offsetY:e.pageY - e.target.offsetTop, target:e.target, istouch:true }; @@ -593,6 +612,11 @@ if (!String.prototype.startsWith) { }; } +// 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() { |