diff --git a/index.js b/index.js
index ccac1040..a6e6340c 100644
--- a/index.js
+++ b/index.js
@@ -40,6 +40,7 @@ Ox.load(function() {
});
},
data: {
+ downloads: {},
html: {},
pages: [
{id: 'about', title: 'About'},
@@ -218,7 +219,8 @@ Ox.load(function() {
app.state.loaded = true;
},
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) {
app.data = Ox.extend(app.data, data);
app.data.pages.forEach(function(page) {
@@ -228,7 +230,7 @@ Ox.load(function() {
if (Ox.len(app.html) == app.data.pages.length) {
if (navigator.onLine) {
Ox.getJSON(url, function(data) {
- app.data.version = data.version;
+ app.data.downloads = data;
callback();
});
} else {
@@ -295,15 +297,29 @@ Ox.load(function() {
/\b(Ox\.[\w\$]+)/g,
'$1'
],
+ size: [
+ /\{size\.(\w+)\}/g,
+ function(match, key) {
+ return app.data.downloads ? ' (' + Ox.formatValue(
+ app.data.downloads.size[key], 'B'
+ ) + ')' : '';
+ }
+ ],
version: [
'{version}',
function() {
- var current = 'You\'re currently running version '
- + Ox.VERSION + '
.',
- latest = 'The latest version is '
- + app.data.version + '
.';
- return app.data.version ? latest + (
- app.data.version == Ox.VERSION ? '' : ' ' + current
+ var version = app.data.downloads.version,
+ current = 'You\'re currently running version '
+ + Ox.VERSION + '.',
+ latest = 'The latest version is ' + version + ' ('
+ + app.data.downloads.date
+ .replace('T', ' ')
+ .replace('Z', ' UTC')
+ + ').';
+ return version ? latest + (
+ /:\/\/oxjs.org\//.test(window.location.href) ? ''
+ : version == Ox.VERSION ? ' You\'re up to date.'
+ : ' ' + current
) : current;
}
]
@@ -493,9 +509,11 @@ Ox.load(function() {
var $element = Ox.Container();
$('
Or download OxJS.latest.source.tar.gz
Or download OxJS.latest.source.tar.gz
{size.source}.
Start with OxJS/index.html
. It's this website.
Minified production version.
-Download OxJS.latest.build.tar.gz
, or get Ox.js
only: Ox.js
Download OxJS.latest.build.tar.gz
{size.build}.
Or get Ox.js
only: Ox.js
{size.minified}
<!DOCTYPE HTML>