diff --git a/index.js b/index.js index 70d794a9..ccac1040 100644 --- a/index.js +++ b/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' - ) + ' ' + Ox.VERSION + '.' + 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 + ) : current; } ] }, @@ -481,7 +493,9 @@ 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.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; } diff --git a/readme/html/_downloads.html b/readme/html/_download.html similarity index 94% rename from readme/html/_downloads.html rename to readme/html/_download.html index 116ef369..2cd49004 100644 --- a/readme/html/_downloads.html +++ b/readme/html/_download.html @@ -1,5 +1,5 @@ -

Downloads

-

Please note that these are pre-release versions. {version}

+

Download

+

{version}


Source

Development version, including everything but the kitchen sink.