| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
(function() { |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
var singleFile = (typeof GeoExt == "object" && GeoExt.singleFile); |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
var scriptName = singleFile ? "GeoExt.js" : "lib/GeoExt.js"; |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
var getScriptLocation = function() { |
|---|
| 34 |
var scriptLocation = ""; |
|---|
| 35 |
var scripts = document.getElementsByTagName('script'); |
|---|
| 36 |
for(var i=0, len=scripts.length; i<len; i++) { |
|---|
| 37 |
var src = scripts[i].getAttribute('src'); |
|---|
| 38 |
if(src) { |
|---|
| 39 |
var index = src.lastIndexOf(scriptName); |
|---|
| 40 |
|
|---|
| 41 |
var pathLength = src.lastIndexOf('?'); |
|---|
| 42 |
if(pathLength < 0) { |
|---|
| 43 |
pathLength = src.length; |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
if((index > -1) && (index + scriptName.length == pathLength)) { |
|---|
| 47 |
scriptLocation = src.slice(0, pathLength - scriptName.length); |
|---|
| 48 |
break; |
|---|
| 49 |
} |
|---|
| 50 |
} |
|---|
| 51 |
} |
|---|
| 52 |
return scriptLocation; |
|---|
| 53 |
}; |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
if(!singleFile) { |
|---|
| 60 |
var jsfiles = new Array( |
|---|
| 61 |
"GeoExt/data/FeatureReader.js", |
|---|
| 62 |
"GeoExt/data/FeatureStoreMediator.js", |
|---|
| 63 |
"GeoExt/data/LayerStore.js", |
|---|
| 64 |
"GeoExt/data/LayerRecord.js", |
|---|
| 65 |
"GeoExt/data/LayerStoreMediator.js", |
|---|
| 66 |
"GeoExt/data/ProtocolProxy.js", |
|---|
| 67 |
"GeoExt/widgets/MapPanel.js" |
|---|
| 68 |
); |
|---|
| 69 |
|
|---|
| 70 |
var agent = navigator.userAgent; |
|---|
| 71 |
var docWrite = (agent.match("MSIE") || agent.match("Safari")); |
|---|
| 72 |
if(docWrite) { |
|---|
| 73 |
var allScriptTags = new Array(jsfiles.length); |
|---|
| 74 |
} |
|---|
| 75 |
var host = getScriptLocation() + "lib/"; |
|---|
| 76 |
for (var i=0, len=jsfiles.length; i<len; i++) { |
|---|
| 77 |
if (docWrite) { |
|---|
| 78 |
allScriptTags[i] = "<script src='" + host + jsfiles[i] + |
|---|
| 79 |
"'></script>"; |
|---|
| 80 |
} else { |
|---|
| 81 |
var s = document.createElement("script"); |
|---|
| 82 |
s.src = host + jsfiles[i]; |
|---|
| 83 |
var h = document.getElementsByTagName("head").length ? |
|---|
| 84 |
document.getElementsByTagName("head")[0] : |
|---|
| 85 |
document.body; |
|---|
| 86 |
h.appendChild(s); |
|---|
| 87 |
} |
|---|
| 88 |
} |
|---|
| 89 |
if (docWrite) { |
|---|
| 90 |
document.write(allScriptTags.join("")); |
|---|
| 91 |
} |
|---|
| 92 |
} |
|---|
| 93 |
})(); |
|---|