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