use one random value for all resources, remove previous element before overwriting, does not get removed from dom otherwise.

This commit is contained in:
j 2012-07-10 10:51:34 +02:00
parent ef0464edcc
commit 443a2fed9b

View file

@ -239,7 +239,7 @@ Ox.load(/^https?:\/\/(www\.)?oxjs\.org\//.test(
app.state.loaded = true; app.state.loaded = true;
}, },
loadData: function(callback) { loadData: function(callback) {
var q = '?' + Ox.random(1000000), var q = '?' + salt,
url = '//oxjs.org/downloads/downloads.json' + q; url = '//oxjs.org/downloads/downloads.json' + q;
Ox.getJSON('index.json' + q, function(data) { Ox.getJSON('index.json' + q, function(data) {
app.data = Ox.extend(app.data, data); app.data = Ox.extend(app.data, data);
@ -529,6 +529,7 @@ Ox.load(/^https?:\/\/(www\.)?oxjs\.org\//.test(
panel: function() { panel: function() {
var $panel = Ox.TabPanel({ var $panel = Ox.TabPanel({
content: function(id) { content: function(id) {
app.$ui[id] && app.$ui[id].remove();
return app.$ui[id] = app.ui[id] return app.$ui[id] = app.ui[id]
? app.ui[id]() : app.ui.page(id); ? app.ui[id]() : app.ui.page(id);
}, },
@ -602,7 +603,7 @@ Ox.load(/^https?:\/\/(www\.)?oxjs\.org\//.test(
id && $panel.find('.item#' + id).addClass('selected'); id && $panel.find('.item#' + id).addClass('selected');
Ox.get('readme/' + ( Ox.get('readme/' + (
id || 'index/readme' id || 'index/readme'
) + '.html?' + Math.random(1000000), function(html) { ) + '.html?' + salt, function(html) {
$text.empty() $text.empty()
.append( .append(
id ? html id ? html
@ -720,6 +721,7 @@ Ox.load(/^https?:\/\/(www\.)?oxjs\.org\//.test(
} }
}, },
user: {} user: {}
}; },
salt = /^https?:\/\/(www\.)?oxjs\.org\//.test(window.location.href) ? Ox.VERSION : +new Date;
app.init(); app.init();
}); });