diff options
author | alecpl <alec@alec.pl> | 2010-11-12 18:50:24 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-11-12 18:50:24 +0000 |
commit | ef17c54e739676a73fff69fa85ea39a3a516fcab (patch) | |
tree | 9262a0fc17c60cc11308b84477af3c4a8a56247c /program/js/app.js | |
parent | 5d238918a7876561d8b1c112aa4267bbed3d8587 (diff) |
- Fix IE issue when replacing spaces doesn't work
- Some code improvements
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 19 |
1 files changed, 12 insertions, 7 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); }; |