diff options
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 12 | ||||
-rw-r--r-- | program/js/common.js | 8 | ||||
-rw-r--r-- | program/js/list.js | 30 |
3 files changed, 35 insertions, 15 deletions
diff --git a/program/js/app.js b/program/js/app.js index 45a17d640..dedad37d2 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -398,7 +398,7 @@ function rcube_webmail() } else if (this.env.action == 'edit-folder' && this.gui_objects.editform) { this.enable_command('save', 'folder-size', true); - parent.rcmail.env.messagecount = this.env.messagecount; + parent.rcmail.env.exists = this.env.messagecount; parent.rcmail.enable_command('purge', this.env.messagecount); $("input[type='text']").first().select(); } @@ -1731,6 +1731,14 @@ function rcube_webmail() if (!row.depth && row.has_children && (expando = document.getElementById('rcmexpando'+row.uid))) { row.expando = expando; expando.onmousedown = function(e) { return self.expand_message_row(e, uid); }; + if (bw.touch) { + expando.addEventListener('touchend', function(e) { + if (e.changedTouches.length == 1) { + self.expand_message_row(e, uid); + return rcube_event.cancel(e); + } + }, false); + } } this.triggerEvent('insertrow', { uid:uid, row:row }); @@ -4995,7 +5003,7 @@ function rcube_webmail() this.replace_contact_photo = function(id) { var img_src = id == '-del-' ? this.env.photo_placeholder : - this.env.comm_path + '&_action=photo&_source=' + this.env.source + '&_cid=' + this.env.cid + '&_photo=' + id; + this.env.comm_path + '&_action=photo&_source=' + this.env.source + '&_cid=' + (this.env.cid || 0) + '&_photo=' + id; this.set_photo_actions(id); $(this.gui_objects.contactphoto).children('img').attr('src', img_src); diff --git a/program/js/common.js b/program/js/common.js index de07ec131..afaf91639 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -62,7 +62,7 @@ function roundcube_browser() this.safari = (!this.chrome && (this.agent_lc.indexOf('safari') > 0 || this.agent_lc.indexOf('applewebkit') > 0)); this.konq = (this.agent_lc.indexOf('konqueror') > 0); this.mz = (this.dom && !this.ie && !this.ns && !this.chrome && !this.safari && !this.konq && this.agent.indexOf('Mozilla') >= 0); - this.iphone = (this.safari && this.agent_lc.indexOf('iphone') > 0); + this.iphone = (this.safari && (this.agent_lc.indexOf('iphone') > 0 || this.agent_lc.indexOf('ipod') > 0)); this.ipad = (this.safari && this.agent_lc.indexOf('ipad') > 0); this.opera = window.opera ? true : false; @@ -83,7 +83,9 @@ function roundcube_browser() if (this.safari && (/;\s+([a-z]{2})-[a-z]{2}\)/.test(this.agent_lc))) this.lang = RegExp.$1; - this.mobile = this.agent_lc.match(/iphone|ipad|ipod|android|blackberry|iemobile|opera mini|opera mobi/); + this.tablet = /ipad|android|xoom|sch-i800|playbook|tablet|kindle/i.test(this.agent_lc); + this.mobile = /iphone|ipod|blackberry|iemobile|opera mini|opera mobi|mobile/i.test(this.agent_lc); + this.touch = this.mobile || this.tablet; this.dhtml = ((this.ie4 && this.win) || this.ie5 || this.ie6 || this.ns4 || this.mz); this.vml = (this.win && this.ie && this.dom && !this.opera); this.pngalpha = (this.mz || (this.opera && this.vendver >= 6) || (this.ie && this.mac && this.vendver >= 5) || @@ -127,6 +129,8 @@ function roundcube_browser() if (this.mobile) classname += ' mobile'; + if (this.tablet) + classname += ' tablet'; if (document.documentElement) document.documentElement.className += classname; diff --git a/program/js/list.js b/program/js/list.js index 08e4444e1..c2ad3f7c3 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -122,17 +122,25 @@ init_row: function(row) row.onmousedown = function(e){ return self.drag_row(e, this.uid); }; row.onmouseup = function(e){ return self.click_row(e, this.uid); }; - if (bw.mobile) { + if (bw.touch) { row.addEventListener('touchstart', function(e) { if (e.touches.length == 1) { - if (!self.drag_row(rcube_event.touchevent(e.touches[0]), this.uid)) - e.preventDefault(); + self.touchmoved = false; + self.drag_row(rcube_event.touchevent(e.touches[0]), this.uid) } }, false); row.addEventListener('touchend', function(e) { - if (e.changedTouches.length == 1) - if (!self.click_row(rcube_event.touchevent(e.changedTouches[0]), this.uid)) + if (e.changedTouches.length == 1) { + if (!self.touchmoved && !self.click_row(rcube_event.touchevent(e.changedTouches[0]), this.uid)) e.preventDefault(); + } + }, false); + row.addEventListener('touchmove', function(e) { + if (e.changedTouches.length == 1) { + self.touchmoved = true; + if (self.drag_active) + e.preventDefault(); + } }, false); } @@ -157,7 +165,7 @@ init_header: function() $(this.list.tHead).replaceWith($(this.fixed_header).find('thead').clone()); $(this.list.tHead).find('tr td').attr('style', ''); // remove fixed widths } - else if (this.list.className.indexOf('fixedheader') >= 0) { + else if (!bw.touch && this.list.className.indexOf('fixedheader') >= 0) { this.init_fixed_header(); } @@ -408,7 +416,7 @@ drag_row: function(e, id) if (rcube_event.get_button(e) == 2) return true; - this.in_selection_before = this.in_selection(id) ? id : false; + this.in_selection_before = e && e.istouch || this.in_selection(id) ? id : false; // selects currently unselected row if (!this.in_selection_before) { @@ -416,12 +424,12 @@ drag_row: function(e, id) this.select_row(id, mod_key, false); } - if (this.draggable && this.selection.length) { + if (this.draggable && this.selection.length && this.in_selection(id)) { this.drag_start = true; this.drag_mouse_start = rcube_event.get_mouse_pos(e); rcube_event.add_listener({event:'mousemove', object:this, method:'drag_mouse_move'}); rcube_event.add_listener({event:'mouseup', object:this, method:'drag_mouse_up'}); - if (bw.mobile) { + if (bw.touch) { rcube_event.add_listener({event:'touchmove', object:this, method:'drag_mouse_move'}); rcube_event.add_listener({event:'touchend', object:this, method:'drag_mouse_up'}); } @@ -1256,7 +1264,7 @@ drag_mouse_move: function(e) { // convert touch event if (e.type == 'touchmove') { - if (e.changedTouches.length == 1) + if (e.touches.length == 1 && e.changedTouches.length == 1) e = rcube_event.touchevent(e.changedTouches[0]); else return rcube_event.cancel(e); @@ -1362,7 +1370,7 @@ drag_mouse_up: function(e) rcube_event.remove_listener({event:'mousemove', object:this, method:'drag_mouse_move'}); rcube_event.remove_listener({event:'mouseup', object:this, method:'drag_mouse_up'}); - if (bw.mobile) { + if (bw.touch) { rcube_event.remove_listener({event:'touchmove', object:this, method:'drag_mouse_move'}); rcube_event.remove_listener({event:'touchend', object:this, method:'drag_mouse_up'}); } |