mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(view) load: load.parallel -> loadRemote
This commit is contained in:
parent
1ad18cb926
commit
90ebc3e653
1 changed files with 14 additions and 37 deletions
|
|
@ -55,6 +55,10 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
Util.exec.series([
|
||||
DOM.loadJquery,
|
||||
load,
|
||||
function(callback) {
|
||||
Loading = false;
|
||||
Util.exec(callback);
|
||||
},
|
||||
func
|
||||
]);
|
||||
|
||||
|
|
@ -86,11 +90,12 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
if (options)
|
||||
Object.keys(options).forEach(function(name) {
|
||||
var func,
|
||||
isConfig = !!config[name],
|
||||
execParallel = Util.exec.parallel,
|
||||
item = options[name],
|
||||
isFunc = Util.isFunction(item);
|
||||
|
||||
if (isFunc) {
|
||||
if (isFunc && isConfig) {
|
||||
func = config[name];
|
||||
config[name] = Util.exec.with(execParallel, [item, func]);
|
||||
} else {
|
||||
|
|
@ -236,43 +241,15 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
function load(callback) {
|
||||
Util.time(Name + ' load');
|
||||
|
||||
CloudCmd.getConfig(function(config) {
|
||||
var minify = config.minify,
|
||||
dir = CloudCmd.LIBDIRCLIENT + 'view/fancyBox/source/',
|
||||
jsFile = dir + 'jquery.fancybox.js',
|
||||
files = [
|
||||
dir + 'jquery.fancybox.css',
|
||||
'/css/view.css'
|
||||
],
|
||||
func = function() {
|
||||
Util.timeEnd(Name + ' load');
|
||||
Loading = false;
|
||||
Util.exec(callback);
|
||||
};
|
||||
DOM.loadRemote('fancybox', function() {
|
||||
DOM.load.css('/css/view.css', callback);
|
||||
|
||||
if (!minify)
|
||||
files.push(jsFile);
|
||||
else
|
||||
files = [
|
||||
jsFile,
|
||||
CloudFunc.getJoinURL(files)
|
||||
];
|
||||
|
||||
/*
|
||||
* first thing first,
|
||||
* if js would be loaded before css
|
||||
* everything be wrong: view window don't shows up
|
||||
*
|
||||
* if join css that do not minified
|
||||
* all images would not be loaded
|
||||
*/
|
||||
DOM.load.parallel(files, func)
|
||||
.style({
|
||||
id:'view-css',
|
||||
inner : '#fancybox-loading {' +
|
||||
'display: none' +
|
||||
'}'
|
||||
});
|
||||
DOM.load.style({
|
||||
id:'view-css',
|
||||
inner : '#fancybox-loading {' +
|
||||
'display: none' +
|
||||
'}'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue