summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-11-12 18:50:24 +0000
committeralecpl <alec@alec.pl>2010-11-12 18:50:24 +0000
commitef17c54e739676a73fff69fa85ea39a3a516fcab (patch)
tree9262a0fc17c60cc11308b84477af3c4a8a56247c /program
parent5d238918a7876561d8b1c112aa4267bbed3d8587 (diff)
- Fix IE issue when replacing spaces doesn't work
- Some code improvements
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js19
-rw-r--r--program/js/list.js2
2 files changed, 13 insertions, 8 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 842a3cd22..7c38b142a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3479,7 +3479,7 @@ function rcube_webmail()
min = this.env.autocomplete_min_length;
// trim query string
- q = q.replace(/(^\s+|\s+$)/g, '');
+ q = $.trim(q);
// Don't (re-)search if the last results are still active
if (q == this.ksearch_value)
@@ -4056,7 +4056,8 @@ function rcube_webmail()
this.focus_subscription = function(id)
{
var row, folder,
- reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$');
+ delim = RegExp.escape(this.env.delimiter),
+ reg = RegExp('['+delim+']?[^'+delim+']+$');
if (this.drag_active && this.env.folder && (row = document.getElementById(id)))
if (this.env.subscriptionrows[id] &&
@@ -4069,7 +4070,7 @@ function rcube_webmail()
$(row).addClass('droptarget');
}
}
- else if (this.env.folder.match(new RegExp(RegExp.escape(this.env.delimiter)))) {
+ else if (this.env.folder.match(new RegExp(delim))) {
this.set_env('dstfolder', this.env.delimiter);
$(this.subscription_list.frame).addClass('droptarget');
}
@@ -4102,10 +4103,12 @@ function rcube_webmail()
this.subscription_move_folder = function(list)
{
- var reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$');
+ var delim = RegExp.escape(this.env.delimiter),
+ reg = RegExp('['+delim+']?[^'+delim+']+$');
+
if (this.env.folder && this.env.dstfolder && (this.env.dstfolder != this.env.folder) &&
(this.env.dstfolder != this.env.folder.replace(reg, ''))) {
- var reg = new RegExp('[^'+RegExp.escape(this.env.delimiter)+']*['+RegExp.escape(this.env.delimiter)+']', 'g');
+ var reg = new RegExp('[^'+delim+']*['+delim+']', 'g');
var basename = this.env.folder.replace(reg, '');
var newname = this.env.dstfolder==this.env.delimiter ? basename : this.env.dstfolder+this.env.delimiter+basename;
@@ -4155,12 +4158,14 @@ function rcube_webmail()
}
if (id && this.env.subscriptionrows[id] && (row = document.getElementById(id))) {
- var reg = new RegExp('.*['+RegExp.escape(this.env.delimiter)+']');
+ var delim = RegExp.escape(this.env.delimiter),
+ reg = new RegExp('.*['+delim+']');
+
this.name_input = document.createElement('input');
this.name_input.type = 'text';
this.name_input.value = this.env.subscriptionrows[id][0].replace(reg, '');
- reg = new RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$');
+ reg = new RegExp('['+delim+']?[^'+delim+']+$');
this.name_input.__parent = this.env.subscriptionrows[id][0].replace(reg, '');
this.name_input.onkeydown = function(e){ rcmail.name_input_keydown(e); };
diff --git a/program/js/list.js b/program/js/list.js
index 029f0cd20..aabba0842 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -1151,7 +1151,7 @@ drag_mouse_move: function(e)
subject = $(node).text();
// remove leading spaces
- subject = subject.replace(/^\s+/i, '');
+ subject = $.trim(subject);
// truncate line to 50 characters
subject = (subject.length > 50 ? subject.substring(0, 50) + '...' : subject);