images loaded in Ox.UI now

This commit is contained in:
j 2011-04-23 00:46:07 +02:00
parent 0024af978c
commit 498b17926f

View file

@ -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) { self.change = function(key, value) {
}; };
@ -165,12 +145,7 @@ Ox.App = (function() {
user = result.data.user; user = result.data.user;
// fixme: not generic // fixme: not generic
document.title = config.site.name; document.title = config.site.name;
launchCallback(); $(function() {
});
});
loadImages(launchCallback);
function launchCallback() {
++counter == 2 && $(function() {
var $div = Ox.UI.$body.find('div'); var $div = Ox.UI.$body.find('div');
Ox.UI.$body.find('img').remove(); Ox.UI.$body.find('img').remove();
$div.animate({ $div.animate({
@ -181,7 +156,8 @@ Ox.App = (function() {
// fixme: not generic enough, just pass data // fixme: not generic enough, just pass data
callback({config: config, user: user}); callback({config: config, user: user});
}); });
} });
});
} }
function stop() { function stop() {
that.request.send(self.options.init, getUserData(), function() {}); that.request.send(self.options.init, getUserData(), function() {});