From 6a91448aee5d036b35c621bbdaff250dc84e15f3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 30 Oct 2013 19:51:55 +0100 Subject: Improve performance and code readability by using String's startsWith() method, other code improvements --- program/js/app.js | 24 ++++++++++++------------ program/js/common.js | 8 ++++++++ program/js/editor.js | 2 +- program/js/list.js | 7 ++++--- 4 files changed, 25 insertions(+), 16 deletions(-) (limited to 'program') diff --git a/program/js/app.js b/program/js/app.js index 55dea3620..1f75e219c 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1474,7 +1474,7 @@ function rcube_webmail() // select the folder if one of its childs is currently selected // don't select if it's virtual (#1488346) - if (this.env.mailbox && this.env.mailbox.indexOf(name + this.env.delimiter) == 0 && !node.virtual) + if (this.env.mailbox && this.env.mailbox.startsWith(name + this.env.delimiter) && !node.virtual) this.command('list', name); } else { @@ -1655,8 +1655,8 @@ function rcube_webmail() this.env.coltypes = []; for (i=0; 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(this.id_regexp) && this.rows[RegExp.$1] != null) return RegExp.$1; } -- cgit v1.2.3