include-web.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.*/
  2. (function () {
  3. var ctx="./"
  4. var r = new RegExp("(^|(.*?\\/))(include-web\.js)(\\?|$)"),
  5. s = document.getElementsByTagName('script'), targetScript;
  6. for (var i = 0; i < s.length; i++) {
  7. var src = s[i].getAttribute('src');
  8. if (src) {
  9. var m = src.match(r);
  10. if (m) {
  11. targetScript = s[i];
  12. break;
  13. }
  14. }
  15. }
  16. function inputScript(url) {
  17. var script = '<script type="text/javascript" src="' + url + '"><' + '/script>';
  18. document.writeln(script);
  19. }
  20. function inputCSS(url) {
  21. // var css = '<link rel="stylesheet" href="' + url + '">';
  22. // document.writeln(css);
  23. }
  24. function inArray(arr, item) {
  25. for (i in arr) {
  26. if (arr[i] == item) {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. //加载类库资源文件
  33. function load() {
  34. var includes = (targetScript.getAttribute('include') || "").split(",");
  35. var excludes = (targetScript.getAttribute('exclude') || "").split(",");
  36. inputScript(ctx+"supermap/examples/js/tokengenerator.js");
  37. var jQueryInclude = false;
  38. if (!inArray(excludes, 'example-i18n')) {
  39. inputScript(ctx+"supermap/libs/jquery/jquery.min.js");
  40. inputScript(ctx+"supermap/libs/i18next/i18next.min.js");
  41. inputScript(ctx+"supermap/libs/jquery-i18next/jquery-i18next.min.js");
  42. inputScript(ctx+"supermap/examples/js/utils.js");
  43. inputScript(ctx+"supermap/examples/js/localization.js");
  44. document.writeln("<script>Localization.initializeI18N('../', function () {Localization.localize();Localization.initGlobal();}); </script>");
  45. jQueryInclude = true;
  46. }
  47. if (inArray(includes, 'jquery') && !jQueryInclude) {
  48. inputScript(ctx+"supermap/libs/jquery/jquery.min.js");
  49. }
  50. if (inArray(includes, 'bootstrap')) {
  51. inputScript(ctx+"supermap/libs/jquery/jquery.min.js");
  52. inputCSS(ctx+"supermap/libs/bootstrap/css/bootstrap.min.css");
  53. inputScript(ctx+"supermap/libs/bootstrap/js/bootstrap.min.js");
  54. }
  55. if (inArray(includes, 'bootstrap-css')) {
  56. inputCSS(ctx+"supermap/libs/bootstrap/css/bootstrap.min.css")
  57. }
  58. if (inArray(includes, 'bootstrap-js')) {
  59. inputScript(ctx+"supermap/libs/bootstrap/js/bootstrap.min.js");
  60. }
  61. if (inArray(includes, 'jquery-ui')) {
  62. inputCSS(ctx+"supermap/llibs/jquery-ui/1.12.1/jquery-ui.css");
  63. inputScript(ctx+"supermap/llibs/jquery-ui/1.12.1/jquery-ui.min.js");
  64. }
  65. if (inArray(includes, 'template')) {
  66. inputScript(ctx+"supermap/libs/art-template/template-web.js");
  67. }
  68. if (inArray(includes, 'randomcolor')) {
  69. inputScript(ctx+"supermap/libs/randomcolor/randomColor.min.js");
  70. }
  71. if (inArray(includes, 'papaparse')) {
  72. inputScript(ctx+"supermap/libs/papaparse/papaparse.min.js");
  73. }
  74. if (inArray(includes, 'moment')) {
  75. inputScript(ctx+"supermap/libs/moment/2.29.1/moment.min.js");
  76. inputScript(ctx+"supermap/libs/moment/2.29.1/zh-cn.js");
  77. }
  78. if (inArray(includes, 'bootstrap-datetimepicker')) {
  79. inputCSS(ctx+"supermap/libs/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css");
  80. inputScript(ctx+"supermap/libs/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js");
  81. }
  82. if (inArray(includes, 'bootstrap-select')) {
  83. inputCSS(ctx+"supermap/libs/bootstrap-select/bootstrap-select.min.css");
  84. inputScript(ctx+"supermap/libs/bootstrap-select/bootstrap-select.min.js");
  85. }
  86. if (inArray(includes, 'geohash')) {
  87. inputScript(ctx+"supermap/libs/geohash/geohash.js");
  88. }
  89. if (inArray(includes, 'dat-gui')) {
  90. inputScript(ctx+"supermap/libs/dat-gui/0.7.6/dat.gui.min.js");
  91. datGuiI18N();
  92. }
  93. if (inArray(includes, 'admin-lte')) {
  94. inputCSS(ctx+"supermap/libs/admin-lte/css/AdminLTE.min.css");
  95. inputCSS(ctx+"supermap/libs/admin-lte/css/skins/skin-blue.min.css");
  96. inputCSS(ctx+"supermap/libs/font-awesome/css/font-awesome.min.css");
  97. inputScript(ctx+"supermap/libs/admin-lte/js/app.min.js");
  98. }
  99. if (inArray(includes, 'jquery.scrollto')) {
  100. inputScript(ctx+"supermap/libs/jquery.scrollto/jquery.scrollTo.min.js");
  101. }
  102. if (inArray(includes, 'ace')) {
  103. inputScript(ctx+"supermap/libs/ace/ace.js");
  104. }
  105. if (inArray(includes, 'widgets.alert')) {
  106. inputScript(ctx+"supermap/examples/js/widgets.js");
  107. }
  108. if (inArray(includes, 'widgets')) {
  109. inputCSS(ctx+"supermap/libs/css-loader/css-loader.css");
  110. inputScript(ctx+"supermap/examples/js/widgets.js");
  111. }
  112. if (inArray(includes, 'zTree')) {
  113. inputCSS(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/zTree/css/zTreeStyle.css");
  114. inputScript(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/zTree/jquery.ztree.core.js");
  115. }
  116. if (inArray(includes, 'jquery-scontextMenu')) {
  117. inputCSS(ctx+"supermap/libs/jquery.contextMenu/jquery.contextMenu.min.css");
  118. inputScript(ctx+"supermap/libs/jquery.contextMenu/jquery.contextMenu.min.js");
  119. }
  120. if (inArray(includes, 'colorpicker')) {
  121. inputScript(ctx+"supermap/libs/iclient8c/examples/js/jquery.js");
  122. inputScript(ctx+"supermap/libs/iclient8c/examples/js/jquery.colorpicker.js");
  123. }
  124. if (inArray(includes, 'fileupLoad')) {
  125. inputScript(ctx+"supermap/libs/iclient8c/examples/js/jquery.js");
  126. inputScript(ctx+"supermap/libs/iclient8c/examples/js/fileupLoad.js");
  127. }
  128. if (inArray(includes, 'sticklr')) {
  129. inputCSS(ctx+"supermap/libs/iclient8c/examples/css/jquery-sticklr.css");
  130. inputCSS(ctx+"supermap/libs/iclient8c/examples/css/icon.css");
  131. }
  132. if (inArray(includes, 'responsive')) {
  133. inputCSS(ctx+"supermap/libs/iclient8c/examples/css/bootstrap-responsive.min.css");
  134. }
  135. if (inArray(includes, 'lazyload')) {
  136. inputScript(ctx+"supermap/libs/lazyload/jquery.lazyload.min.js");
  137. }
  138. if (inArray(includes, 'i18n')) {
  139. inputScript(ctx+"supermap/libs/i18next/i18next.min.js");
  140. inputScript(ctx+"supermap/libs/jquery-i18next/jquery-i18next.min.js");
  141. }
  142. if (inArray(includes, 'react')) {
  143. inputScript(ctx+"supermap/libs/react/16.4.2/react.production.min.js");
  144. inputScript(ctx+"supermap/libs/react/16.4.2/react-dom.production.min.js");
  145. inputScript(ctx+"supermap/libs/babel/6.26.0/babel.min.js");
  146. }
  147. if (inArray(includes, 'vue')) {
  148. inputScript(ctx+"supermap/libs/vue/2.5.17/vue.min.js");
  149. }
  150. if (inArray(includes, 'ionRangeSlider')) {
  151. inputCSS(ctx+"supermap/libs/ionRangeSlider/2.2.0/css/ion.rangeSlider.css");
  152. inputCSS(ctx+"supermap/libs/ionRangeSlider/2.2.0/css/normalize.css");
  153. inputCSS(ctx+"supermap/libs/ionRangeSlider/2.2.0/css/ion.rangeSlider.skinHTML5.css");
  154. inputScript(ctx+"supermap/libs/ionRangeSlider/2.2.0/js/ion.rangeSlider.min.js");
  155. }
  156. if (inArray(includes, 'plottingPanel')) {
  157. inputScript(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/zTree/jquery.ztree.core.js");
  158. inputCSS(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/zTree/css/zTreeStyle.css");
  159. inputScript(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/jquery-easyui-1.4.4/jquery.easyui.min.js");
  160. inputCSS(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/jquery-easyui-1.4.4/css/easyui.css");
  161. inputScript(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/colorpicker/js/colorpicker.js");
  162. inputCSS(ctx+"supermap/libs/iclient8c/examples/js/plottingPanel/colorpicker/css/colorpicker.css");
  163. }
  164. }
  165. function datGuiI18N() {
  166. document.writeln("<script>function registerEventListener(evt,fn){" +
  167. "if(window.attachEvent){window.attachEvent('on'+evt,fn);}" +
  168. "else{window.addEventListener(evt,fn,false);}" +
  169. "}</script>");
  170. document.writeln("<script>registerEventListener('load',function() { " +
  171. "dat.GUI.TEXT_CLOSED=resources.text_close;dat.GUI.TEXT_OPEN=resources.text_open;" +
  172. "})</script>")
  173. }
  174. load();
  175. window.isLocal = false;
  176. window.server = document.location.toString().match(/file:\/\//) ? "http://localhost:8090" : document.location.protocol + "//" + document.location.host;
  177. window.version = "10.2.1";
  178. window.preRelease = "";
  179. })();