moved appcahe processing to cloudcmd.js

This commit is contained in:
coderaiser 2012-11-01 05:55:01 -04:00
parent 42e91991c8
commit eb720db4cf
2 changed files with 25 additions and 21 deletions

View file

@ -11,7 +11,8 @@ var DIR = process.cwd() + '/',
CloudFunc = srvfunc.require(LIBDIR +'cloudfunc'),
update = srvfunc.require(SRVDIR + 'update'),
Config = readConfig();
srv = Server.CloudServer,
Config = readConfig();
Server.start(Config, indexProcessing);
@ -25,7 +26,7 @@ function indexProcessing(pIndex, pList){
* меняем в index.html обычные css на
* минифицированый
*/
if(Server.CloudServer.Minify._allowed.css){
if(srv.Minify._allowed.css){
var lReplace_s = '<link rel=stylesheet href=';
if(lWin32)
lReplace_s = lReplace_s + '/css/reset.css>';
@ -33,7 +34,7 @@ function indexProcessing(pIndex, pList){
lReplace_s = lReplace_s + '"/css/reset.css">';
pIndex = pIndex.replace(lReplace_s, '');
pIndex = pIndex.replace('/css/style.css', Server.CloudServer.Minify.MinFolder + 'all.min.css');
pIndex = pIndex.replace('/css/style.css', srv.Minify.MinFolder + 'all.min.css');
}
pIndex = pIndex.replace('<div id=fm class=no-js>',
@ -43,7 +44,7 @@ function indexProcessing(pIndex, pList){
pIndex = pIndex.replace('<title>Cloud Commander</title>',
'<title>' + CloudFunc.setTitle() + '</title>');
if(!Server.CloudServer.Config.appcache){
if(!srv.Config.appcache){
if(lWin32)
pIndex = pIndex.replace(' manifest=/cloudcmd.appcache', '');
else
@ -54,6 +55,20 @@ function indexProcessing(pIndex, pList){
}
function appCacheProcessing(){
var lAppCache = srv.AppCache;
/* создаём файл app cache */
if(srv.Config.appcache && lAppCache && srv.Config.server){
var lFiles = [{'//themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff' : './font/DroidSansMono.woff'},
{'//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js' : './lib/client/jquery.js'}];
if(srv.Minify._allowed.css)
lFiles.push('./min/all.min.css');
lAppCache.addFiles(lFiles);
lAppCache.createManifest();
}
}
function readConfig(){