From fa80e54503d6fc6f1e85c6eff791cab9be438c72 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 8 Feb 2013 05:49:45 -0500 Subject: [PATCH] added appcache and woff properties --- json/ext.json | 4 +++- lib/client/dom.js | 20 +++++++++++++------- lib/util.js | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/json/ext.json b/json/ext.json index 86c87580..b22e0d20 100644 --- a/json/ext.json +++ b/json/ext.json @@ -4,6 +4,7 @@ ".ai": "application/postscript", ".aif": "audio/x-aiff", ".aiff": "audio/x-aiff", + ".appcache": "text/cache-manifest", ".asc": "application/pgp-signature", ".asf": "video/x-ms-asf", ".asm": "text/x-asm", @@ -68,7 +69,7 @@ ".json": "application/json", ".log": "text/plain", ".m3u": "audio/x-mpegurl", - ".m4v": "video/mp4", + ".m4v": "video/mp4", ".man": "text/troff", ".mathml": "application/mathml+xml", ".mbox": "application/mbox", @@ -152,6 +153,7 @@ ".wma": "audio/x-ms-wma", ".wmv": "video/x-ms-wmv", ".wmx": "video/x-ms-wmx", + ".woff": "font/woff", ".wrl": "model/vrml", ".wsdl": "application/wsdl+xml", ".xbm": "image/x-xbitmap", diff --git a/lib/client/dom.js b/lib/client/dom.js index 466e2286..6a720a60 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -387,15 +387,21 @@ var CloudCommander, Util, * Example: http://domain.com/1.js -> 1_js */ DOM.getIdBySrc = function(pSrc){ - var lID = pSrc.replace(pSrc.substr(pSrc, - pSrc.lastIndexOf('/')+1), - ''); + var lRet = Util.isString(pSrc); - /* убираем точки */ - while(lID.indexOf('.') > 0) - lID = lID.replace('.','_'); + if(lRet){ + var lNum = pSrc.lastIndexOf('/') + 1, + lSub = pSrc.substr(pSrc, lNum), + lID = Util.removeStr(pSrc, lSub ); + + /* убираем точки */ + while(lID.indexOf('.') > 0) + lID = lID.replace('.', '_'); + + lRet = lID; + } - return lID; + return lRet; }, /** diff --git a/lib/util.js b/lib/util.js index aa72b706..2f261ea3 100644 --- a/lib/util.js +++ b/lib/util.js @@ -310,7 +310,7 @@ Util = exports || {}; */ Util.removeStr = function(pStr, pSubStr){ var lRet; - if( Util.isString(pStr) ){ + if( Util.isString(pStr) && Util.isString(pSubStr) ){ var n = pSubStr.length; if( Util.isArray(pSubStr) )