64 lines
2.1 KiB
JavaScript
64 lines
2.1 KiB
JavaScript
|
/* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.*/
|
||
|
(function () {
|
||
|
var r = new RegExp("(^|(.*?\\/))(include-web\.js)(\\?|$)"),
|
||
|
s = document.getElementsByTagName('script'), targetScript;
|
||
|
for (var i = 0; i < s.length; i++) {
|
||
|
var src = s[i].getAttribute('src');
|
||
|
if (src) {
|
||
|
var m = src.match(r);
|
||
|
if (m) {
|
||
|
targetScript = s[i];
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function inputScript(url) {
|
||
|
var script = '<script type="text/javascript" src="' + url + '"><' + '/script>';
|
||
|
document.writeln(script);
|
||
|
}
|
||
|
|
||
|
function inputCSS(url) {
|
||
|
var css = '<link rel="stylesheet" href="' + url + '">';
|
||
|
document.writeln(css);
|
||
|
}
|
||
|
|
||
|
function inArray(arr, item) {
|
||
|
for (i in arr) {
|
||
|
if (arr[i] == item) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
|
||
|
//加载类库资源文件
|
||
|
function load() {
|
||
|
var includes = (targetScript.getAttribute('include') || "").split(",");
|
||
|
var excludes = (targetScript.getAttribute('exclude') || "").split(",");
|
||
|
inputScript("../plotting/tokengenerator.js");
|
||
|
var jQueryInclude = false;
|
||
|
if (!inArray(excludes, 'example-i18n')) {
|
||
|
inputScript("../plotting/jquery-3.4.1.min.js");
|
||
|
|
||
|
inputScript("../plotting/i18next.min.js");
|
||
|
inputScript("../plotting/jquery-i18next.min.js");
|
||
|
|
||
|
inputScript("../plotting/utils.js");
|
||
|
inputScript("../plotting/localization.js");
|
||
|
document.writeln("<script>Localization.initializeI18N('../', function () {Localization.localize();Localization.initGlobal();}); </script>");
|
||
|
jQueryInclude = true;
|
||
|
}
|
||
|
if (inArray(includes, 'jquery') && !jQueryInclude) {
|
||
|
inputScript("../plotting/jquery-3.4.1.min.js");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
load();
|
||
|
window.isLocal = false;
|
||
|
window.server = document.location.toString().match(/file:\/\//) ? "http://localhost:8090" : document.location.protocol + "//" + document.location.host;
|
||
|
window.version = "10.0.1";
|
||
|
window.preRelease = "";
|
||
|
})();
|