From 80e0a02ea338af2256e603b500effc8e84301e87 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 26 Jun 2012 19:17:27 +0200 Subject: [PATCH] in ox dev loader, allow for switching to build version by passing true as first argument (can be used to avoid boilerplate when choosing build/ or dev/ dynamically) --- source/Ox.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/source/Ox.js b/source/Ox.js index fa8e0a96..bcb56636 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -11,18 +11,26 @@ path = getPath(), time = +new Date(); - loadJSON(function(data) { - var previousOx = global.Ox; - loadScriptsSerial(data.files, function() { - Ox.VERSION = data.version; - Ox.forEach(previousOx, function(value, key) { - if (Ox.isUndefined(Ox[key])) { - Ox[key] = value; - } - }); - Ox.load.apply(null, args); + if (args[0] === true) { + console.log('OK') + path = path.replace(/dev\/$/, 'build/'); + loadScript('Ox.js', function() { + Ox.load.apply(null, Ox.slice(args, 1)); }); - }); + } else { + loadJSON(function(data) { + var previousOx = global.Ox; + loadScriptsSerial(data.files, function() { + Ox.VERSION = data.version; + Ox.forEach(previousOx, function(value, key) { + if (Ox.isUndefined(Ox[key])) { + Ox[key] = value; + } + }); + Ox.load.apply(null, args); + }); + }); + } function getPath() { var i, path, scripts = document.getElementsByTagName('script');