12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- (function() {
- var scripts = document.getElementsByTagName('script'),
- localhostTests = [
- /^localhost$/,
- /\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:\d{1,5})?\b/
- ],
- host = window.location.hostname,
- isDevelopment = null,
- queryString = window.location.search,
- test, path, i, ln, scriptSrc, match;
- for (i = 0, ln = scripts.length; i < ln; i++) {
- scriptSrc = scripts[i].src;
- match = scriptSrc.match(/bootstrap\.js$/);
- if (match) {
- path = scriptSrc.substring(0, scriptSrc.length - match[0].length);
- break;
- }
- }
- if (queryString.match('(\\?|&)debug') !== null) {
- isDevelopment = true;
- }
- else if (queryString.match('(\\?|&)nodebug') !== null) {
- isDevelopment = false;
- }
- if (isDevelopment === null) {
- for (i = 0, ln = localhostTests.length; i < ln; i++) {
- test = localhostTests[i];
- if (host.search(test) !== -1) {
- isDevelopment = true;
- break;
- }
- }
- }
- if (isDevelopment === null && window.location.protocol === 'file:') {
- isDevelopment = true;
- }
- document.write('<script type="text/javascript" src="' + path + 'ext-all' + ((isDevelopment) ? '-debug' : '') + '.js"></script>');
- })();
|