added ie.js script thet fixes ie

This commit is contained in:
coderaiser 2012-08-20 07:48:16 -04:00
parent 733cb34345
commit 32763eacee
7 changed files with 94 additions and 66 deletions

View file

@ -127,7 +127,7 @@ CloudClient.Cache.clear = (function(){
});
/* Object contain additional system functional */
CloudClient.Util = (function(){
CloudClient.Utils = (function(){
/*
* Function gets id by src
* from http://domain.com/1.js to
@ -328,28 +328,12 @@ CloudClient.Util = (function(){
* все параметры опциональны
*/
this.cssSet = (CloudCommander.OLD_BROWSER)?
/* if browser is old - make in diferen way */
function(pParams_o){
var lElement = '<style ';
if (pParams_o.id) lElement += 'id=' + pParams_o.id + ' ';
if (pParams_o.style) lElement += 'style=' + pParams_o.style + ' ';
if (pParams_o.className) lElement += 'class=' + pParams_o.className;
if (pParams_o.inner)lElement += '>' + pParams_o.inner;
lElement +='</style>';
return window.jQuery(lElement)
.appendTo(pParams_o.parent || document.head);
}
:function(pParams_o){
pParams_o.name = 'style';
pParams_o.parent = pParams_o.parent || document.head;
return this.anyload(pParams_o);
},
this.cssSet = function(pParams_o){
pParams_o.name = 'style';
pParams_o.parent = pParams_o.parent || document.head;
return this.anyload(pParams_o);
},
/* Function loads external css files
* @pParams_o - структура параметров, заполняеться таким
* образом: {src: ' ',func: '', id: '', element: '', inner: ''}
@ -385,21 +369,9 @@ CloudClient.Util = (function(){
* @pClass - className
* @pElement - element
*/
this.getByClass = (CloudCommander.OLD_BROWSER)?
function(pClass, pElement){
var lClass = '.' + pClass;
var lResult;
if(pElement)
lResult = pElement.find(lClass);
else lResult = $.find(lClass);
return lResult;
}
:function(pClass, pElement){
return (pElement || document).getElementsByClassName(pClass);
};
this.getByClass = function(pClass, pElement){
return (pElement || document).getElementsByClassName(pClass);
};
/* private members */
var lLoadingImage;
@ -676,7 +648,7 @@ CloudClient.Util = (function(){
};
});
CloudClient.Util = new CloudClient.Utils();
/* функция обработки нажатий клавишь */
CloudClient.keyBinding=(function(){

View file

@ -41,5 +41,8 @@
<button>F8 - remove</button>
</div>
<script src=client.js></script>
<!--[if lt IE 9]>
<script src=lib/client/ie.js id=ie_js ></script>
<![endif]-->
</body>
</html>

View file

@ -7,7 +7,7 @@ CloudCommander.Editor = {
return this.CodeMirror;
})
};
CloudCommander.Editor.CodeMirror = new CloudCommander.Util();
CloudCommander.Editor.CodeMirror = new CloudCommander.Utils();
/* indicator says CodeMirror still loads */
CloudCommander.Editor.CodeMirror.loading = false;

55
lib/client/ie.js Normal file
View file

@ -0,0 +1,55 @@
/* script, fixes ie */
var CloudCommander;
(function(){
/* setting head ie6 - ie8 */
document.head = document.getElementsByTagName("head")[0];
document.getElementsByClassName = function(pClassName){
return window.jQuery('.'+pClassName)[0];
};
var lUtil = CloudCommander.Util;
lUtil.getByClass = function(pClass, pElement){
var lClass = '.' + pClass;
var lResult;
if(pElement)
lResult = pElement.find(lClass);
else lResult = $.find(lClass);
return lResult;
};
lUtil.cssSet = function(pParams_o){
var lElement = '<style ';
if (pParams_o.id) lElement += 'id=' + pParams_o.id + ' ';
if (pParams_o.style) lElement += 'style=' + pParams_o.style + ' ';
if (pParams_o.className) lElement += 'class=' + pParams_o.className;
if (pParams_o.inner)lElement += '>' + pParams_o.inner;
lElement +='</style>';
return window.jQuery(lElement)
.appendTo(pParams_o.parent || document.head);
};
/*
{name: '', src: ' ',func: '', style: '', id: '', parent: '',
async: false, inner: 'id{color:red, }, class:'', not_append: false}
*/
this.cssSet = function(pParams_o){
var lElement = '<style ';
if (pParams_o.id) lElement += 'id=' + pParams_o.id + ' ';
if (pParams_o.style) lElement += 'style=' + pParams_o.style + ' ';
if (pParams_o.className) lElement += 'class=' + pParams_o.className;
if (pParams_o.inner)lElement += '>' + pParams_o.inner;
lElement +='</style>';
return $(lElement)
.appendTo(pParams_o.parent || document.head);
},
})();

View file

@ -28,7 +28,7 @@ CloudCommander.KEY = {
CloudCommander.keyBinding = (function(){
"use strict";
var Util = new CloudCommander.Util();
var Util = new CloudCommander.Utils();
/* saving state of tabs varibles */
var lTabPanel = {

View file

@ -17,7 +17,13 @@ CloudCommander.Menu.getConfig = (function(){
return{
// define which elements trigger this menu
selector: 'li',
callback: function(key, options) {
var m = "clicked: " + key;
console.log(m, options);
CloudCommander.keyBinded = true;
},
// define the elements of the menu
items: {
view: {name: 'View', callback: function(key, opt){
@ -28,8 +34,6 @@ CloudCommander.Menu.getConfig = (function(){
if(lViewer && lViewer.show)
lViewer.show();
}
CloudCommander.keyBinded = true;
}},
edit: {name: 'Edit', callback: function(key, opt){
@ -43,14 +47,11 @@ CloudCommander.Menu.getConfig = (function(){
lEditor.show();
}
CloudCommander.keyBinded = true;
}},
'delete': {name: 'Delete',
callback: function(key, opt){
console.log('delete menu item choosen');
CloudCommander.keyBinded = true;
}},
download: {name: 'Download',callback: function(key, opt){
@ -84,8 +85,6 @@ CloudCommander.Menu.getConfig = (function(){
responseText: 'Error: You trying to' +
'download same file to often'});
}
CloudCommander.keyBinded = true;
}}
}
};
@ -138,9 +137,8 @@ CloudCommander.Menu.set = (function(){
*/
document.onclick = function(pEvent){
if(pEvent && pEvent.x && pEvent.y){
var lLayer = lThis.getById('context-menu-layer');
if(lLayer){
if(lLayer){
var lLayer = lThis.getById('context-menu-layer');
var lStyle;
if(lLayer)
@ -213,27 +211,27 @@ CloudCommander.Menu.Keys = (function(pPosition){
};
var key_event = (function(pEvent){
/* если клавиши можно обрабатывать */
if(pEvent.keyCode === CloudCommander.KEY.ESC)
CloudCommander.keyBinded = true;
/* if shift + F10 pressed */
if(pEvent.keyCode === CloudCommander.KEY.F10 &&
pEvent.shiftKey){
var lCurrent = this.getCurrentFile();
if(lCurrent)
$(lCurrent).contextMenu();
}
pEvent.preventDefault();
/* если клавиши можно обрабатывать */
if(CloudCommander.keyBinded)
/* if shift + F10 pressed */
if(pEvent.keyCode === CloudCommander.KEY.F10 &&
pEvent.shiftKey){
var lCurrent = this.getCurrentFile();
if(lCurrent)
$(lCurrent).contextMenu();
pEvent.preventDefault();
}
});
/* добавляем обработчик клавишь */
if (document.addEventListener)
document.addEventListener('keydown', key_event.bind(this),false);
else{
else{
var lFunc;
if(typeof document.onkeydown === 'function')
lFunc = document.onkeydown;
else lFunc = null;
document.onkeydown = function(){
if(lFunc)

View file

@ -8,7 +8,7 @@ CloudCommander.Viewer = {
})
};
CloudCommander.Viewer.FancyBox = new CloudCommander.Util();
CloudCommander.Viewer.FancyBox = new CloudCommander.Utils();
CloudCommander.Viewer.dir = './lib/client/viewer/';
CloudCommander.Viewer.FancyBox.dir = CloudCommander.Viewer.dir +