minor changes

This commit is contained in:
coderaiser 2012-11-08 11:07:33 -05:00
parent b67744e495
commit f464a0af6c
5 changed files with 76 additions and 27 deletions

View file

@ -406,8 +406,9 @@ function initModules(){
}
function baseInit(){
if(applicationCache){
if(applicationCache){
var lFunc = applicationCache.onupdateready;
applicationCache.onupdateready = function(){
console.log('app cacheed');
location.reload();
@ -466,7 +467,6 @@ function baseInit(){
cloudcmd.HEIGHT = lHeight;
DOM.cssSet({id:'cloudcmd',
element:document.head,
inner:
'.panel{' +
'height:' + lHeight +'px;' +

View file

@ -751,6 +751,21 @@ var CloudCommander, $, Util, DOM;
};
/**
* function gets time
*/
DOM.getTime = function(){
var date = new Date(),
hours = date.getHours(),
minutes = date.getMinutes(),
seconds = date.getSeconds();
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
return hours + ":" + minutes + ":" + seconds;
};
DOM.CloudStatus = [];
DOM.addCloudStatus = function(pStatus){

View file

@ -1,4 +1,4 @@
var CloudCommander, _gaq;
var CloudCommander, DOM, _gaq;
(function(){
"use strict";
@ -19,5 +19,5 @@ var CloudCommander, _gaq;
return preventErrorAlert;
};
CloudCommander.Util.jsload('http://google-analytics.com/ga.js');
DOM.jsload('http://google-analytics.com/ga.js');
})();

View file

@ -1,5 +1,5 @@
/* script, fixes ie */
var CloudCommander, $;
var CloudCommander, DOM, $;
(function(){
"use strict";
@ -12,7 +12,7 @@ var CloudCommander, $;
{name: '', src: ' ',func: '', style: '', id: '', parent: '',
async: false, inner: 'id{color:red, }, class:'', not_append: false}
*/
lUtil.cssSet = function(pParams_o){
DOM.cssSet = function(pParams_o){
var lElement = '<style ';
if (pParams_o.id) lElement += 'id=' + pParams_o.id + ' ';
@ -27,15 +27,13 @@ var CloudCommander, $;
};
}
var lUtil = CloudCommander.Util;
/* setting function context (this) */
lUtil.bind = function(pFunction, pContext){
DOM.bind = function(pFunction, pContext){
return $.proxy(pFunction, pContext);
};
if(!document.getElementsByClassName){
lUtil.getByClass = function(pClass, pElement){
DOM.getByClass = function(pClass, pElement){
var lClass = '.' + pClass,
lResult;
@ -48,7 +46,7 @@ var CloudCommander, $;
}
/* function polyfill webkit standart function */
lUtil.scrollIntoViewIfNeeded = function(pElement, centerIfNeeded){
DOM.scrollIntoViewIfNeeded = function(pElement, centerIfNeeded){
/*
https://gist.github.com/2581101
*/
@ -82,35 +80,29 @@ var CloudCommander, $;
alignWithTop = overTop && !overBottom;
if ((overTop || overBottom) && centerIfNeeded) {
if ((overTop || overBottom) && centerIfNeeded)
parent.scrollTop =
pElement.offsetTop -
parent.offsetTop -
parent.clientHeight / 2 -
parentBorderTopWidth +
pElement.clientHeight / 2;
}
if ((overLeft || overRight) && centerIfNeeded) {
if ((overLeft || overRight) && centerIfNeeded)
parent.scrollLeft =
pElement.offsetLeft -
parent.offsetLeft -
parent.clientWidth / 2 -
parentBorderLeftWidth +
pElement.clientWidth / 2;
}
if (( overTop ||
overBottom ||
overLeft ||
overRight) &&
!centerIfNeeded) {
if ( (overTop || overBottom || overLeft || overRight)
&& !centerIfNeeded)
pElement.scrollIntoView(alignWithTop);
}
};
if(!document.body.classList){
lUtil.addClass = function(pElement, pClass){
DOM.addClass = function(pElement, pClass){
var lSpaceChar = '',
lClassName = pElement.className,
lRet_b = true;
@ -123,7 +115,7 @@ var CloudCommander, $;
lRet_b = false;
};
lUtil.removeClass = function(pElement, pClass){
DOM.removeClass = function(pElement, pClass){
var lClassName = pElement.className;
if(lClassName.length > pClass.length)

View file

@ -1,4 +1,7 @@
/* Module contain additional system functional */
/*
* Licensed under MIT License http://www.opensource.org/licenses/mit-license
* Module contain additional system functional
*/
var Util, exports;
(function(){
@ -75,6 +78,7 @@ var Util, exports;
Util.isObject = function(pVarible){
return Util.isType(pVarible, 'object');
};
/**
* functions check is pVarible is string
* @param pVarible
@ -82,6 +86,7 @@ var Util, exports;
Util.isString = function(pVarible){
return Util.isType(pVarible, 'string');
};
/**
* functions check is pVarible is function
* @param pVarible
@ -98,6 +103,28 @@ var Util, exports;
return typeof pVarible === pType;
};
/**
* return save exec function
* @param pCallBack
* @param pArg
*/
Util.retExec = function(pCallBack, pArg){
return function(){
Util.exec(pCallBack, pArg);
};
};
Util.ExecOnExec = function(pCallBacks){
if(Util.isArray(pCallBacks)){
for(var i = 0, n = pCallBacks.length; i < n; i++){
var lFunc = pCallBacks.pop();
Util.execOnExec( Util.retExec(lFunc, pCallBacks) );
}
}
};
/**
* function execute param function in
* try...catch block
@ -107,7 +134,7 @@ var Util, exports;
Util.tryCatch = function(pCallBack){
var lRet;
try{
pCallBack();
lRet = pCallBack();
}
catch(pError){
lRet = pError;
@ -119,12 +146,27 @@ var Util, exports;
/**
* function do save exec
*/
Util.exec = function(pCallBack){
Util.exec = function(pCallBack, pArg){
var lRet = false;
if( Util.isFunction(pCallBack) )
lRet = pCallBack();
lRet = pCallBack(pArg);
return lRet;
};
/**
* function gets time
*/
Util.getTime = function(){
var date = new Date(),
hours = date.getHours(),
minutes = date.getMinutes(),
seconds = date.getSeconds();
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
return hours + ":" + minutes + ":" + seconds;
};
})();