changed if( -> if (

This commit is contained in:
coderaiser 2013-05-24 10:21:38 -04:00
parent 6bf2d02e61
commit c7dd643e18
5 changed files with 226 additions and 212 deletions

View file

@ -53,7 +53,7 @@
* меняем в index.html обычные css на
* минифицированый
*/
if(Minify.allowed.css){
if (Minify.allowed.css){
var lPath = '/' + Util.removeStr(Minify.MinFolder, DIR),
lReplace = '<link rel=stylesheet href="/css/reset.css">';
lData = Util.removeStr(lData, lReplace)
@ -65,10 +65,10 @@
fm : lAdditional
});
if(!Config.appcache)
if (!Config.appcache)
lData = Util.removeStr(lData, ' manifest="/cloudcmd.appcache"');
if(!Config.show_keys_panel){
if (!Config.show_keys_panel){
var lKeysPanel = '<div id=keyspanel';
lData = lData.replace(lKeysPanel, lKeysPanel +' class=hidden');
}
@ -90,7 +90,7 @@
lFiles[0][lFONT_REMOTE] = lFONT_LOCAL;
lFiles[1][lJQUERY_REMOTE] = lJQUERY_LOCAL;
if(Config.minification.css)
if (Config.minification.css)
lFiles.push('node_modules/minify/min/all.min.css');
AppCache.addFiles(lFiles);
@ -141,7 +141,7 @@
}
function init(){
if(update)
if (update)
update.get();
/* Determining server.js directory
@ -151,14 +151,14 @@
*/
var lServerDir = path.dirname(process.argv[1]) + '/';
if( DIR !== lServerDir ){
if ( DIR !== lServerDir ){
Util.log('current dir: ' + DIR);
process.chdir(lServerDir);
}
Util.log('server dir: ' + lServerDir);
Util.log('reading configuration file config.json...');
if(Config){
if (Config){
Util.log('config.json readed');
/* if command line parameter testing resolved
@ -178,7 +178,7 @@
writeLogsToFile();
}
if(Config.server)
if (Config.server)
fs.watch(CONFIG_PATH, function(){
/* every catch up - calling twice */
setTimeout(function() {
@ -194,17 +194,17 @@
},
lFiles = [FILE_TMPL, PATH_TMPL];
if(Config.ssl)
if (Config.ssl)
lFiles.push(CA, KEY, CERT);
main.readFiles(lFiles, function(pErrors, pFiles){
if(pErrors)
if (pErrors)
Util.log(pErrors);
else{
FileTemplate = pFiles[FILE_TMPL].toString();
PathTemplate = pFiles[PATH_TMPL].toString();
if(Config.ssl)
if (Config.ssl)
lParams.ssl = {
ca : pFiles[CA],
key : pFiles[KEY],
@ -221,13 +221,13 @@
function readConfig(pCallBack){
fs.readFile(CONFIG_PATH, function(pError, pData){
if(!pError){
if (!pError){
Util.log('config: readed');
var lStr = pData.toString(),
lReadedConf = Util.parseJSON(lStr);
if(!Config.minification)
if (!Config.minification)
main.config = Config = lReadedConf;
Util.tryCatchLog(function(){
@ -250,19 +250,19 @@
function route(pParams){
var lRet = main.checkParams(pParams);
if(lRet){
if (lRet){
var p = pParams;
if( Util.strCmp(p.name, ['/auth', '/auth/github']) ){
if ( Util.strCmp(p.name, ['/auth', '/auth/github']) ){
Util.log('* Routing' +
'-> ' + p.name);
pParams.name = main.HTMLDIR + p.name + '.html';
lRet = main.sendFile( pParams );
}
else if( Util.isContainStrAtBegin(p.name, FS) || Util.strCmp( p.name, '/') ){
else if ( Util.isContainStrAtBegin(p.name, FS) || Util.strCmp( p.name, '/') ){
if( Util.isContainStrAtBegin(p.name, FS + 'no-js/') ){
if ( Util.isContainStrAtBegin(p.name, FS + 'no-js/') ){
var lURL = Util.removeStr(pParams.name, 'no-js/');
return main.redirect(pParams, lURL);
}
@ -279,13 +279,13 @@
function sendCommanderContent(pParams){
var lRet = main.checkParams(pParams);
if(lRet){
if (lRet){
var p = pParams;
p.name = Util.removeStrOneTime(p.name, CloudFunc.FS) || main.SLASH;
fs.stat(p.name, function(pError, pStat){
if(!pError)
if( pStat.isDirectory() )
if (!pError)
if ( pStat.isDirectory() )
processCommanderContent(pParams);
else
main.sendFile(p);
@ -301,12 +301,12 @@
function processCommanderContent(pParams){
var lRet = main.checkParams(pParams);
if(lRet){
if (lRet){
var p = pParams;
main.commander.getDirContent(p.name, function(pError, pJSON){
if(!pError){
if (!pError){
var lQuery = main.getQuery(p.request);
if( Util.isContainStr(lQuery, 'json') ){
if ( Util.isContainStr(lQuery, 'json') ){
p.data = Util.stringifyJSON(pJSON);
p.name +='.json';
main.sendResponse(p);
@ -314,7 +314,7 @@
else{ /* get back html*/
p.name = Minify.allowed.html ? Minify.getName(INDEX) : INDEX;
fs.readFile(p.name, function(pError, pData){
if(!pError){
if (!pError){
var lPanel = CloudFunc.buildFromJSON(pJSON, FileTemplate, PathTemplate),
lList = '<ul id=left class=panel>' + lPanel + '</ul>' +
'<ul id=right class=panel>' + lPanel + '</ul>';