diff --git a/json/config.json b/json/config.json
index 69ce0eb2..428b8a2c 100644
--- a/json/config.json
+++ b/json/config.json
@@ -2,7 +2,7 @@
"api_url" : "/api/v1",
"appcache" : false,
"minification" : {
- "js" : true,
+ "js" : false,
"css" : true,
"html" : true,
"img" : true
diff --git a/lib/client.js b/lib/client.js
index d3cf9f6a..9ab7b0c5 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -452,7 +452,7 @@ CloudCmd._changeLinks = function(pPanelID){
lType = lElement.parentElement.nextSibling;
if(lType && lType.textContent === '
'){
- lLink = lLink.replace(lNoJS_s,'');
+ lLink = Util.removeStr(lLink, lNoJS_s);
lName += '.json';
}
diff --git a/lib/server.js b/lib/server.js
index ec24a739..ef0a742f 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -262,10 +262,12 @@
AppCache.watch(lName);
Util.log(Path.basename(lName));
+ var lMin_o = lConfig.minification,
+ lExt = Util.getExtension(lName),
+ lResult = lExt === '.js' && lMin_o.js ||
+ lExt === '.css' && lMin_o.css ||
+ lExt === '.html' && lMin_o.html;
- var lExt = Util.getExtension(lName),
- lResult = lExt === '.js' || lExt === '.css' || lExt === '.html';
-
if(lResult)
lResult = Minify.optimize(lName, {
request : pReq,
@@ -279,18 +281,14 @@
response: pRes
});
- }else{/* если мы имеем дело с файловой системой*/
- /* если путь не начинаеться с no-js - значит
+ }else{
+ /* если мы имеем дело с файловой системой
+ * если путь не начинаеться с no-js - значит
* js включен
*/
- /* убираем пометку cloud, без которой c9.io
- * не работает поскольку путь из двух слешей
- * (/fs/no-js/) - очень короткий, нужно
- * длиннее
- */
if(lPath.indexOf(lNoJS_s) !== lFS_s.length && lPath !== '/')
- CloudServer.NoJS = false;
+ CloudServer.NoJS = false;
else{
CloudServer.NoJS = true;
lPath = Util.removeStr(lPath, lNoJS_s);
@@ -313,15 +311,8 @@
if(lQuery === 'json')
CloudServer.NoJS = false;
-
- /* если в итоге путь пустой
- * делаем его корневым
- */
- if (lPath === '')
- lPath = '/';
-
- DirPath = lPath;
+ DirPath = lPath || '/';
CloudServer.Responses[DirPath] = pRes;
CloudServer.Statuses[DirPath] = OK;
diff --git a/lib/util.js b/lib/util.js
index 2f4c31b9..efc8582c 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -176,7 +176,31 @@ Util = exports || {};
* @param pSubStr
*/
Util.removeStr = function(pStr, pSubStr){
- return pStr.replace(pSubStr, '');
+ var lRet;
+ if( Util.isString(pStr) ){
+ var n = pSubStr.length;
+
+ if( Util.isArray(pSubStr) )
+ Util.fori(n, function(i){
+ lRet = pStr = pStr.replace(pSubStr[i], '');
+ });
+ else
+ lRet = pStr.replace(pSubStr, '');
+ }
+
+ return lRet;
+ };
+
+ Util.for = function(pI, pN, pFunc){
+ if(Util.isFunction(pFunc))
+ for(var i = pI, n = pN; i < n; i++)
+ pFunc(i);
+ };
+
+ Util.fori = function(pN, pFunc){
+ var lRet = Util.for(0, pN, pFunc);
+
+ return lRet;
};
/**