load Ox.js debug version with ?version

This commit is contained in:
j 2014-01-22 10:15:29 +00:00
parent 9a67924916
commit 2b2e8c8ef2

View file

@ -10,7 +10,7 @@
callback = args[args.length - 1], callback = args[args.length - 1],
path = getPath(), path = getPath(),
regexp = /dev\/$/, regexp = /dev\/$/,
time = +new Date(); version;
if (args[0] === true && regexp.test(path)) { if (args[0] === true && regexp.test(path)) {
path = path.replace(regexp, 'build/'); path = path.replace(regexp, 'build/');
@ -22,6 +22,7 @@
} else { } else {
loadJSON(function(data) { loadJSON(function(data) {
var previousOx = global.Ox; var previousOx = global.Ox;
version = data.version;
loadScriptsSerial(data.files, function() { loadScriptsSerial(data.files, function() {
Ox.LOCALES = data.locales; Ox.LOCALES = data.locales;
Ox.VERSION = data.version; Ox.VERSION = data.version;
@ -47,7 +48,8 @@
} }
function loadJSON(callback) { function loadJSON(callback) {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest(),
time = +new Date();
request.open('GET', path + 'Ox/json/Ox.json?' + time, true); request.open('GET', path + 'Ox/json/Ox.json?' + time, true);
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState == 4) { if (request.readyState == 4) {
@ -73,7 +75,7 @@
callback(); callback();
} }
} }
element.src = path + script + '?' + time; element.src = path + script + '?' + version;
element.type = 'text/javascript'; element.type = 'text/javascript';
head.appendChild(element); head.appendChild(element);
} }