diff --git a/index.js b/index.js index dc6f4717..7fccc197 100644 --- a/index.js +++ b/index.js @@ -8,9 +8,7 @@ Ox.load(function() { var home = app.url.get().page == ''; app.state.animating = true; if (home) { - app.$ui.logo.attr({ - src: app.getSRC('logo') - }); + app.$ui.logo.attr({src: app.getSRC('logo')}); app.$ui.screen.show(); app.$ui.label.show(); app.$ui.menu.options({value: ''}).show(); @@ -26,10 +24,10 @@ Ox.load(function() { 1000, element == 'screen' ? function() { if (!home) { - app.$ui.logo.attr({ - src: app.getSRC('logo') + app.$ui.logo.attr({src: app.getSRC('logo')}); + app.$ui.panel.find('.OxButtonGroup').css({ + opacity: 1 }); - app.$ui.panel.find('.OxButtonGroup').css({opacity: 1}); app.$ui.screen.hide(); app.$ui.label.hide(); app.$ui.menu.hide().options({value: ''}); @@ -123,22 +121,12 @@ Ox.load(function() { return css; }, getSRC: function(element) { - var src, - home = app.url.get().page == '', - theme = app.user.theme || 'classic'; - if (element == 'icon') { - src = 'source/Ox.UI/themes/' + theme - + '/png/icon16.png'; - } else if (element == 'loading') { - src = 'source/Ox.UI/themes/' + theme - + '/svg/symbolLoading.svg' - } else if (element == 'logo') { - src = 'source/Ox.UI/themes/' + theme - + '/png/logo128.png' - } - return src; + return 'source/Ox.UI/themes/' + app.user.theme + '/' + { + icon: 'png/icon16.png', + loading: 'svg/symbolLoading.svg', + logo: 'png/logo128.png' + }[element]; }, - html: {}, init: function() { app.user = Ox.extend(app.data.user, app.db()); app.loadScreen(function() { @@ -220,14 +208,15 @@ Ox.load(function() { app.state.loaded = true; }, loadData: function(callback) { - var url = 'https://oxjs.org/downloads/downloads.json'; - Ox.getJSON('index.json?' + Ox.random(1000000), function(data) { + var q = '?' + Ox.random(100000), + url = 'https://oxjs.org/downloads/downloads.json' + q; + Ox.getJSON('index.json' + q, 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; - if (Ox.len(app.html) == app.data.pages.length) { + Ox.get('readme/html/_' + id + '.html' + q, function(html) { + app.data.html[id] = html; + if (Ox.len(app.data.html) == app.data.pages.length) { if (navigator.onLine) { Ox.getJSON(url, function(data) { app.data.downloads = data; @@ -372,6 +361,7 @@ Ox.load(function() { loaded: false }, toggle: function() { + Ox.print('TOGGLE', app.state.animating, app.user.previousPage, app.user.item) !app.state.animating && app.url.set( app.url.get().page ? { page: '', @@ -392,7 +382,7 @@ Ox.load(function() { margin: '32px', width: window.innerWidth - 640 + 'px' }) - .html(app.html.documentation), + .html(app.data.html.documentation), examples: app.data.docItems ? void 0 : app.data.examples, examplesPath: app.data.docItems ? void 0 : 'examples/', files: app.data.docItems ? void 0 : app.data.documentation, @@ -442,7 +432,7 @@ Ox.load(function() { margin: '32px', width: window.innerWidth - 640 + 'px' }) - .html(app.html.examples), + .html(app.data.html.examples), examples: app.data.examples, path: 'examples/', references: /\b(Ox\.[\w\$]+(?=\W))/g, @@ -469,9 +459,6 @@ Ox.load(function() { paddingTop: '4px', paddingBottom: '4px', borderRadius: '6px' - }) - .on({ - click: app.toggle }); }, loading: function() { @@ -508,7 +495,7 @@ Ox.load(function() { $('
') .addClass('OxSelectable page') .html( - app.html[page] + app.data.html[page] .replace(app.re.size[0], app.re.size[1]) .replace(app.re.version[0], app.re.version[1]) )