From 32e9428027b487f0f20f6dcf516f1b46db597cb5 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 21 Aug 2012 09:13:38 -0400 Subject: [PATCH] minor changes --- client.js | 14 ++++++++++++- lib/client/menu.js | 49 ++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/client.js b/client.js index c223dc96..28f3b7c0 100644 --- a/client.js +++ b/client.js @@ -128,6 +128,18 @@ CloudClient.Cache.clear = (function(){ /* Object contain additional system functional */ CloudClient.Utils = (function(){ + + /* Should be used Util version + * jquery could be droped out + */ + this.ajax = function(pParams){ + $.ajax(pParams); + }; + + this.bind = function(pFunction, pObject){ + return pFunction.bind(pObject); + }; + /* * Function gets id by src * from http://domain.com/1.js to @@ -1086,7 +1098,7 @@ CloudClient._changeLinks = function(pPanelID){ * @path - каталог для чтения * @pNeedRefresh - необходимость обновить данные о каталоге */ -CloudClient._ajaxLoad=function(path, pNeedRefresh) +CloudClient._ajaxLoad = function(path, pNeedRefresh) { /* Отображаем красивые пути */ /* added supporting of russian language */ diff --git a/lib/client/menu.js b/lib/client/menu.js index 8a700139..8a09269f 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -98,34 +98,31 @@ var CloudCommander, $; * @pParent - this * @pPosition - position of menu */ - CloudCommander.Menu.load = (function(pParent, pPosition){ - return function(){ - var ljsLoad_f = function(){ - var lUISrc = pParent.dir + 'jquery.ui.position.js'; - var lMenuSrc = pParent.dir + 'jquery.contextMenu.js'; - - Util.jsload(lUISrc, function(){ - pParent.jsload(lMenuSrc, pParent.show(pParent, pPosition)); - }); - }; + CloudCommander.Menu.load = (function(pPosition){ + var ljsLoad_f = function(){ + var lUISrc = this.dir + 'jquery.ui.position.js'; + var lMenuSrc = this.dir + 'jquery.contextMenu.js'; - var lSrc = pParent.dir + 'jquery.contextMenu.css'; - - pParent.cssLoad({ - src : lSrc, - func : { - onload: ljsLoad_f - } + var lThis = this; + Util.jsload(lUISrc, function(){ + Util.jsload(lMenuSrc, lThis.show(lThis, pPosition)); }); - }(); + }; + + var lSrc = this.dir + 'jquery.contextMenu.css'; + + Util.cssLoad({ + src : lSrc, + func : { + onload: Util.bind(ljsLoad_f, this) + } + }); }); CloudCommander.Menu.set = (function(){ if(!this.seted){ $.contextMenu(this.getConfig()); - - var lThis = this; - + var lFunc_f = document.onclick; /* * Menu works in some crazy way so need a @@ -163,7 +160,7 @@ var CloudCommander, $; else if(lElement.tagName === 'SPAN') lParent = lElement.parentElement; - lThis.setCurrentFile(lParent); + Util.setCurrentFile(lParent); } /* show invisible menu layer */ @@ -190,11 +187,11 @@ var CloudCommander, $; /* function shows menu for the first time * right away after loading */ - CloudCommander.Menu.show = (function(pParent, pPosition){ + CloudCommander.Menu.show = (function(pThis, pPosition){ return function(){ - pParent.set(); + pThis.set(); - pParent.Images.hideLoad(); + pThis.Images.hideLoad(); if(pPosition && pPosition.x && pPosition.y) $('li').contextMenu(pPosition); @@ -248,6 +245,6 @@ var CloudCommander, $; CloudCommander.Menu.show(); } - CloudCommander.Menu.load(this, pPosition); + CloudCommander.Menu.load(pPosition); }); })(); \ No newline at end of file