oxjs/demos/doc2/js/doc.js
2011-05-16 10:24:46 +02:00

37 lines
1.3 KiB
JavaScript

Ox.load('UI', {
debug: true,
theme: 'classic'
}, function() {
Ox.Theme('classic');
$.getJSON(Ox.UI.PATH + 'json/Ox.UI.json', function(files) {
doc = Ox.DocPanel({
files: Ox.merge([
'Ox.js',
'Ox.Geo/Ox.Geo.js',
], files.filter(function(file) {
return Ox.endsWith(file, '.js');
})),
getModule: function(item) {
var file = item.file.replace(Ox.PATH, '');
return file == 'Ox.js' ? 'Ox' : file.split('/')[0];
},
getSection: function(item) {
var file = item.file.replace(Ox.PATH, '');
return item.section || file.split('/')[2];
},
path: Ox.PATH
}).bindEvent({
load: function() {
doc.selectItem(document.location.hash.substring(1));
},
select: function(data) {
if(data.ids)
document.location.hash = data.ids[0];
}
});
doc.appendTo(Ox.UI.$body);
window.onhashchange = function() {
doc.selectItem(document.location.hash.substring(1))
};
});
});