2 * Load the library located at the same path with this file
4 * Will automatically load ext-all-debug.js if any of these conditions is true:
5 * - Current hostname is localhost
6 * - Current hostname is an IP v4 address
7 * - Current protocol is "file:"
9 * Will load ext-all.js (minified) otherwise
13 var scripts = document.getElementsByTagName('script'),
16 /\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/ // IP v4
18 host = window.location.hostname,
20 queryString = window.location.search,
21 test, path, i, ln, scriptSrc, match;
23 for (i = 0, ln = scripts.length; i < ln; i++) {
24 scriptSrc = scripts[i].src;
26 match = scriptSrc.match(/bootstrap\.js$/);
29 path = scriptSrc.substring(0, scriptSrc.length - match[0].length);
34 if (queryString.match('(\\?|&)debug') !== null) {
37 else if (queryString.match('(\\?|&)nodebug') !== null) {
38 isDevelopment = false;
41 if (isDevelopment === null) {
42 for (i = 0, ln = localhostTests.length; i < ln; i++) {
43 test = localhostTests[i];
45 if (host.search(test) !== -1) {
52 if (isDevelopment === null && window.location.protocol === 'file:') {
56 document.write('<script type="text/javascript" src="' + path + 'ext-all' + ((isDevelopment) ? '-debug' : '') + '.js"></script>');