index.js: cleanup

This commit is contained in:
rolux 2012-06-18 19:12:01 +02:00
parent b754d6d5bd
commit 0f9bf79ddf

View file

@ -203,9 +203,7 @@ Ox.load(function() {
} else if (!url.page) {
app.$ui.logo
.css({cursor: 'pointer'})
.on({
click: app.toggle
});
.on({click: app.toggle});
['label', 'menu', 'switch'].forEach(function(element) {
app.$ui[element] = app.ui[element]()
.css({opacity: 0})
@ -229,13 +227,10 @@ Ox.load(function() {
.animate({opacity: 1}, 500, function() {
app.$ui.logo
.css({cursor: 'pointer'})
.on({
click: app.toggle
});
.on({click: app.toggle});
});
app.$ui.switch.css({opacity: 0}).show().animate({
opacity: 1
}, 500);
app.$ui.switch.css({opacity: 0}).show()
.animate({opacity: 1}, 500);
});
}
Ox.$window.on({hashchange: app.urlchange});
@ -387,7 +382,6 @@ Ox.load(function() {
loaded: false
},
toggle: function() {
Ox.print('TOGGLE', app.state.animating, app.user.previousPage, app.user.item)
!app.state.animating && app.url.set(
app.url.get().page ? {
page: '',
@ -409,22 +403,23 @@ Ox.load(function() {
width: window.innerWidth - 640 + 'px'
})
.html(app.data.html.documentation),
examples: app.data.docItems ? void 0 : app.data.examples,
examplesPath: app.data.docItems ? void 0 : 'examples/',
files: app.data.docItems ? void 0 : app.data.documentation,
examples: app.data.docItems ? null : app.data.examples,
examplesPath: app.data.docItems ? null : 'examples/',
files: app.data.docItems ? null : app.data.documentation,
getModule: function(item) {
var file = item.file.replace(/^dev\//, '');
return file.split('/')[0];
return item.file.replace(/^dev\//, '')
.split('/')[0];
},
getSection: function(item) {
var file = item.file.replace(/^dev\//, '');
return item.section || file.split('/')[2].split('.')[0];
return item.section
|| item.file.replace(/^dev\//, '')
.split('/')[2].split('.')[0];
},
items: app.data.docItems || void 0,
items: app.data.docItems || null,
path: 'dev/',
references: /\b(Ox\.[\w\$]+(?=\W))/g,
replace: [app.re.code],
results: app.data.testResults || void 0,
results: app.data.testResults || null,
selected: app.user.item.doc,
showTests: true
})
@ -549,30 +544,30 @@ Ox.load(function() {
readme: function() {
var $list = Ox.Container().css({overflowY: 'scroll'}),
$text = Ox.Container().addClass('OxSerif OxSelectable text'),
self = {},
// self = {},
that = Ox.SplitPanel({
elements: [
{element: $list, size: 256},
{element: $text}
],
orientation: 'horizontal'
}, self)
}/*, self*/)
.addClass('readme');
Ox.sortBy(app.data.readme, '-date').forEach(function(item, i) {
var $item = $('<div>')
.addClass('item')
.attr({id: 'readme_' + item.id})
.css({width: 224 - Ox.UI.SCROLLBAR_SIZE + 'px'})
.on({
click: function(e) {
if (!$(this).is('.selected')) {
selectItem(item.id);
} else if (e.metaKey) {
selectItem();
}
.addClass('item')
.attr({id: 'readme_' + item.id})
.css({width: 224 - Ox.UI.SCROLLBAR_SIZE + 'px'})
.on({
click: function(e) {
if (!$(this).is('.selected')) {
selectItem(item.id);
} else if (e.metaKey) {
selectItem();
}
})
.appendTo($list);
}
})
.appendTo($list);
$('<div>')
.addClass('OxSerif title')
.html(item.title)
@ -612,11 +607,13 @@ Ox.load(function() {
app.db(app.user);
app.url.set();
}
/*
self.setOption = function(key, value) {
if (key == 'selected') {
selectItem(value);
}
}
*/
return that;
},
screen: function() {