diff --git a/cloudcmd.js b/cloudcmd.js index 59da7d88..e9eeffd9 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -1,5 +1,5 @@ (function(){ - "use strict"; + 'use strict'; var DIR = __dirname + '/', main = require(DIR + 'lib/server/main'), diff --git a/html/auth.html b/html/auth.html index aa23df2b..b1bc2445 100644 --- a/html/auth.html +++ b/html/auth.html @@ -4,14 +4,13 @@
diff --git a/lib/client/editor/_codemirror.js b/lib/client/editor/_codemirror.js index 1a6409ff..f1c4e4cc 100644 --- a/lib/client/editor/_codemirror.js +++ b/lib/client/editor/_codemirror.js @@ -1,9 +1,9 @@ var CloudCommander, Util, DOM, CodeMirror; /* object contains editors CodeMirror */ - (function(CloudCommander, Util, DOM){ - "use strict"; - var cloudcmd = CloudCommander, - KeyBinding = CloudCommander.KeyBinding, + (function(CloudCmd, Util, DOM){ + 'use strict'; + + var KeyBinding = CloudCommander.KeyBinding, CodeMirrorEditor = {}, FM, CodeMirrorElement, @@ -19,7 +19,7 @@ var CloudCommander, Util, DOM, CodeMirror; load ]; - cloudcmd.Editor = { + CloudCmd.Editor = { get : (function(){ return this.CodeMirror; }) @@ -28,20 +28,20 @@ var CloudCommander, Util, DOM, CodeMirror; /* private functions */ function setCSS(){ - var lPosition = DOM.getPanel().id, - lRet = DOM.cssSet({ - id : 'editor', - inner : '.CodeMirror{' + - 'font-family' + ': \'Droid Sans Mono\';' + - 'font-size' + ': 15px;' + - '}' + - '.CodeMirror-scroll{' + - 'height' + ':' + cloudcmd.HEIGHT + 'px' + - '}' + - '#CodeMirrorEditor{' + - 'float' + ':' + lPosition + - '}' - }); + var lPosition = DOM.getPanel().id, + lRet = DOM.cssSet({ + id : 'editor', + inner : '.CodeMirror{' + + 'font-family' + ': \'Droid Sans Mono\';' + + 'font-size' + ': 15px;' + + '}' + + '.CodeMirror-scroll{' + + 'height' + ':' + CloudCmd.HEIGHT + 'px' + + '}' + + '#CodeMirrorEditor{' + + 'float' + ':' + lPosition + + '}' + }); return lRet; } @@ -87,7 +87,7 @@ var CloudCommander, Util, DOM, CodeMirror; */ function load(pCallBack){ console.time('codemirror load'); - var lDir = cloudcmd.LIBDIRCLIENT + 'editor/codemirror/', + var lDir = CloudCmd.LIBDIRCLIENT + 'editor/codemirror/', lFiles = [ [ @@ -173,7 +173,7 @@ var CloudCommander, Util, DOM, CodeMirror; /** * function bind keys */ - cloudcmd.Editor.init = function(pReadOnly){ + CloudCmd.Editor.init = function(pReadOnly){ ReadOnly = pReadOnly; CodeMirrorEditor.show(); @@ -183,8 +183,8 @@ var CloudCommander, Util, DOM, CodeMirror; /* если клавиши можно обрабатывать */ if( KeyBinding.get() ){ /* if f4 or f3 pressed */ - var lF3 = cloudcmd.KEY.F3, - lF4 = cloudcmd.KEY.F4; + var lF3 = CloudCmd.KEY.F3, + lF4 = CloudCmd.KEY.F4; if(!pEvent.shiftKey) switch(pEvent.keyCode) @@ -206,6 +206,6 @@ var CloudCommander, Util, DOM, CodeMirror; DOM.setButtonKey('f4', CodeMirrorEditor.show); }; - cloudcmd.Editor.CodeMirror = CodeMirrorEditor; + CloudCmd.Editor.CodeMirror = CodeMirrorEditor; })(CloudCommander, Util, DOM); \ No newline at end of file diff --git a/lib/client/menu.js b/lib/client/menu.js index d105449e..789143ae 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -2,11 +2,10 @@ * https://github.com/medialize/jQuery-contextMenu */ var CloudCommander, Util, DOM, $; -(function(CloudCommander, Util, DOM){ - "use strict"; +(function(CloudCmd, Util, DOM){ + 'use strict'; - var cloudcmd = CloudCommander, - KeyBinding = cloudcmd.KeyBinding, + var KeyBinding = CloudCmd.KeyBinding, MenuSeted = false, Menu = {}, Position; @@ -23,7 +22,7 @@ var CloudCommander, Util, DOM, $; */ function showEditor(pReadOnly){ DOM.Images.showLoad(); - var lEditor = cloudcmd[pReadOnly ? 'Viewer' : 'Editor'], + var lEditor = CloudCmd[pReadOnly ? 'Viewer' : 'Editor'], lResult = Util.exec(lEditor, pReadOnly); @@ -52,13 +51,13 @@ var CloudCommander, Util, DOM, $; lObj.callback = function(key, opt){ DOM.getCurrentData(function(pParams){ - var lObject = cloudcmd[pObjectName]; + var lObject = CloudCmd[pObjectName]; if('init' in lObject) lObject.uploadFile(pParams); else Util.exec(lObject, function(){ - cloudcmd[pObjectName].uploadFile(pParams); + CloudCmd[pObjectName].uploadFile(pParams); }); }); @@ -266,7 +265,7 @@ var CloudCommander, Util, DOM, $; ]); var key_event = function(pEvent){ - var lKEY = cloudcmd.KEY, + var lKEY = CloudCmd.KEY, lKeyCode = pEvent.keyCode; /* если клавиши можно обрабатывать */ if( KeyBinding.get() ){ @@ -287,5 +286,5 @@ var CloudCommander, Util, DOM, $; DOM.addKeyListener( key_event ); }; - cloudcmd.Menu = Menu; + CloudCmd.Menu = Menu; })(CloudCommander, Util, DOM); \ No newline at end of file diff --git a/lib/client/socket.js b/lib/client/socket.js index 546157c5..a6760017 100644 --- a/lib/client/socket.js +++ b/lib/client/socket.js @@ -1,22 +1,21 @@ /* module make possible connectoin thrue socket.io on a client */ var CloudCommander, DOM, Util, io; -(function(CloudCommander, DOM, Util){ - "use strict"; +(function(CloudCmd, DOM, Util){ + 'use strict'; - var cloudcmd = CloudCommander, - Messages = [], + var Messages = [], socket, JqueryTerminal; function getJqueryTerminal(){ - return cloudcmd.Terminal.JqueryTerminal; + return CloudCmd.Terminal.JqueryTerminal; } DOM.jsload('/socket.io/lib/socket.io.js', { onload : function(){ socket = io.connect(document.location.hostname); - cloudcmd.Socket = socket; + CloudCmd.Socket = socket; socket.on('connect', function () { JqueryTerminal = getJqueryTerminal(); @@ -98,8 +97,7 @@ var CloudCommander, DOM, Util, io; */ Messages.push(pMsg); lResult = false; - } - + } console.log(pMsg); return lResult; diff --git a/lib/client/storage/_dropbox.js b/lib/client/storage/_dropbox.js index d48f10e7..5bef1cb3 100644 --- a/lib/client/storage/_dropbox.js +++ b/lib/client/storage/_dropbox.js @@ -1,12 +1,10 @@ -var CloudCommander, Util, DOM, CloudFunc, Dropbox, cb, Client; +var CloudCommander, Util, DOM, Dropbox, cb, Client; /* module for work with github */ -(function(){ - "use strict"; +(function(CloudCmd, Util, DOM){ + 'use strict'; - var CloudCmd = CloudCommander, - //Client, - DropBoxStore = {}; + var DropBoxStore = {}; /* temporary callback function for work with github */ cb = function (err, data){ console.log(err || data);}; @@ -19,8 +17,8 @@ var CloudCommander, Util, DOM, CloudFunc, Dropbox, cb, Client; function load(pCallBack){ console.time('dropbox load'); - //var lSrc = '//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.7.1/dropbox.min.js', - var lSrc = CloudCmd.LIBDIRCLIENT + 'storage/dropbox/lib/dropbox.js', + var lSrc = '//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.7.1/dropbox.min.js', + //var lSrc = CloudCmd.LIBDIRCLIENT + 'storage/dropbox/lib/dropbox.js', lLocal = CloudCmd.LIBDIRCLIENT + 'storage/dropbox/lib/dropbox.min.js', lOnload = function(){ console.timeEnd('dropbox load'); @@ -104,4 +102,4 @@ var CloudCommander, Util, DOM, CloudFunc, Dropbox, cb, Client; }; CloudCmd.DropBox = DropBoxStore; -})(); +})(CloudCommander, Util, DOM); diff --git a/lib/client/storage/_gdrive.js b/lib/client/storage/_gdrive.js index c7322dd0..93833177 100644 --- a/lib/client/storage/_gdrive.js +++ b/lib/client/storage/_gdrive.js @@ -1,11 +1,10 @@ var CloudCommander, Util, DOM, gapi; -(function(){ - "use strict"; +(function(CloudCmd, Util, DOM){ + 'use strict'; + + var GDrive = {}; - var cloudcmd = CloudCommander, - GDrive = {}; - /* PRIVATE FUNCTIONS */ @@ -98,5 +97,5 @@ var CloudCommander, Util, DOM, gapi; ]); }; - cloudcmd.GDrive = GDrive; -})(); \ No newline at end of file + CloudCmd.GDrive = GDrive; +})(CloudCommander, Util, DOM); \ No newline at end of file diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 47e7e24a..956c14eb 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -1,11 +1,10 @@ var CloudCommander, Util, DOM, $, Github, cb; /* module for work with github */ -(function(){ +(function(CloudCmd, Util, DOM){ "use strict"; - var cloudcmd = CloudCommander, - Cache = DOM.Cache, + var Cache = DOM.Cache, APIURL, AuthURL, @@ -42,7 +41,7 @@ var CloudCommander, Util, DOM, $, Github, cb; } function setConfig(pCallBack){ - cloudcmd.getConfig(function(pConfig){ + CloudCmd.getConfig(function(pConfig){ GitHub_ID = pConfig.github_key; APIURL = pConfig.api_url; AuthURL = APIURL + '/auth'; @@ -182,5 +181,5 @@ var CloudCommander, Util, DOM, $, Github, cb; }; }; - cloudcmd.GitHub = GitHubStore; -})(); + CloudCmd.GitHub = GitHubStore; +})(CloudCommander, Util, DOM); diff --git a/lib/client/terminal.js b/lib/client/terminal.js index baea0094..d5b99c38 100644 --- a/lib/client/terminal.js +++ b/lib/client/terminal.js @@ -1,18 +1,16 @@ var CloudCommander, Util, DOM, $; /* object contains terminal jqconsole */ -(function(CloudCommander, Util, DOM){ +(function(CloudCmd, Util, DOM){ 'use strict'; - var cloudcmd = CloudCommander, - - KeyBinding = cloudcmd.KeyBinding, + var KeyBinding = CloudCmd.KeyBinding, TerminalId, Term, Hidden = false, JqueryTerminal = {}; - cloudcmd.Terminal = {}; + CloudCmd.Terminal = {}; /* PRIVATE FUNCTIONS */ @@ -35,7 +33,7 @@ var CloudCommander, Util, DOM, $; $(function($, undefined) { Term = JqueryTerminal.Term = $('#terminal').terminal(function(command, term){ term.echo(''); - cloudcmd.Socket.send(command); + CloudCmd.Socket.send(command); }, { greetings : '[[;#729FCF;]Cloud Commander Terminal]', prompt : '[[;#729FCF;]cloudcmd> ]', @@ -100,7 +98,7 @@ var CloudCommander, Util, DOM, $; /** * function bind keys */ - cloudcmd.Terminal.init = function(){ + CloudCmd.Terminal.init = function(){ /* loading js and css*/ Util.loadOnLoad([ JqueryTerminal.show, @@ -111,7 +109,7 @@ var CloudCommander, Util, DOM, $; /* добавляем обработчик клавишь */ var lKeyHandler = function(pEvent){ - var lKEY = cloudcmd.KEY, + var lKEY = CloudCmd.KEY, lKeyCode = pEvent.keyCode, lKeyBinded = KeyBinding.get(); /* если клавиши можно обрабатывать */ @@ -127,6 +125,6 @@ var CloudCommander, Util, DOM, $; DOM.addKeyListener(lKeyHandler); }; - cloudcmd.Terminal.JqueryTerminal = JqueryTerminal; + CloudCmd.Terminal.JqueryTerminal = JqueryTerminal; })(CloudCommander, Util, DOM); diff --git a/lib/client/viewer.js b/lib/client/viewer.js index 6938636b..58345015 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -2,13 +2,12 @@ var CloudCommander, Util, DOM, $; /* object contains viewer FancyBox * https://github.com/fancyapps/fancyBox */ -(function(CloudCommander, Util, DOM){ - "use strict"; +(function(CloudCmd, Util, DOM){ + 'use strict'; - var cloudcmd = CloudCommander, - KeyBinding = CloudCommander.KeyBinding, + var KeyBinding = CloudCmd.KeyBinding, FancyBox = {}, - + Config = { beforeShow : function(){ DOM.Images.hideLoad(); @@ -37,7 +36,7 @@ var CloudCommander, Util, DOM, $; padding : 0 }; - cloudcmd.Viewer = { + CloudCmd.Viewer = { get: (function(){ return this.FancyBox; }) @@ -50,7 +49,7 @@ var CloudCommander, Util, DOM, $; */ FancyBox.load = function(pCallBack){ console.time('fancybox load'); - var lDir = cloudcmd.LIBDIRCLIENT + 'viewer/fancybox/', + var lDir = CloudCmd.LIBDIRCLIENT + 'viewer/fancybox/', lFiles = [ lDir + 'jquery.fancybox.css', lDir + 'jquery.fancybox.js' ]; @@ -91,7 +90,7 @@ var CloudCommander, Util, DOM, $; }); }; - cloudcmd.Viewer.init = function(){ + CloudCmd.Viewer.init = function(){ Util.loadOnLoad([ FancyBox.show, FancyBox.load, @@ -104,7 +103,7 @@ var CloudCommander, Util, DOM, $; }; var lKeyListener = function(pEvent){ - var lF3 = cloudcmd.KEY.F3, + var lF3 = CloudCmd.KEY.F3, lKeyBinded = KeyBinding.get(), lKey = pEvent.keyCode, lShift = pEvent.shiftKey; @@ -121,6 +120,6 @@ var CloudCommander, Util, DOM, $; .setButtonKey('f3', lView); }; - cloudcmd.Viewer.FancyBox = FancyBox; + CloudCmd.Viewer.FancyBox = FancyBox; })(CloudCommander, Util, DOM); \ No newline at end of file