diff --git a/lib/client/listeners.js b/lib/client/listeners.js index 75c38560..85cdfab4 100644 --- a/lib/client/listeners.js +++ b/lib/client/listeners.js @@ -93,7 +93,7 @@ var Util, DOM, CloudFunc, CloudCmd; * browser do not replace % -> %25% * do it for him */ - link = Util.replaceStr(link, '%%', '%25%'); + link = link.replace('%%', '%25%'); link = decodeURI(link); link = link.replace(CloudFunc.FS, '') || '/'; diff --git a/lib/client/rest.js b/lib/client/rest.js index f9a5034d..dd2cc795 100644 --- a/lib/client/rest.js +++ b/lib/client/rest.js @@ -180,7 +180,7 @@ var Util, DOM, CloudFunc, CloudCmd; * if we send ajax request - * no need in hash so we escape # */ - p.url = Util.replaceStr(p.url, '#', '%23'); + p.url = p.url.replace('#', '%23'); DOM.load.ajax({ method : p.method, diff --git a/lib/util.js b/lib/util.js index 57b35f4d..951c0d97 100644 --- a/lib/util.js +++ b/lib/util.js @@ -220,28 +220,6 @@ }; } - /** - * function replase pFrom to pTo in pStr - * @param str - * @param from - * @param to - * @param notEscape - */ - this.replaceStr = function(str, from, to, notEscape) { - var regExp, - isStr = Util.type.string(str); - - if (isStr && from) { - if (!notEscape) - from = Util.escapeRegExp(from); - - regExp = new RegExp(from, 'g'); - str = str.replace(regExp, to); - } - - return str; - }; - this.escapeRegExp = function(str) { var isStr = Util.type.string(str); @@ -260,10 +238,11 @@ if (!wildcard) wildcard = '*'; - wildcard = '^' + wildcard; /* search from start of line */ - wildcard = Util.replaceStr(wildcard, '.', '\\.'); - wildcard = Util.replaceStr(wildcard, '*', '.*'); - wildcard = Util.replaceStr(wildcard, '?', '.?\\'); + wildcard = '^' + wildcard /* search from start of line */ + .replace('.', '\\.') + .replace('*', '.*') + .replace('?', '.?\\'); + wildcard += '$'; /* search to end of line */ regExp = new RegExp(wildcard);