images loaded in Ox.UI now
This commit is contained in:
parent
0024af978c
commit
498b17926f
1 changed files with 11 additions and 35 deletions
|
@ -86,26 +86,6 @@ Ox.App = (function() {
|
|||
};
|
||||
}
|
||||
|
||||
function loadImages(callback) {
|
||||
window.OxImageCache = [];
|
||||
$.getJSON(Ox.UI.PATH + 'json/ox.ui.images.json', function(data) {
|
||||
// fixme: find a better way to not wait for flags
|
||||
data = data.filter(function(image) {
|
||||
return !Ox.startsWith(image, 'svg/ox.map/')
|
||||
});
|
||||
var counter = 0,
|
||||
length = data.length;
|
||||
data.forEach(function(src, i) {
|
||||
var image = new Image();
|
||||
image.src = Ox.UI.PATH + src;
|
||||
image.onload = function() {
|
||||
(++counter == length) && callback();
|
||||
}
|
||||
window.OxImageCache.push(image); // fixme: global var???
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
self.change = function(key, value) {
|
||||
|
||||
};
|
||||
|
@ -165,23 +145,19 @@ Ox.App = (function() {
|
|||
user = result.data.user;
|
||||
// fixme: not generic
|
||||
document.title = config.site.name;
|
||||
launchCallback();
|
||||
$(function() {
|
||||
var $div = Ox.UI.$body.find('div');
|
||||
Ox.UI.$body.find('img').remove();
|
||||
$div.animate({
|
||||
opacity: 0
|
||||
}, 1000, function() {
|
||||
$div.remove();
|
||||
});
|
||||
// fixme: not generic enough, just pass data
|
||||
callback({config: config, user: user});
|
||||
});
|
||||
});
|
||||
});
|
||||
loadImages(launchCallback);
|
||||
function launchCallback() {
|
||||
++counter == 2 && $(function() {
|
||||
var $div = Ox.UI.$body.find('div');
|
||||
Ox.UI.$body.find('img').remove();
|
||||
$div.animate({
|
||||
opacity: 0
|
||||
}, 1000, function() {
|
||||
$div.remove();
|
||||
});
|
||||
// fixme: not generic enough, just pass data
|
||||
callback({config: config, user: user});
|
||||
});
|
||||
}
|
||||
}
|
||||
function stop() {
|
||||
that.request.send(self.options.init, getUserData(), function() {});
|
||||
|
|
Loading…
Reference in a new issue