[Svn] r4221 - trunk/roundcubemail/program/js

trac at roundcube.net trac at roundcube.net
Fri Nov 12 19:50:24 CET 2010


Author: alec
Date: 2010-11-12 12:50:24 -0600 (Fri, 12 Nov 2010)
New Revision: 4221

Modified:
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/js/list.js
Log:
- Fix IE issue when replacing spaces doesn't work
- Some code improvements


Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2010-11-12 14:43:33 UTC (rev 4220)
+++ trunk/roundcubemail/program/js/app.js	2010-11-12 18:50:24 UTC (rev 4221)
@@ -3479,7 +3479,7 @@
       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 @@
   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 @@
           $(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 @@
 
   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 @@
     }
 
     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); };
 

Modified: trunk/roundcubemail/program/js/list.js
===================================================================
--- trunk/roundcubemail/program/js/list.js	2010-11-12 14:43:33 UTC (rev 4220)
+++ trunk/roundcubemail/program/js/list.js	2010-11-12 18:50:24 UTC (rev 4221)
@@ -1151,7 +1151,7 @@
 
               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);
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list