')
.addClass('OxSerif OxLight date')
.html(Ox.formatDate(item.date, '%B %e, %Y', true))
.appendTo($item);
});
function selectItem(id, $element) {
$('.readme .item.selected').removeClass('selected');
if (id) {
$element.addClass('selected');
Ox.get('readme/html/' + id + '.html', function(html) {
$text.html(html);
$text.find('.code').each(function() {
var $this = $(this);
$this.replaceWith(
Ox.SyntaxHighlighter({
source: $this.text()
})
.attr({id: $this.attr('id')})
/*
.css({
border: '1px solid rgb(192, 192, 192)'
})
*/
);
});
});
app.url.push('readme/' + id);
} else {
$text.empty();
app.url.push('readme');
}
}
return $panel;
},
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);
}
});
},
warning: function() {
return $('
')
.addClass('warning')
.html(
'Aw, snap! This website requires an up-to-date, HTML5-compliant web browser. '
+ 'It should work fine in current versions of Chrome, Firefox and Safari, '
+ 'or Internet Explorer with Chrome Frame installed. '
+ 'To proceed at your own risk, click on the logo above.'
);
}
},
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;
});