use init request instead of site config

This commit is contained in:
j 2011-01-23 00:59:30 +05:30
parent a24af97c0a
commit 252c9a3303

View file

@ -222,42 +222,39 @@ requires
}); });
userAgents.indexOf(userAgent) > -1 ? start() : stop(); userAgents.indexOf(userAgent) > -1 ? start() : stop();
function start() { function start() {
$.getJSON(self.options.config, function(data) { loadImages(function() {
var config = data; that.api.api(function(result) {
//Ox.print('config', config); $.each(result.data.actions, function(key, value) {
document.title = config.site.name; that.api[key] = function(data, callback) {
loadImages(function() { if (arguments.length == 1 && Ox.isFunction(data)) {
that.api.api(function(result) { callback = data;
$.each(result.data.actions, function(key, value) { data = {};
that.api[key] = function(data, callback) { }
if (arguments.length == 1 && Ox.isFunction(data)) { return Ox.Request.send($.extend({
callback = data; url: self.options.apiURL,
data = {}; data: {
} action: key,
return Ox.Request.send($.extend({ data: JSON.stringify(data)
url: self.options.apiURL, },
data: { callback: callback
action: key, }, !value.cache ? {age: 0}: {}));
data: JSON.stringify(data) };
}, });
callback: callback that.api[self.options.init](getUserData(), function(data) {
}, !value.cache ? {age: 0}: {})); var user = data.data.user,
}; config = data.data.config;
}); document.title = config.site.name;
that.api[self.options.init](getUserData(), function(data) { $(function() {
var user = data.data.user; var $div = $body.find('div');
$(function() { $body.find('img').remove();
var $div = $body.find('div'); $div.animate({
$body.find('img').remove(); opacity: 0
$div.animate({ }, 1000, function() {
opacity: 0 $div.remove();
}, 1000, function() { });
$div.remove(); callback({
}); config: config,
callback({ user: user
config: config,
user: user
});
}); });
}); });
}); });