From 8e08a28213a4949600c12455f28d0bfbfbb7af6d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Sep 2012 14:48:44 -0400 Subject: [PATCH] fixed bug with keyboard not responding when click on file --- ChangeLog | 1 + client.js | 2 +- server.js | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3273e4ca..9c62d908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,7 @@ running in offline mode (if connection suddenly lost, all visited directories would be cached). +* fixed bug with keyboard not responding when click on file. 2012.08.24, Version 0.1.6 diff --git a/client.js b/client.js index 43062504..eaf08acb 100644 --- a/client.js +++ b/client.js @@ -969,7 +969,7 @@ CloudClient._setCurrent=(function(){ */ if(Util.getCurrentFile() === lParent) CloudClient._editFileName(lParent); - },400); + },1000); } else{ /* устанавливаем курсор на файл, diff --git a/server.js b/server.js index d76cbbc9..01b2f1fb 100644 --- a/server.js +++ b/server.js @@ -222,6 +222,8 @@ CloudServer.start = function () { */ CloudServer.generateHeaders = function(pName, pGzip){ var lType=''; + var lCacheControl = 0; + var lContentEncoding = ''; /* высылаем заголовок в зависимости от типа файла */ /* если расширение у файла css - * загружаем стили @@ -241,8 +243,10 @@ CloudServer.generateHeaders = function(pName, pGzip){ lType = 'text/html'; else if(CloudFunc.checkExtension(pName,'woff')) lType = 'font/woff'; - else if(CloudFunc.checkExtension(pName,'appcache')) + else if(CloudFunc.checkExtension(pName,'appcache')){ lType = 'text/cache-manifest'; + lCacheControl = 1; + } else if(CloudFunc.checkExtension(pName,'mp3')) lType = 'audio/mpeg'; @@ -258,13 +262,19 @@ CloudServer.generateHeaders = function(pName, pGzip){ console.log(pName + lQuery); } - + + if(!lCacheControl) + lCacheControl = 31337 * 21; + + if(lType.indexOf('img') < 0) + lContentEncoding = '; charset=UTF-8'; + return { /* if type of file any, but img - * then we shoud specify charset */ - 'Content-Type': lType + (lType.indexOf('img') < 0 ? '; charset=UTF-8' : ''), - 'cache-control': 'max-age='+(31337*21), + 'Content-Type': lType + lContentEncoding, + 'cache-control': 'max-age=' + lCacheControl, 'last-modified': new Date().toString(), 'content-encoding': pGzip?'gzip':'', /* https://developers.google.com/speed/docs/best-practices