1 | /*
|
---|
2 | This file is part of Ext JS 4.2
|
---|
3 |
|
---|
4 | Copyright (c) 2011-2013 Sencha Inc
|
---|
5 |
|
---|
6 | Contact: http://www.sencha.com/contact
|
---|
7 |
|
---|
8 | GNU General Public License Usage
|
---|
9 | This file may be used under the terms of the GNU General Public License version 3.0 as
|
---|
10 | published by the Free Software Foundation and appearing in the file LICENSE included in the
|
---|
11 | packaging of this file.
|
---|
12 |
|
---|
13 | Please review the following information to ensure the GNU General Public License version 3.0
|
---|
14 | requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
---|
15 |
|
---|
16 | If you are unsure which license is appropriate for your use, please contact the sales department
|
---|
17 | at http://www.sencha.com/contact.
|
---|
18 |
|
---|
19 | Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)
|
---|
20 | */
|
---|
21 | /**
|
---|
22 | * Load the library located at the same path with this file
|
---|
23 | *
|
---|
24 | * Will automatically load ext-all-dev.js if any of these conditions is true:
|
---|
25 | * - Current hostname is localhost
|
---|
26 | * - Current hostname is an IP v4 address
|
---|
27 | * - Current protocol is "file:"
|
---|
28 | *
|
---|
29 | * Will load ext-all.js (minified) otherwise
|
---|
30 | */
|
---|
31 | (function() {
|
---|
32 | var scripts = document.getElementsByTagName('script'),
|
---|
33 | localhostTests = [
|
---|
34 | /^localhost$/,
|
---|
35 | /\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
|
---|
36 | ],
|
---|
37 | host = window.location.hostname,
|
---|
38 | isDevelopment = null,
|
---|
39 | queryString = window.location.search,
|
---|
40 | test, path, i, ln, scriptSrc, match;
|
---|
41 |
|
---|
42 | for (i = 0, ln = scripts.length; i < ln; i++) {
|
---|
43 | scriptSrc = scripts[i].src;
|
---|
44 |
|
---|
45 | match = scriptSrc.match(/bootstrap\.js$/);
|
---|
46 |
|
---|
47 | if (match) {
|
---|
48 | path = scriptSrc.substring(0, scriptSrc.length - match[0].length);
|
---|
49 | break;
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | if (queryString.match('(\\?|&)debug') !== null) {
|
---|
54 | isDevelopment = true;
|
---|
55 | }
|
---|
56 | else if (queryString.match('(\\?|&)nodebug') !== null) {
|
---|
57 | isDevelopment = false;
|
---|
58 | }
|
---|
59 |
|
---|
60 | if (isDevelopment === null) {
|
---|
61 | for (i = 0, ln = localhostTests.length; i < ln; i++) {
|
---|
62 | test = localhostTests[i];
|
---|
63 |
|
---|
64 | if (host.search(test) !== -1) {
|
---|
65 | isDevelopment = true;
|
---|
66 | break;
|
---|
67 | }
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | if (isDevelopment === null && window.location.protocol === 'file:') {
|
---|
72 | isDevelopment = true;
|
---|
73 | }
|
---|
74 |
|
---|
75 | document.write('<script type="text/javascript" charset="UTF-8" src="' +
|
---|
76 | path + 'ext-all' + (isDevelopment ? '-dev' : '') + '.js"></script>');
|
---|
77 | })();
|
---|