index.js: load user data immediately, set theme correctly

This commit is contained in:
rolux 2012-06-17 16:45:32 +02:00
parent 23ad209561
commit 7c62771252

View file

@ -53,7 +53,8 @@ Ox.load(function() {
user: {
item: {doc: '', examples: '', readme: ''},
page: '',
previousPage: 'about'
previousPage: 'about',
theme: 'classic'
}
},
db: Ox.localStorage('OxJS'),
@ -139,15 +140,15 @@ Ox.load(function() {
},
html: {},
init: function() {
app.user = Ox.extend(app.data.user, app.db());
app.loadScreen(function() {
app.loadData(function() {
Ox.load({UI: {theme: app.theme}}, app.load);
Ox.load('UI', {theme: app.user.theme}, app.load);
});
});
},
load: function(browserSupported) {
var url = app.url.get();
app.user = Ox.extend(app.data.user, app.db())
app.user.page = url.page;
if (url.item && url.page in app.user.item) {
app.user.item[url.page] = url.item;
@ -241,7 +242,7 @@ Ox.load(function() {
});
},
loadScreen: function(callback) {
app.setTheme(app.user.theme || 'classic');
app.setTheme(app.user.theme);
app.$ui.screen = app.ui.screen();
app.$ui.loading = app.ui.loading();
app.$ui.logo = app.ui.logo()
@ -255,9 +256,7 @@ Ox.load(function() {
callback();
}
});
Ox.$(window).on({
resize: app.resize
});
Ox.$(window).on({resize: app.resize});
},
patchButtonGroup: function($buttonGroup) {
$buttonGroup.find('.OxButton').css({