diff --git a/client.js b/client.js
index dab3e667..b4f602b8 100644
--- a/client.js
+++ b/client.js
@@ -930,7 +930,7 @@ CloudClient.init = (function()
if(lTitle.length>0)lTitle[0].textContent='Cloud Commander';
/* загружаем jquery: */
- Util.jsload('//code.jquery.com/jquery-1.8.0.min.js',{
+ Util.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js',{
onload: function(){
$ = window.jQuery;
},
diff --git a/lib/client/editor.js b/lib/client/editor.js
index f73762b6..6c6438df 100644
--- a/lib/client/editor.js
+++ b/lib/client/editor.js
@@ -2,46 +2,48 @@ var CloudCommander, CloudFunc, CodeMirror;
/* object contains editors CodeMirror
* and later will be Ace
*/
-CloudCommander.Editor = {
- get : (function(){
- return this.CodeMirror;
- })
-};
-CloudCommander.Editor.CodeMirror = new CloudCommander.Utils();
-
-/* indicator says CodeMirror still loads */
-CloudCommander.Editor.CodeMirror.loading = false;
-
-/* function loads CodeMirror js and css files */
-CloudCommander.Editor.CodeMirror.load = (function(pThis){
- /* function shows editor */
- var createEditorDiv = function(){
- if (!pThis.getById('CloudEditor')) {
- var lFM = pThis.getById('fm');
- if(lFM)
- pThis.anyload({
- name : 'div',
- id : 'CloudEditor',
- parent : lFM
- });
- else
- console.log('Error. Something went wrong FM not found');
-
- pThis.show(pThis);
- }
+ (function(){
+ var Util = CloudCommander.Util;
+
+ CloudCommander.Editor = {
+ get : (function(){
+ return this.CodeMirror;
+ })
};
- /* function loads css files
- * of CodeMirror
- */
- var loadAll = function(pParent) {
- return function(){
- pParent.cssLoad([
+ CloudCommander.Editor.CodeMirror = new CloudCommander.Utils();
+
+ /* indicator says CodeMirror still loads */
+ CloudCommander.Editor.CodeMirror.loading = false;
+
+ /* function loads CodeMirror js and css files */
+ CloudCommander.Editor.CodeMirror.load = (function(pThis){
+ /* function shows editor */
+ var createEditorDiv = function(){
+ if (!Util.getById('CloudEditor')) {
+ var lFM = Util.getById('fm');
+ if(lFM)
+ Util.anyload({
+ name : 'div',
+ id : 'CloudEditor',
+ parent : lFM
+ });
+ else
+ console.log('Error. Something went wrong FM not found');
+
+ pThis.show(pThis);
+ }
+ };
+ /* function loads css files
+ * of CodeMirror
+ */
+ var loadAll = function() {
+ Util.cssLoad([
{ src : 'lib/client/editor/codemirror/pack/codemirror.pack.css'},
{ src : 'lib/client/editor/codemirror/pack/night.pack.css'}
]);
- pParent.cssSet({id:'editor',
+ Util.cssSet({id:'editor',
inner : '.CodeMirror{' +
'font-family :\'Droid Sans Mono\';' +
'font-size :15px;' +
@@ -52,173 +54,172 @@ CloudCommander.Editor.CodeMirror.load = (function(pThis){
'}'
});
- pParent.jsload('lib/client/editor/' +
+ Util.jsload('lib/client/editor/' +
'codemirror/pack/javascript.pack.js',
createEditorDiv);
- };
};
/* load CodeMirror main module */
- pThis.jsload('lib/client/editor/' +
- 'codemirror/pack/codemirror.pack.js',
- loadAll(this));
-});
-
- /* function shows CodeMirror editor */
-CloudCommander.Editor.CodeMirror.show = (function(pIsReadOnly){
- /* if CloudEditor is not loaded - loading him */
- if(!this.getById('CloudEditor'))
- return this.load(this);
-
- /* if CodeMirror function show already
- * called do not call it again
- * if f4 key pressed couple times
- */
- if(this.loading)
- return;
-
- /* when folder view
- * is no need to edit
- * data
- */
- var lReadOnly = pIsReadOnly || false;
-
- var lThis = this;
-
- var initCodeMirror_f = function(pValue){
- CodeMirror(lCloudEditor,{
- mode : 'javascript',
- value : pValue,
- theme : 'night',
- lineNumbers : true,
- //переносим длинные строки
- lineWrapping: false,
- autofocus : true,
- extraKeys: {
- //Сохранение
- "Esc": lThis.hide(lThis)
- },
- readOnly : lReadOnly
- });
- };
-
- var lCloudEditor = this.getById('CloudEditor');
-
- var lCurrent = this.getCurrentFile();
- var lA;
-
- /* getting link */
- lA = this.getByTag('a', lCurrent);
-
- lA = lA[0].href;
-
- /* убираем адрес хоста*/
- lA = '/' + lA.replace(document.location.href,'');
-
- /* checking is this link is to directory */
- var lSize = this.getByClass('size', lCurrent);
- if(lSize){
- lSize = lSize[0].textContent;
-
- /* if directory - load json
- * not html data
- */
- if (lSize === '
'){
- if (lA.indexOf(CloudFunc.NOJS) ===
- CloudFunc.FS.length) {
- lA = lA.replace(CloudFunc.NOJS, '');
- lReadOnly = true;
- }
- }
- }
-
- this.loading = true;
- setTimeout(function(){
- lThis.loading = false;},
- 400);
-
- /* reading data from current file */
- $.ajax({
- url:lA,
- error: (function(jqXHR, textStatus, errorThrown){
- lThis.loading = false;
-
- return lThis.Images.showError(jqXHR);
- }),
-
- success:function(data, textStatus, jqXHR){
- /* if we got json - show it */
- if(typeof data === 'object')
- data = JSON.stringify(data, null, 4);
-
- initCodeMirror_f(data);
-
- /* removing keyBinding if set */
- CloudCommander.keyBinded = false;
-
- lThis.hidePanel();
- lThis.Images.hideLoad();
-
- lThis.loading = false;
- }
+ Util.jsload('lib/client/editor/' +
+ 'codemirror/pack/codemirror.pack.js', loadAll);
});
-});
-
-/* function hides CodeMirror editor */
-CloudCommander.Editor.CodeMirror.hide = (function(pParent) {
- return function(){
- CloudCommander.keyBinded = true;
- pParent.showPanel();
- var lCloudEditor = pParent.getById('CloudEditor');
- var lCodeMirror = pParent.getByClass('CodeMirror');
+ /* function shows CodeMirror editor */
+ CloudCommander.Editor.CodeMirror.show = (function(pIsReadOnly){
+ /* if CloudEditor is not loaded - loading him */
+ if(!Util.getById('CloudEditor'))
+ return this.load(this);
- if(lCodeMirror.length)
- lCloudEditor
- .removeChild(lCodeMirror[0]);
- };
-});
-
-CloudCommander.Editor.Keys = (function(pIsReadOnly){
- "use strict";
-
- var lThis = this.CodeMirror;
- /* loading js and css of CodeMirror */
- this.CodeMirror.show(lThis, pIsReadOnly);
+ /* if CodeMirror function show already
+ * called do not call it again
+ * if f4 key pressed couple times
+ */
+ if(this.loading)
+ return;
+
+ /* when folder view
+ * is no need to edit
+ * data
+ */
+ var lReadOnly = pIsReadOnly || false;
+
+ var lThis = this;
+
+ var initCodeMirror_f = function(pValue){
+ CodeMirror(lCloudEditor,{
+ mode : 'javascript',
+ value : pValue,
+ theme : 'night',
+ lineNumbers : true,
+ //переносим длинные строки
+ lineWrapping: false,
+ autofocus : true,
+ extraKeys: {
+ //Сохранение
+ "Esc": lThis.hide(lThis)
+ },
+ readOnly : lReadOnly
+ });
+ };
+
+ var lCloudEditor = Util.getById('CloudEditor');
+
+ var lCurrent = Util.getCurrentFile();
+ var lA;
- var key_event = function(pEvent){
-
- /* если клавиши можно обрабатывать */
- if(CloudCommander.keyBinded){
- /* if f4 or f3 pressed */
- var lF3 = CloudCommander.KEY.F3;
- var lF4 = CloudCommander.KEY.F4;
- var lShow = lThis.show.bind(lThis);
+ /* getting link */
+ lA = Util.getByTag('a', lCurrent);
+
+ lA = lA[0].href;
+
+ /* убираем адрес хоста*/
+ lA = '/' + lA.replace(document.location.href,'');
+
+ /* checking is this link is to directory */
+ var lSize = Util.getByClass('size', lCurrent);
+ if(lSize){
+ lSize = lSize[0].textContent;
- if(!pEvent.shiftKey){
- if(pEvent.keyCode === lF4)
- lShow();
- else if(pEvent.keyCode === lF3){
- lShow(true);
+ /* if directory - load json
+ * not html data
+ */
+ if (lSize === ''){
+ if (lA.indexOf(CloudFunc.NOJS) ===
+ CloudFunc.FS.length) {
+ lA = lA.replace(CloudFunc.NOJS, '');
+ lReadOnly = true;
}
}
}
- };
-
- /* добавляем обработчик клавишь */
- if (document.addEventListener)
- document.addEventListener('keydown', key_event,false);
-
- else{
- var lFunc;
- if(typeof document.onkeydown === 'function')
- lFunc = document.onkeydown;
-
- document.onkeydown = function(){
- if(lFunc)
- lFunc();
- key_event();
+ this.loading = true;
+ setTimeout(function(){
+ lThis.loading = false;},
+ 400);
+
+ /* reading data from current file */
+ $.ajax({
+ url:lA,
+ error: (function(jqXHR, textStatus, errorThrown){
+ lThis.loading = false;
+
+ return lThis.Images.showError(jqXHR);
+ }),
+
+ success:function(data, textStatus, jqXHR){
+ /* if we got json - show it */
+ if(typeof data === 'object')
+ data = JSON.stringify(data, null, 4);
+
+ initCodeMirror_f(data);
+
+ /* removing keyBinding if set */
+ CloudCommander.keyBinded = false;
+
+ Util.hidePanel();
+ Util.Images.hideLoad();
+
+ lThis.loading = false;
+ }
+ });
+ });
+
+ /* function hides CodeMirror editor */
+ CloudCommander.Editor.CodeMirror.hide = (function() {
+ return function(){
+ CloudCommander.keyBinded = true;
+ Util.showPanel();
+
+ var lCloudEditor = Util.getById('CloudEditor');
+ var lCodeMirror = Util.getByClass('CodeMirror');
+
+ if(lCodeMirror.length)
+ lCloudEditor
+ .removeChild(lCodeMirror[0]);
};
- }
-});
\ No newline at end of file
+ });
+
+ CloudCommander.Editor.Keys = (function(pIsReadOnly){
+ "use strict";
+
+ var lThis = this.CodeMirror;
+ /* loading js and css of CodeMirror */
+ this.CodeMirror.show(pIsReadOnly);
+
+ var key_event = function(pEvent){
+
+ /* если клавиши можно обрабатывать */
+ if(CloudCommander.keyBinded){
+ /* if f4 or f3 pressed */
+ var lF3 = CloudCommander.KEY.F3;
+ var lF4 = CloudCommander.KEY.F4;
+ var lShow = lThis.show.bind(lThis);
+
+ if(!pEvent.shiftKey){
+ if(pEvent.keyCode === lF4)
+ lShow();
+ else if(pEvent.keyCode === lF3){
+ lShow(true);
+ }
+ }
+ }
+ };
+
+ /* добавляем обработчик клавишь */
+ if (document.addEventListener)
+ document.addEventListener('keydown', key_event,false);
+
+ else{
+ var lFunc;
+ if(typeof document.onkeydown === 'function')
+ lFunc = document.onkeydown;
+
+ document.onkeydown = function(){
+ if(lFunc)
+ lFunc();
+
+ key_event();
+ };
+ }
+ });
+})();
\ No newline at end of file
diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js
index be94c37b..81a6001f 100644
--- a/lib/client/keyBinding.js
+++ b/lib/client/keyBinding.js
@@ -40,7 +40,8 @@ CloudCommander.keyBinding = (function(){
var lKEY = CloudCommander.KEY;
var key_event = function(event){
- var lCurrentFile,
+ /* получаем выдленный файл*/
+ var lCurrentFile = Util.getCurrentFile(),
lName, i;
/* если клавиши можно обрабатывать*/
if(CloudCommander.keyBinded && event){
@@ -53,9 +54,7 @@ CloudCommander.keyBinding = (function(){
if(event.keyCode === lKEY.TAB){
console.log('Tab pressed');
- try{
- lCurrentFile = Util.getCurrentFile();
-
+ try{
/* changing parent panel of curent-file */
var lPanel = Util.getPanel();
var lId = lPanel.id;
@@ -122,10 +121,7 @@ CloudCommander.keyBinding = (function(){
}
/* навигация по таблице файлов*/
/* если нажали клавишу вверх*/
- else if(event.keyCode === lKEY.UP){
- /* получаем выдленный файл*/
- lCurrentFile = Util.getCurrentFile();
-
+ else if(event.keyCode === lKEY.UP){
/* если ненайдены выделенные файлы - выходим*/
if(!lCurrentFile) return;
@@ -148,10 +144,7 @@ CloudCommander.keyBinding = (function(){
}
/* если нажали клавишу в низ*/
- else if(event.keyCode === lKEY.DOWN){
- /* получаем выдленный файл*/
- lCurrentFile = Util.getCurrentFile();
-
+ else if(event.keyCode === lKEY.DOWN){
/* если ненайдены выделенные файлы - выходим*/
if(!lCurrentFile)return;
@@ -172,7 +165,6 @@ CloudCommander.keyBinding = (function(){
* элементу
*/
else if(event.keyCode === lKEY.HOME){
- lCurrentFile = Util.getCurrentFile();
/* получаем первый элемент
* пропускаем путь и заголовки столбиков
* выделяем верхий файл
@@ -190,7 +182,6 @@ CloudCommander.keyBinding = (function(){
* выделяем последний элемент
*/
else if( event.keyCode === lKEY.END){
- lCurrentFile = Util.getCurrentFile();
/* выделяем самый нижний файл */
Util.setCurrentFile(lCurrentFile
.parentElement.lastElementChild);
@@ -207,7 +198,6 @@ CloudCommander.keyBinding = (function(){
else if(event.keyCode === lKEY.PAGE_DOWN){
Util.getPanel().scrollByPages(1);
- lCurrentFile = Util.getCurrentFile();
for(i=0; i<30; i++){
if(!lCurrentFile.nextSibling) break;
@@ -224,7 +214,6 @@ CloudCommander.keyBinding = (function(){
else if(event.keyCode === lKEY.PAGE_UP){
Util.getPanel().scrollByPages(-1);
- lCurrentFile = Util.getCurrentFile();
for(i=0; i<30; i++){
if(!lCurrentFile.previousSibling) break;
else try{
@@ -246,7 +235,6 @@ CloudCommander.keyBinding = (function(){
/* если нажали Enter - открываем папку*/
else if(event.keyCode === lKEY.ENTER){
- lCurrentFile = Util.getCurrentFile();
/* если ненайдены выделенные файлы - выходим*/
if(!lCurrentFile)return;
@@ -291,10 +279,7 @@ CloudCommander.keyBinding = (function(){
* содержимого каталога
*/
var lRefreshIcon = Util.getRefreshButton();
- if(lRefreshIcon){
- /* находим файл который сейчас выделен */
- lCurrentFile = Util.getCurrentFile();
-
+ if(lRefreshIcon){
/* получаем название файла*/
var lSelectedName = Util
.getByTag('a', lCurrentFile)[0].textContent;
diff --git a/lib/client/menu.js b/lib/client/menu.js
index 8a09269f..be253990 100644
--- a/lib/client/menu.js
+++ b/lib/client/menu.js
@@ -5,8 +5,9 @@ var CloudCommander, $;
/* object contains jQuery-contextMenu
* https://github.com/medialize/jQuery-contextMenu
*/
- CloudCommander.Menu = new CloudCommander.Utils();
- var Util = CloudCommander.Util;
+ CloudCommander.Menu = {};
+
+ var Util = CloudCommander.Util;
CloudCommander.Menu.dir = './lib/client/menu/';
@@ -138,8 +139,8 @@ var CloudCommander, $;
*/
document.onclick = function(pEvent){
if(pEvent && pEvent.x && pEvent.y){
- if(lLayer){
- var lLayer = Util.getById('context-menu-layer');
+ var lLayer = Util.getById('context-menu-layer');
+ if(lLayer){
var lStyle;
if(lLayer)
@@ -191,7 +192,7 @@ var CloudCommander, $;
return function(){
pThis.set();
- pThis.Images.hideLoad();
+ Util.Images.hideLoad();
if(pPosition && pPosition.x && pPosition.y)
$('li').contextMenu(pPosition);