diff --git a/cloudcmd.js b/cloudcmd.js index 6d94b3fc..0c599210 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -52,7 +52,7 @@ panel = options.panel; if (!Config.appCache) - data = Util.removeStr(data, [ + data = Util.rmStr(data, [ /* min */ ' manifest=/cloudcmd.appcache', /* normal */ @@ -229,7 +229,7 @@ p.name = main.HTMLDIR + name + '.html'; main.sendFile(p); } else if (isFS) { - name = Util.removeStrOneTime(name, CloudFunc.FS) || main.SLASH; + name = Util.rmStrOnce(name, CloudFunc.FS) || main.SLASH; getContent(name, function(error, data, isFile) { var json, diff --git a/lib/client.js b/lib/client.js index 8f47a580..86e4a891 100644 --- a/lib/client.js +++ b/lib/client.js @@ -43,7 +43,7 @@ var Util, DOM, CloudFunc; if (paramLink) link = paramLink; else - link = Util.removeStr(href, CloudCmd.HOST); + link = Util.rmStr(href, CloudCmd.HOST); link += '?json'; @@ -80,7 +80,7 @@ var Util, DOM, CloudFunc; function currentToParent(dirName) { var rootDir; /* убираем слэш с имени каталога */ - dirName = Util.removeStr(dirName, '/'); + dirName = Util.rmStr(dirName, '/'); rootDir = DOM.getCurrentFileByName(dirName); if (rootDir) @@ -106,12 +106,12 @@ var Util, DOM, CloudFunc; if (path && !name) { name = Util.getStrBigFirst(path); - name = Util.removeStr(name, '.js'); + name = Util.rmStr(name, '.js'); slash = name.indexOf('/'); if (slash > 0) { afterSlash = name.substr(slash); - name = Util.removeStr(name, afterSlash); + name = Util.rmStr(name, afterSlash); } } @@ -361,8 +361,8 @@ var Util, DOM, CloudFunc; var SLASH = '/', dirPath = DOM.getCurrentDirPath(), fsPath = decodeURI(path), - noJSONPath = Util.removeStr(fsPath, '?json' ), - cleanPath = Util.removeStrOneTime(noJSONPath, CloudFunc.FS) || SLASH, + noJSONPath = Util.rmStr(fsPath, '?json' ), + cleanPath = Util.rmStrOnce(noJSONPath, CloudFunc.FS) || SLASH, setTitle = function() { var title; diff --git a/lib/client/dom.js b/lib/client/dom.js index 36ced8d9..3d6cf02e 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -785,7 +785,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; lHref = CloudFunc.rmLastSlash(lHref); lSubstr = lHref.substr(lHref , lHref.lastIndexOf('/')); - ret = Util.removeStrOneTime(lHref, lSubstr + '/') || '/'; + ret = Util.rmStrOnce(lHref, lSubstr + '/') || '/'; return ret; }; @@ -814,7 +814,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; ret = '/'; if (path !== '/') - ret = Util.removeStr(path, dirName); + ret = Util.rmStr(path, dirName); return ret; }; @@ -877,7 +877,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; size = size.textContent; /* если это папка - возвращаем слово dir вместо размера*/ - ret = Util.removeStrOneTime(size, ['<', '>']); + ret = Util.rmStrOnce(size, ['<', '>']); return ret; }; @@ -1331,7 +1331,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; lPath = decodeURI(lPath); /* убираем адрес хоста*/ - lPath = Util.removeStrOneTime( lPath, [CloudCmd.HOST, CloudFunc.FS] ); + lPath = Util.rmStrOnce(lPath, [CloudCmd.HOST, CloudFunc.FS]); return lPath; }; diff --git a/lib/client/listeners.js b/lib/client/listeners.js index 883ac322..1dea61b5 100644 --- a/lib/client/listeners.js +++ b/lib/client/listeners.js @@ -96,7 +96,7 @@ var Util, DOM, CloudCmd; n = pathLinks.length; for (i = 0; i < n; i++) { ai = pathLinks[i]; - link = Util.removeStr(ai.href, url), + link = Util.rmStr(ai.href, url), loadDir = CloudCmd.loadDir(link, false, panel), Events.addClick(loadDir, ai); OnPathLinks.push(loadDir); @@ -123,7 +123,7 @@ var Util, DOM, CloudCmd; n = pathLinks.length; for (i = 0; i < n; i++) { ai = pathLinks[i]; - link = Util.removeStr(ai.href, url), + link = Util.rmStr(ai.href, url), loadDir = OnPathLinks.shift(); Events.rmClick(loadDir, ai); diff --git a/lib/client/loader.js b/lib/client/loader.js index b20beea6..3745de45 100644 --- a/lib/client/loader.js +++ b/lib/client/loader.js @@ -26,7 +26,7 @@ var Util, DOM; if (isStr) { num = src.lastIndexOf('/') + 1, sub = src.substr(src, num), - id = Util.removeStrOneTime(src, sub); + id = Util.rmStrOnce(src, sub); /* убираем точки */ while (id.indexOf('.') > 0) diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 499bfea3..32f088b6 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -72,7 +72,7 @@ var CloudCmd, Util, DOM, CloudFunc, Github, cb; DOM.ajax({ type : 'put', url : config && config.apiURL + '/auth', - data : Util.removeStr(code, '?code='), + data : Util.rmStr(code, '?code='), success : function(data) { if (data && data.token) { token = data.token; diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index 881d5b3d..deddb9a7 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -110,7 +110,7 @@ var Util; */ this.rmNewLine = function(text) { var strs = ['\n', '\r'], - str = Util.removeStr(text, strs); + str = Util.rmStr(text, strs); return str; }; @@ -128,7 +128,7 @@ var Util; }; this.getJoinArray = function(url) { - var str = Util.removeStrOneTime(url, JOIN), + var str = Util.rmStrOnce(url, JOIN), names = str.split(':'); return names; @@ -168,7 +168,7 @@ var Util; isContain = Util.isContainStrAtBegin(str, '/'); if (isContain) - ret = Util.removeStrOneTime(str, '/'); + ret = Util.rmStrOnce(str, '/'); return ret; }; @@ -343,7 +343,7 @@ var Util; var lUrl = folders[i], lSlashIndex = lUrl.lastIndexOf('/') + 1; - lShortName = Util.removeStr(lUrl, lUrl.substr(lUrl, lSlashIndex)); + lShortName = Util.rmStr(lUrl, lUrl.substr(lUrl, lSlashIndex)); if (i !== 1) lHtmlPath += lHref + FS + lUrl + diff --git a/lib/server/console.js b/lib/server/console.js index 1a83d37e..ac79d698 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -244,14 +244,14 @@ function onCloudCmd(pCommand, callback) { var lRet; - pCommand = Util.removeStr(pCommand, CLOUDCMD); + pCommand = Util.rmStr(pCommand, CLOUDCMD); if (!equalPart(pCommand, ' ')) { lRet = true; Util.exec(callback, HELP); } else { - pCommand = Util.removeStr(pCommand, ' '); + pCommand = Util.rmStr(pCommand, ' '); if (equalPart(pCommand, 'update') && update) { lRet = true; @@ -272,7 +272,7 @@ function onCD(pCommand, currDir, callback) { var dir, getDir = WIN32 ? 'chdir' : 'pwd', - paramDir = Util.removeStr(pCommand, 'cd '); + paramDir = Util.rmStr(pCommand, 'cd '); if (equalPart(paramDir, ['/', '~'])) dir = paramDir; diff --git a/lib/server/rest.js b/lib/server/rest.js index 55ce81e3..7f8502c1 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -80,7 +80,7 @@ ret = Util.isContainStr(name, apiURL); if (ret) { - name = Util.removeStrOneTime(name, apiURL) || '/'; + name = Util.rmStrOnce(name, apiURL) || '/'; sendData({ request : request, response : response, @@ -134,7 +134,7 @@ }); else { if (p.name[0] === '/') - p.command = Util.removeStrOneTime(p.name, '/'); + p.command = Util.rmStrOnce(p.name, '/'); switch(p.request.method) { case 'GET': @@ -164,7 +164,7 @@ if (ret) { p = params; query = main.getQuery(p.request); - p.name = Util.removeStrOneTime(p.name, CloudFunc.FS) || '/'; + p.name = Util.rmStrOnce(p.name, CloudFunc.FS) || '/'; switch (p.request.method) { case 'GET': @@ -363,7 +363,7 @@ else pipe.create({ from : files.from, - to : files.to || Util.removeStrOneTime(files.from, ['.zip', '.gzip']), + to : files.to || Util.rmStrOnce(files.from, ['.zip', '.gzip']), gunzip : true, callback : function(error) { var name = path.basename(files.from); diff --git a/lib/server/rest/markdown.js b/lib/server/rest/markdown.js index 26f20c23..0d2624af 100644 --- a/lib/server/rest/markdown.js +++ b/lib/server/rest/markdown.js @@ -16,7 +16,7 @@ switch(method) { case 'GET': - name = Util.removeStrOneTime(name, '/markdown'); + name = Util.rmStrOnce(name, '/markdown'); query = main.getQuery(request); if (query === 'relative') diff --git a/lib/server/users.js b/lib/server/users.js index 9c43e4c6..c24123d4 100644 --- a/lib/server/users.js +++ b/lib/server/users.js @@ -63,11 +63,11 @@ line = passwd.substr(passwd, passwd.indexOf('\n') + 1); if (line) { - passwd = Util.removeStr(passwd, line); + passwd = Util.rmStr(passwd, line); /* получаем первое слово строки */ name = line.substr(line, line.indexOf(':')); - line = Util.removeStr(line, name + ':x:'); + line = Util.rmStr(line, name + ':x:'); /* получаем uid */ uid = line.substr(line, line.indexOf(':')); diff --git a/lib/server/win.js b/lib/server/win.js index 5e802849..a108b105 100644 --- a/lib/server/win.js +++ b/lib/server/win.js @@ -45,7 +45,7 @@ exec('chcp ' + Charset.WIN32); if(!error) { - volumes = Util.removeStr(stdout, removeStr) + volumes = Util.rmStr(stdout, removeStr) .split(' '); volumes.pop(); diff --git a/lib/util.js b/lib/util.js index 8bd7c99c..b316479c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -462,7 +462,7 @@ * @param str * @param substr */ - this.removeStr = function(str, substr) { + this.rmStr = function(str, substr) { var n, isArray, isString = Util.isString(str); @@ -481,12 +481,12 @@ return str; }; - /** + /** * function remove substring from string one time - * @param pStr - * @param pSubStr + * @param str + * @param substr */ - this.removeStrOneTime = function(str, substr) { + this.rmStrOnce = function(str, substr) { var n, isArray, isString = Util.isString(str); @@ -534,7 +534,7 @@ this.convertName = function(name) { var conv = name && name.toLowerCase(); - conv = Util.removeStr(conv, ['(', ')']); + conv = Util.rmStr(conv, ['(', ')']); conv = Util.replaceStr(conv, ' ', '-'); return conv;