summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js84
-rw-r--r--program/js/common.js28
-rw-r--r--program/js/list.js21
3 files changed, 72 insertions, 61 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 7f1e7241b..205bb2d6d 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -53,7 +53,6 @@ function rcube_webmail()
this.env.bin_path = './bin/';
this.env.blankpage = 'program/blank.gif';
-
// set environment variable(s)
this.set_env = function(p, value)
{
@@ -1159,19 +1158,21 @@ function rcube_webmail()
this.doc_mouse_up = function(e)
{
var model, li;
-
+
if (this.message_list) {
- this.message_list.blur();
+ if (!rcube_mouse_is_over(e, this.message_list.list))
+ this.message_list.blur();
model = this.env.mailboxes;
}
else if (this.contact_list) {
- this.contact_list.blur();
+ if (!rcube_mouse_is_over(e, this.contact_list.list))
+ this.contact_list.blur();
model = this.env.address_sources;
}
else if (this.ksearch_value) {
this.ksearch_blur();
}
-
+
// handle mouse release when dragging
if (this.drag_active && model && this.env.last_folder_target) {
this.set_classname(this.get_folder_li(this.env.last_folder_target), 'droptarget', false);
@@ -1182,6 +1183,9 @@ function rcube_webmail()
this.drag_start = function(list)
{
+ this.initialBodyScrollTop = bw.ie ? 0 : window.pageYOffset;
+ this.initialMailBoxScrollTop = document.getElementById("mailboxlist-container").scrollTop;
+
var model = this.task == 'mail' ? this.env.mailboxes : this.env.address_sources;
this.drag_active = true;
@@ -1213,10 +1217,17 @@ function rcube_webmail()
{
if (this.gui_objects.folderlist && this.env.folder_coords)
{
+ // offsets to compensate for scrolling while dragging a message
+ var boffset = bw.ie ? -document.documentElement.scrollTop : this.initialBodyScrollTop;
+ var moffset = this.initialMailBoxScrollTop-document.getElementById('mailboxlist-container').scrollTop;
+ var toffset = -moffset-boffset;
+
var li, pos, mouse;
mouse = rcube_event.get_mouse_pos(e);
pos = this.env.folderlist_coords;
+ mouse.y += toffset;
+
// if mouse pointer is outside of folderlist
if (mouse.x < pos.x1 || mouse.x >= pos.x2
|| mouse.y < pos.y1 || mouse.y >= pos.y2)
@@ -1290,10 +1301,13 @@ function rcube_webmail()
this.click_on_list = function(e)
{
+ if (this.gui_objects.qsearchbox)
+ this.gui_objects.qsearchbox.blur();
+
if (this.message_list)
this.message_list.focus();
else if (this.contact_list)
- this.contact_list.focus();
+ this.contact_list.focus();
var mbox_li;
if (mbox_li = this.get_folder_li())
@@ -1405,6 +1419,7 @@ function rcube_webmail()
{
this.set_busy(true, 'loading');
target.location.href = this.env.comm_path+url;
+
// mark as read and change mbox unread counter
if (action == 'preview' && this.message_list && this.message_list.rows[id] && this.message_list.rows[id].unread)
{
@@ -1428,10 +1443,10 @@ function rcube_webmail()
if (window.frames[this.env.contentframe].location.href.indexOf(this.env.blankpage)<0)
window.frames[this.env.contentframe].location.href = this.env.blankpage;
}
- else if (!bw.safari)
+ else if (!bw.safari && !bw.konq)
frm.style.display = show ? 'block' : 'none';
}
-
+
if (!show && this.busy)
this.set_busy(false);
};
@@ -2210,6 +2225,13 @@ function rcube_webmail()
{
newsig = this.env.signatures[id]['text'];
htmlsig = this.env.signatures[id]['is_html'];
+
+ if (newsig) {
+ if (htmlsig && this.env.signatures[id]['plain_text'].indexOf('-- ')!=0)
+ newsig = '<p>-- </p>' + newsig;
+ else if (!htmlsig && newsig.indexOf('-- ')!=0)
+ newsig = '-- \n' + newsig;
+ }
}
if (htmlsig)
@@ -2441,7 +2463,11 @@ function rcube_webmail()
case 27: // escape
this.ksearch_hide();
break;
-
+
+ case 37: // left
+ case 39: // right
+ if (mod != SHIFT_KEY)
+ return;
}
// start timer
@@ -2508,7 +2534,7 @@ function rcube_webmail()
// Don't (re-)search if string is empty or if the last results are still active
if (!q.length || q == this.ksearch_value)
- return;
+ return;
this.ksearch_value = q;
@@ -2524,22 +2550,13 @@ function rcube_webmail()
this.hide_message();
this.env.contacts = results ? results : [];
-
- var result_ids = new Array();
- var c=0;
- for (var i=0; i < this.env.contacts.length; i++) {
- result_ids[c++] = i;
- if (c == 15) // limit search results
- break;
- }
-
- this.ksearch_display_results(this.env.contacts, result_ids, c);
+ this.ksearch_display_results(this.env.contacts);
};
- this.ksearch_display_results = function (a_results, a_result_ids, c)
+ this.ksearch_display_results = function (a_results)
{
// display search results
- if (c && a_results.length && this.ksearch_input) {
+ if (a_results.length && this.ksearch_input) {
var p, ul, li;
// create results pane if not present
@@ -2561,27 +2578,14 @@ function rcube_webmail()
li.innerHTML = a_results[i].replace(new RegExp('('+this.ksearch_value+')', 'ig'), '##$1%%').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/##([^%]+)%%/g, '<b>$1</b>');
li.onmouseover = function(){ ref.ksearch_select(this); };
li.onmouseup = function(){ ref.ksearch_click(this) };
- li._rcm_id = a_result_ids[i];
+ li._rcm_id = i;
ul.appendChild(li);
}
- // check if last selected item is still in result list
- if (this.ksearch_selected !== null) {
- p = find_in_array(this.ksearch_selected, a_result_ids);
- if (p >= 0 && ul.childNodes) {
- ul.childNodes[p].setAttribute('id', 'rcmksearchSelected');
- this.set_classname(ul.childNodes[p], 'selected', true);
- }
- else
- this.ksearch_selected = null;
- }
-
- // if no item selected, select the first one
- if (this.ksearch_selected === null) {
- ul.firstChild.setAttribute('id', 'rcmksearchSelected');
- this.set_classname(ul.firstChild, 'selected', true);
- this.ksearch_selected = a_result_ids[0];
- }
+ // select the first
+ ul.firstChild.setAttribute('id', 'rcmksearchSelected');
+ this.set_classname(ul.firstChild, 'selected', true);
+ this.ksearch_selected = 0;
// move the results pane right under the input box and make it visible
var pos = rcube_get_object_pos(this.ksearch_input);
diff --git a/program/js/common.js b/program/js/common.js
index 5923989ec..c8670a277 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -602,41 +602,47 @@ function getCookie(name)
roundcube_browser.prototype.get_cookie = getCookie;
-
// tiny replacement for Firebox functionality
function rcube_console()
{
this.log = function(msg)
{
- box = rcube_find_object('console');
+ var box = rcube_find_object('console');
- if (box)
+ if (box) {
if (msg.charAt(msg.length-1)=='\n')
- box.value += msg+'--------------------------------------\n';
+ msg += '--------------------------------------\n';
else
- box.value += msg+'\n--------------------------------------\n';
+ msg += '\n--------------------------------------\n';
+
+ // Konqueror doesn't allows to just change value of hidden element
+ if (bw.konq) {
+ box.innerText += msg;
+ box.value = box.innerText;
+ } else
+ box.value += msg;
+ }
};
this.reset = function()
{
- box = rcube_find_object('console');
+ var box = rcube_find_object('console');
if (box)
- box.value = '';
+ box.innerText = box.value = '';
};
}
var bw = new roundcube_browser();
-
if (!window.console)
- console = new rcube_console();
+ var console = new rcube_console();
// Add escape() method to RegExp object
// http://dev.rubyonrails.org/changeset/7271
RegExp.escape = function(str)
- {
+{
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
- }
+}
// Make getElementById() case-sensitive on IE
diff --git a/program/js/list.js b/program/js/list.js
index 8d8f9e965..522af59ab 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -104,7 +104,7 @@ init: function()
init_row: function(row)
{
// make references in internal array and set event handlers
- if (row && String(row.id).match(/rcmrow([a-z0-9\-_=]+)/i))
+ if (row && String(row.id).match(/rcmrow([a-z0-9\-_=\+\/]+)/i))
{
var p = this;
var uid = RegExp.$1;
@@ -220,7 +220,7 @@ drag_row: function(e, id)
// don't do anything (another action processed before)
var evtarget = rcube_event.get_target(e);
if (this.dont_select || (evtarget && (evtarget.tagName == 'INPUT' || evtarget.tagName == 'IMG')))
- return false;
+ return true;
// accept right-clicks
if (rcube_event.get_button(e) == 2)
@@ -285,10 +285,10 @@ click_row: function(e, id)
var now = new Date().getTime();
var mod_key = rcube_event.get_modifier(e);
var evtarget = rcube_event.get_target(e);
-
+
if ((evtarget && (evtarget.tagName == 'INPUT' || evtarget.tagName == 'IMG')))
- return false;
-
+ return true;
+
// don't do anything (another action processed before)
if (this.dont_select)
{
@@ -355,7 +355,7 @@ get_last_row: function()
var rows = this.list.tBodies[0].rows;
for(var i=rows.length-1; i>=0; i--)
- if(rows[i].id && String(rows[i].id).match(/rcmrow([a-z0-9\-_=]+)/i) && this.rows[RegExp.$1] != null)
+ if(rows[i].id && String(rows[i].id).match(/rcmrow([a-z0-9\-_=\+\/]+)/i) && this.rows[RegExp.$1] != null)
return RegExp.$1;
}
@@ -755,7 +755,10 @@ drag_mouse_move: function(e)
(this.subject_col < 0 || (this.subject_col >= 0 && this.subject_col == c)))
{
subject = node.nodeType==3 ? node.data : node.innerHTML;
- names += (subject.length > 50 ? subject.substring(0, 50)+'...' : subject) + '<br />';
+ // remove leading spaces
+ subject = subject.replace(/^\s+/i, '');
+ // truncate line to 50 characters
+ names += (subject.length > 50 ? subject.substring(0, 50)+'...' : subject) + '<br />';
break;
}
c++;
@@ -774,7 +777,7 @@ drag_mouse_move: function(e)
if (this.drag_active && this.draglayer)
{
var pos = rcube_event.get_mouse_pos(e);
- this.draglayer.move(pos.x+20, pos.y-5);
+ this.draglayer.move(pos.x+20, bw.ie ? pos.y-5+document.documentElement.scrollTop : pos.y-5);
this.trigger_event('dragmove', e);
}
@@ -824,8 +827,6 @@ drag_mouse_up: function(e)
}
}
- this.focus();
-
return rcube_event.cancel(e);
},