diff --git a/lib/client/edit.js b/lib/client/edit.js index 51e197ea..7f1b05a6 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -12,7 +12,6 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M Info = DOM.CurrentInfo, Files = DOM.Files, Storage = DOM.Storage, - type = Util.type, exec = Util.exec, join = CloudCmd.join, @@ -91,7 +90,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M if (name === Info.path) loadDiff(function(error) { if (error) - Util.log(error); + console.error(error); else DOM.Storage.get(name + '-hash', function(error, hashLocal) { var cursor, value; @@ -272,7 +271,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M function setUseOfWorker(mode) { var isMatch, - isStr = type.string(mode), + isStr = typeof mode === 'string', regStr = 'coffee|css|html|javascript|json|lua|php|xquery', regExp = new RegExp(regStr); @@ -362,7 +361,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M length = Value.length, isLessMaxLength = length < MAX_SIZE, isLessLength = isLessMaxLength && patchLength < length, - isStr = type.string(patch), + isStr = typeof patch === 'string', isPatch = patch && isStr && isLessLength; Value = value; @@ -377,7 +376,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M }, function(func) { zip(value, function(error, data) { if (error) - Util.log(error); + console.error(error); query = '?unzip'; func(null, data); @@ -482,7 +481,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M var shaObj, hash, error, value = Ace.getValue(); - error = Util.exec.try(function() { + error = exec.try(function() { shaObj = new window.jsSHA(value, 'TEXT'); hash = shaObj.getHash('SHA-1', 'HEX'); }); @@ -506,7 +505,10 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M DOM.load.ajax({ url : JSHINT_PATH, success : function(data) { - JSHintConfig = Util.json.parse(data); + exec.try(function() { + JSHintConfig = JSON.parse(data); + }); + func(); } }); @@ -609,7 +611,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M sha(function(error, hash) { if (error) - Util.log(error); + console.error(error); DOM.saveDataToStorage(path, Value, hash); });