display latest version
This commit is contained in:
parent
48b5e9610a
commit
e663eb68d8
2 changed files with 28 additions and 13 deletions
37
index.js
37
index.js
|
@ -46,7 +46,7 @@ Ox.load(function() {
|
|||
{id: 'readme', title: 'Readme'},
|
||||
{id: 'examples', title: 'Examples'},
|
||||
{id: 'doc', title: 'Documentation'},
|
||||
{id: 'downloads', title: 'Downloads'},
|
||||
{id: 'download', title: 'Download'},
|
||||
{id: 'development', title: 'Development'}
|
||||
],
|
||||
user: {
|
||||
|
@ -218,15 +218,25 @@ Ox.load(function() {
|
|||
app.state.loaded = true;
|
||||
},
|
||||
loadData: function(callback) {
|
||||
Ox.getJSON('index.json?'+Ox.random(1000), function(data) {
|
||||
var url = 'https://oxjs.org/dev/Ox/json/Ox.json';
|
||||
Ox.getJSON('index.json?' + Ox.random(1000000), function(data) {
|
||||
app.data = Ox.extend(app.data, data);
|
||||
app.data.pages.forEach(function(page) {
|
||||
var id = page.id == 'doc' ? 'documentation' : page.id;
|
||||
Ox.get('readme/html/_' + (id) + '.html', function(html) {
|
||||
app.html[id] = html;
|
||||
Ox.len(app.html) == app.data.pages.length && callback();
|
||||
if (Ox.len(app.html) == app.data.pages.length) {
|
||||
if (navigator.onLine) {
|
||||
Ox.getJSON(url, function(data) {
|
||||
app.data.version = data.version;
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
},
|
||||
loadScreen: function(callback) {
|
||||
|
@ -288,11 +298,13 @@ Ox.load(function() {
|
|||
version: [
|
||||
'{version}',
|
||||
function() {
|
||||
return (
|
||||
/:\/\/oxjs.org\//.test(window.location.href)
|
||||
? 'The latest version is'
|
||||
: 'You\'re currently running version'
|
||||
) + ' <code>' + Ox.VERSION + '.</code>'
|
||||
var current = 'You\'re currently running version <code>'
|
||||
+ Ox.VERSION + '</code>.',
|
||||
latest = 'The latest version is <code>'
|
||||
+ app.data.version + '</code>.';
|
||||
return app.data.version ? latest + (
|
||||
app.data.version == Ox.VERSION ? '' : ' ' + current
|
||||
) : current;
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -481,7 +493,9 @@ Ox.load(function() {
|
|||
var $element = Ox.Container();
|
||||
$('<div>')
|
||||
.addClass('OxSelectable page')
|
||||
.html(app.html[page].replace(app.re.version[0], app.re.version[1]))
|
||||
.html(app.html[page].replace(
|
||||
app.re.version[0], app.re.version[1]
|
||||
))
|
||||
.appendTo($element);
|
||||
return $element;
|
||||
},
|
||||
|
@ -627,7 +641,8 @@ Ox.load(function() {
|
|||
set: function(data) {
|
||||
data = data || app.user;
|
||||
window.location.hash = data.page + (
|
||||
data.item && data.item[data.page] ? '/' + data.item[data.page] : ''
|
||||
data.item && data.item[data.page]
|
||||
? '/' + data.item[data.page] : ''
|
||||
);
|
||||
return app;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<h1><b>Downloads</b></h1>
|
||||
<p>Please note that these are pre-release versions. {version}</p>
|
||||
<h1><b>Download</b></h1>
|
||||
<p>{version}</p>
|
||||
<br>
|
||||
<h2><b>Source</b></h2>
|
||||
<p>Development version, including everything but the kitchen sink.</p>
|
Loading…
Reference in a new issue