')
.addClass('OxSerif page')
.html(html)
.appendTo($element);
});
return $element;
},
panel: function() {
return Ox.TabPanel({
content: function(id) {
return app.ui[id] ? app.ui[id]() : app.ui.page(id);
},
size: 32,
tabs: [
{id: 'about', title: 'About'},
{id: 'readme', title: 'Readme'},
{id: 'examples', title: 'Examples'},
{id: 'doc', title: 'Documentation'},
{id: 'downloads', title: 'Downloads'},
{id: 'dev', title: 'Development'},
{id: 'contact', title: 'Contact'}
]
})
.bindEvent({
change: function(data) {
app.url.push(data.selected);
}
});
},
readme: function() {
return Ox.Element();
},
screen: function() {
return Ox.$('
').addClass('screen animate');
},
switch: function() {
return Ox.ButtonGroup({
buttons: [
{id: 'classic', title: 'Light'},
{id: 'modern', title: 'Dark'}
],
selectable: true,
value: app.user('theme')
})
.addClass('switch animate')
.bindEvent({
change: function(data) {
app.setTheme(data.value);
}
});
}
},
url: {
get: function() {
return window.location.hash.substr(1);
},
push: function(url) {
history.pushState({}, '', '#' + url);
url && app.user({url: url});
return app;
},
set: function() {
window.location.hash = '#' + arguments[0];
return app;
}
},
urlchange: function() {
var url = app.url.get(),
section = url.split('/')[0];
url && app.user({url: url});
Ox.print(
'url', url,
'section', section,
'prev', app.previousURL,
'sect', app.previousURL.split('/')[0],
'user url', app.user('url')
);
if (section != app.previousURL.split('/')[0]) {
app.$ui.panel.select(section);
}
app[!url || !app.previousURL ? 'animate' : 'void'](function() {
app.previousURL = url;
});
},
user: Ox.localStorage('OxJS'),
void: function(callback) {
callback();
}
};
app.init();
window.oxjs = app;
});