From bc35e865ae700b21ce6085aa33ba8354a2b09ac9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 30 Oct 2013 14:44:37 +0100 Subject: Fix Ctrl+click selection after recent refactorings of keyboard nawigation on list widget --- program/js/list.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/program/js/list.js b/program/js/list.js index 0f63c6dfc..15dd019e0 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -55,7 +55,6 @@ function rcube_list_widget(list, p) this.column_fixed = null; this.last_selected = 0; this.shift_start = 0; - this.in_selection_before = false; this.focused = false; this.drag_mouse_start = null; this.dblclick_time = 500; // default value on MS Windows is 500 @@ -405,20 +404,15 @@ drag_column: function(e, col) drag_row: function(e, id) { // don't do anything (another action processed before) - var evtarget = rcube_event.get_target(e), - tagname = evtarget.tagName.toLowerCase(); - - if (evtarget && (tagname == 'input' || tagname == 'img' || (tagname != 'a' && evtarget.onclick))) + if (!this.is_event_target(e)) return true; // accept right-clicks if (rcube_event.get_button(e) == 2) return true; - this.in_selection_before = e && e.istouch || this.in_selection(id) ? id : false; - // selects currently unselected row - if (!this.in_selection_before) { + if (e && e.istouch || this.in_selection(id)) { var mod_key = rcube_event.get_modifier(e); this.select_row(id, mod_key, false); } @@ -446,22 +440,18 @@ drag_row: function(e, id) */ click_row: function(e, id) { - var now = new Date().getTime(), - mod_key = rcube_event.get_modifier(e), - evtarget = rcube_event.get_target(e), - tagname = evtarget.tagName.toLowerCase(); - - if ((evtarget && (tagname == 'input' || tagname == 'img'))) + // don't do anything (another action processed before) + if (!this.is_event_target(e)) return true; - var dblclicked = now - this.rows[id].clicked < this.dblclick_time; + var now = new Date().getTime(), + dblclicked = now - this.rows[id].clicked < this.dblclick_time; - // selects/unselects currently selected row - if (!this.drag_active && this.in_selection_before == id && !dblclicked) - this.select_row(id, mod_key, true); + // selects (or unselects currently selected) row + if (!this.drag_active && !dblclicked) + this.select_row(id, rcube_event.get_modifier(e), true); this.drag_start = false; - this.in_selection_before = false; // row was double clicked if (this.rowcount && dblclicked && this.in_selection(id)) { @@ -482,6 +472,18 @@ click_row: function(e, id) }, +/** + * Check target of the current event + */ +is_event_target: function(e) +{ + var target = rcube_event.get_target(e), + tagname = target.tagName.toLowerCase(); + + return !(target && (tagname == 'input' || tagname == 'img' || (tagname != 'a' && target.onclick))); +}, + + /* * Returns thread root ID for specified row ID */ -- cgit v1.2.3 From 03da10725c584e2b3273f8cf66a0b2a51aadd275 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 30 Oct 2013 14:49:30 +0100 Subject: Bring back fix for #1489396, unintentionally removed in another pull request --- program/js/list.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/program/js/list.js b/program/js/list.js index 15dd019e0..439e941fa 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -858,14 +858,8 @@ select_first: function(mod_key) { var row = this.get_first_row(); if (row) { - if (mod_key) { - this.shift_select(row, mod_key); - this.triggerEvent('select'); - this.scrollto(row); - } - else { - this.select(row); - } + this.select_row(row, mod_key, false); + this.scrollto(row); } }, @@ -877,14 +871,8 @@ select_last: function(mod_key) { var row = this.get_last_row(); if (row) { - if (mod_key) { - this.shift_select(row, mod_key); - this.triggerEvent('select'); - this.scrollto(row); - } - else { - this.select(row); - } + this.select_row(row, mod_key, false); + this.scrollto(row); } }, -- cgit v1.2.3 From c511f5d7c855b915baac7a014fbfaba974323537 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 30 Oct 2013 15:41:29 +0100 Subject: Eliminate "blinking" loading icon in browser on messages selection - do not assign location.href to the same value as it is --- program/js/app.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 81b796ec1..42cbaa6f9 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2062,12 +2062,14 @@ function rcube_webmail() if (name && (frame = this.get_frame_element(name))) { if (!show && (win = this.get_frame_window(name))) { - if (win.stop) - win.stop(); - else // IE - win.document.execCommand('Stop'); + if (win.location.href.indexOf(this.env.blankpage) < 0) { + if (win.stop) + win.stop(); + else // IE + win.document.execCommand('Stop'); - win.location.href = this.env.blankpage; + win.location.href = this.env.blankpage; + } } else if (!bw.safari && !bw.konq) $(frame)[show ? 'show' : 'hide'](); -- cgit v1.2.3 From 2aacf1a31d63e0f88e1a06fda9a99519a9f29e1a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 30 Oct 2013 15:50:23 +0100 Subject: Fix drag-n-drop broken in bc35e865 --- program/js/list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/js/list.js b/program/js/list.js index 439e941fa..a814c325c 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -412,7 +412,7 @@ drag_row: function(e, id) return true; // selects currently unselected row - if (e && e.istouch || this.in_selection(id)) { + if (!(e && e.istouch || this.in_selection(id))) { var mod_key = rcube_event.get_modifier(e); this.select_row(id, mod_key, false); } -- cgit v1.2.3 From 8f8e263977cc356bf754236ed0182515b26337ca Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 30 Oct 2013 16:06:27 +0100 Subject: CS fixes --- program/js/app.js | 9 ++++++--- program/js/list.js | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 42cbaa6f9..55dea3620 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3032,9 +3032,12 @@ function rcube_webmail() // test if purge command is allowed this.purge_mailbox_test = function() { - return (this.env.exists && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox - || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter)) - || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter)))); + return (this.env.exists && ( + this.env.mailbox == this.env.trash_mailbox + || this.env.mailbox == this.env.junk_mailbox + || this.env.mailbox.indexOf(this.env.trash_mailbox + this.env.delimiter) == 0 + || this.env.mailbox.indexOf(this.env.junk_mailbox + this.env.delimiter) == 0 + )); }; diff --git a/program/js/list.js b/program/js/list.js index a814c325c..46d9d2757 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -1245,14 +1245,15 @@ scrollto: function(id) scroll_to = Number(row.offsetTop); } - if(this.fixed_header) + if (this.fixed_header) head_offset = Number(this.thead.offsetHeight); - + // if row is above the frame (or behind header) if (scroll_to < Number(this.frame.scrollTop) + head_offset) { // scroll window so that row isn't behind header this.frame.scrollTop = scroll_to - head_offset; - } else if (scroll_to + Number(row.offsetHeight) > Number(this.frame.scrollTop) + Number(this.frame.offsetHeight)) + } + else if (scroll_to + Number(row.offsetHeight) > Number(this.frame.scrollTop) + Number(this.frame.offsetHeight)) this.frame.scrollTop = (scroll_to + Number(row.offsetHeight)) - Number(this.frame.offsetHeight); } }, -- cgit v1.2.3