SuperMap.Include.js
1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(function() {
var isWinRT = (typeof Windows === "undefined") ? false : true;
var r = new RegExp("(^|(.*?\\/))(SuperMap.Include\.js)(\\?|$)"),
s = document.getElementsByTagName('script'),
src, m, baseurl = "";
for(var i=0, len=s.length; i<len; i++) {
src = s[i].getAttribute('src');
if(src) {
var m = src.match(r);
if(m) {
baseurl = m[1];
break;
}
}
}
function inputScript(inc){
if (!isWinRT) {
var script = '<' + 'script type="text/javascript" src="' + inc + '"' + '><' + '/script>';
document.writeln(script);
} else {
var script = document.createElement("script");
script.src = inc;
document.getElementsByTagName("HEAD")[0].appendChild(script);
}
}
function inputCSS(style){
if (!isWinRT) {
var css = '<' + 'link rel="stylesheet" href="' + baseurl + '../theme/default/' + style + '"' + '><' + '/>';
document.writeln(css);
} else {
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "/theme/default/" + style;
document.getElementsByTagName("HEAD")[0].appendChild(link);
}
}
//加载类库资源文件
function loadSMLibs() {
inputScript(baseurl+'SuperMap-7.1-11828.js');
}
//引入汉化资源文件
function loadLocalization() {
inputScript(baseurl + 'Lang/zh-CN.js');
}
loadSMLibs();loadLocalization();
})();