use init request instead of site config
This commit is contained in:
parent
a24af97c0a
commit
252c9a3303
1 changed files with 33 additions and 36 deletions
|
@ -222,42 +222,39 @@ requires
|
|||
});
|
||||
userAgents.indexOf(userAgent) > -1 ? start() : stop();
|
||||
function start() {
|
||||
$.getJSON(self.options.config, function(data) {
|
||||
var config = data;
|
||||
//Ox.print('config', config);
|
||||
document.title = config.site.name;
|
||||
loadImages(function() {
|
||||
that.api.api(function(result) {
|
||||
$.each(result.data.actions, function(key, value) {
|
||||
that.api[key] = function(data, callback) {
|
||||
if (arguments.length == 1 && Ox.isFunction(data)) {
|
||||
callback = data;
|
||||
data = {};
|
||||
}
|
||||
return Ox.Request.send($.extend({
|
||||
url: self.options.apiURL,
|
||||
data: {
|
||||
action: key,
|
||||
data: JSON.stringify(data)
|
||||
},
|
||||
callback: callback
|
||||
}, !value.cache ? {age: 0}: {}));
|
||||
};
|
||||
});
|
||||
that.api[self.options.init](getUserData(), function(data) {
|
||||
var user = data.data.user;
|
||||
$(function() {
|
||||
var $div = $body.find('div');
|
||||
$body.find('img').remove();
|
||||
$div.animate({
|
||||
opacity: 0
|
||||
}, 1000, function() {
|
||||
$div.remove();
|
||||
});
|
||||
callback({
|
||||
config: config,
|
||||
user: user
|
||||
});
|
||||
loadImages(function() {
|
||||
that.api.api(function(result) {
|
||||
$.each(result.data.actions, function(key, value) {
|
||||
that.api[key] = function(data, callback) {
|
||||
if (arguments.length == 1 && Ox.isFunction(data)) {
|
||||
callback = data;
|
||||
data = {};
|
||||
}
|
||||
return Ox.Request.send($.extend({
|
||||
url: self.options.apiURL,
|
||||
data: {
|
||||
action: key,
|
||||
data: JSON.stringify(data)
|
||||
},
|
||||
callback: callback
|
||||
}, !value.cache ? {age: 0}: {}));
|
||||
};
|
||||
});
|
||||
that.api[self.options.init](getUserData(), function(data) {
|
||||
var user = data.data.user,
|
||||
config = data.data.config;
|
||||
document.title = config.site.name;
|
||||
$(function() {
|
||||
var $div = $body.find('div');
|
||||
$body.find('img').remove();
|
||||
$div.animate({
|
||||
opacity: 0
|
||||
}, 1000, function() {
|
||||
$div.remove();
|
||||
});
|
||||
callback({
|
||||
config: config,
|
||||
user: user
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue