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(); $('
') .addClass('OxSelectable page') - .html(app.html[page].replace( - app.re.version[0], app.re.version[1] - )) + .html( + app.html[page] + .replace(app.re.size[0], app.re.size[1]) + .replace(app.re.version[0], app.re.version[1]) + ) .appendTo($element); return $element; }, diff --git a/readme/html/_download.html b/readme/html/_download.html index 2cd49004..d3b0cf65 100644 --- a/readme/html/_download.html +++ b/readme/html/_download.html @@ -8,12 +8,13 @@ $ bzr branch http://code.0x2620.org/oxjs $ tools/build/build.py

-

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.


Build

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}


Getting Started

<!DOCTYPE HTML>