display version, date and sizes
This commit is contained in:
parent
a8ba135bf3
commit
123f81183e
2 changed files with 32 additions and 13 deletions
40
index.js
40
index.js
|
@ -40,6 +40,7 @@ Ox.load(function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
downloads: {},
|
||||||
html: {},
|
html: {},
|
||||||
pages: [
|
pages: [
|
||||||
{id: 'about', title: 'About'},
|
{id: 'about', title: 'About'},
|
||||||
|
@ -218,7 +219,8 @@ Ox.load(function() {
|
||||||
app.state.loaded = true;
|
app.state.loaded = true;
|
||||||
},
|
},
|
||||||
loadData: function(callback) {
|
loadData: function(callback) {
|
||||||
var url = 'https://oxjs.org/dev/Ox/json/Ox.json';
|
var url = 'https://oxjs.org/downloads/downloads.json';
|
||||||
|
url = 'downloads/downloads.json'
|
||||||
Ox.getJSON('index.json?' + Ox.random(1000000), function(data) {
|
Ox.getJSON('index.json?' + Ox.random(1000000), function(data) {
|
||||||
app.data = Ox.extend(app.data, data);
|
app.data = Ox.extend(app.data, data);
|
||||||
app.data.pages.forEach(function(page) {
|
app.data.pages.forEach(function(page) {
|
||||||
|
@ -228,7 +230,7 @@ Ox.load(function() {
|
||||||
if (Ox.len(app.html) == app.data.pages.length) {
|
if (Ox.len(app.html) == app.data.pages.length) {
|
||||||
if (navigator.onLine) {
|
if (navigator.onLine) {
|
||||||
Ox.getJSON(url, function(data) {
|
Ox.getJSON(url, function(data) {
|
||||||
app.data.version = data.version;
|
app.data.downloads = data;
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -295,15 +297,29 @@ Ox.load(function() {
|
||||||
/\b(Ox\.[\w\$]+)/g,
|
/\b(Ox\.[\w\$]+)/g,
|
||||||
'<a href="#doc/$1" class="OxMonospace doclink">$1</a>'
|
'<a href="#doc/$1" class="OxMonospace doclink">$1</a>'
|
||||||
],
|
],
|
||||||
|
size: [
|
||||||
|
/\{size\.(\w+)\}/g,
|
||||||
|
function(match, key) {
|
||||||
|
return app.data.downloads ? ' (' + Ox.formatValue(
|
||||||
|
app.data.downloads.size[key], 'B'
|
||||||
|
) + ')' : '';
|
||||||
|
}
|
||||||
|
],
|
||||||
version: [
|
version: [
|
||||||
'{version}',
|
'{version}',
|
||||||
function() {
|
function() {
|
||||||
var current = 'You\'re currently running version <code>'
|
var version = app.data.downloads.version,
|
||||||
+ Ox.VERSION + '</code>.',
|
current = 'You\'re currently running version '
|
||||||
latest = 'The latest version is <code>'
|
+ Ox.VERSION + '.',
|
||||||
+ app.data.version + '</code>.';
|
latest = 'The latest version is ' + version + ' ('
|
||||||
return app.data.version ? latest + (
|
+ app.data.downloads.date
|
||||||
app.data.version == Ox.VERSION ? '' : ' ' + current
|
.replace('T', ' ')
|
||||||
|
.replace('Z', ' UTC')
|
||||||
|
+ ').';
|
||||||
|
return version ? latest + (
|
||||||
|
/:\/\/oxjs.org\//.test(window.location.href) ? ''
|
||||||
|
: version == Ox.VERSION ? ' You\'re up to date.'
|
||||||
|
: ' ' + current
|
||||||
) : current;
|
) : current;
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -493,9 +509,11 @@ Ox.load(function() {
|
||||||
var $element = Ox.Container();
|
var $element = Ox.Container();
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.addClass('OxSelectable page')
|
.addClass('OxSelectable page')
|
||||||
.html(app.html[page].replace(
|
.html(
|
||||||
app.re.version[0], app.re.version[1]
|
app.html[page]
|
||||||
))
|
.replace(app.re.size[0], app.re.size[1])
|
||||||
|
.replace(app.re.version[0], app.re.version[1])
|
||||||
|
)
|
||||||
.appendTo($element);
|
.appendTo($element);
|
||||||
return $element;
|
return $element;
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,12 +8,13 @@
|
||||||
$ bzr branch http://code.0x2620.org/oxjs
|
$ bzr branch http://code.0x2620.org/oxjs
|
||||||
$ tools/build/build.py</pre>
|
$ tools/build/build.py</pre>
|
||||||
</p>
|
</p>
|
||||||
<p>Or download <a href="https://oxjs.org/downloads/OxJS.latest.build.tar.gz"><code>OxJS.latest.source.tar.gz</code></a></p>
|
<p>Or download <a href="https://oxjs.org/downloads/OxJS.latest.build.tar.gz"><code>OxJS.latest.source.tar.gz</code></a>{size.source}.</p>
|
||||||
<p>Start with <code>OxJS/index.html</code>. It's this website.</p>
|
<p>Start with <code>OxJS/index.html</code>. It's this website.</p>
|
||||||
<br>
|
<br>
|
||||||
<h2><b>Build</b></h2>
|
<h2><b>Build</b></h2>
|
||||||
<p>Minified production version.</p>
|
<p>Minified production version.</p>
|
||||||
<p>Download <a href="https://oxjs.org/downloads/OxJS.latest.build.tar.gz"><code>OxJS.latest.build.tar.gz</code></a>, or get <code>Ox.js</code> only: <a href="https://oxjs.org/oxjs/build/Ox.js"><code>Ox.js</code></a></p>
|
<p>Download <a href="https://oxjs.org/downloads/OxJS.latest.build.tar.gz"><code>OxJS.latest.build.tar.gz</code></a>{size.build}.</p>
|
||||||
|
<p>Or get <code>Ox.js</code> only: <a href="https://oxjs.org/oxjs/build/Ox.js"><code>Ox.js</code></a>{size.minified}</p>
|
||||||
<br>
|
<br>
|
||||||
<h2><b>Getting Started</b></h2>
|
<h2><b>Getting Started</b></h2>
|
||||||
<pre><!DOCTYPE HTML>
|
<pre><!DOCTYPE HTML>
|
||||||
|
|
Loading…
Reference in a new issue