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