refactored anyLoadOnload

This commit is contained in:
coderaiser 2012-10-20 08:47:56 -04:00
parent 00391f183c
commit 8a255deaac
3 changed files with 81 additions and 60 deletions

View file

@ -60,17 +60,13 @@ var CloudCommander, CloudFunc, CodeMirror;
* function loads CodeMirror js and css files
*/
function load(){
console.time('codemirror load');
var lDir = CodeMirrorEditor.dir;
/* function loads css files of CodeMirror */
var loadAll = function() {
Util.cssLoad([
{ src : lDir + 'codemirror.css'},
{ src : lDir + 'theme/night.css'}
]);
Util.cssSet({id:'editor',
Util.anyLoadOnload(
[{
name: 'style',
id:'editor',
inner : '.CodeMirror{' +
'font-family :\'Droid Sans Mono\';' +
'font-size :15px;' +
@ -79,27 +75,30 @@ var CloudCommander, CloudFunc, CodeMirror;
'}' +
'.CodeMirror-scroll{' +
'height : ' + (cloudcmd.HEIGHT) + 'px' +
'}' //+
'}', //+
/* codemirror v3 */
//'#CodeMirrorEditor{' +
// 'padding :20px 20px 20px 20px;' +
// '}'
});
parent: document.head
},
lDir + 'mode/javascript.js',
lDir + 'codemirror.css',
lDir + 'theme/night.css',
lDir + 'codemirror.js'],
Util.jsload(lDir + 'mode/javascript.js', function(){
CodeMirrorLoaded = true;
CodeMirrorEditor.show();
});
};
/* load CodeMirror main module */
Util.jsload(lDir + 'codemirror.js', loadAll);
}
function(){
console.timeEnd('codemirror load');
CodeMirrorLoaded = true;
CodeMirrorEditor.show();
}
);
}
/**
* function shows CodeMirror editor
*/
CodeMirrorEditor.show = function(pReadOnly){
CodeMirrorEditor.show = function(pReadOnly){
if( Util.isBoolean(pReadOnly) )
ReadOnly = pReadOnly;