|
1 | 1 | /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
|
2 | 2 | * This program are made available under the terms of the Apache License, Version 2.0
|
3 | 3 | * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
|
4 |
| -(function () { |
5 |
| - var r = new RegExp("(^|(.*?\\/))(include-leaflet\.js)(\\?|$)"), |
6 |
| - s = document.getElementsByTagName('script'), targetScript; |
| 4 | +(function() { |
| 5 | + var r = new RegExp('(^|(.*?\\/))(include-leaflet.js)(\\?|$)'), |
| 6 | + s = document.getElementsByTagName('script'), |
| 7 | + targetScript; |
7 | 8 | for (var i = 0; i < s.length; i++) {
|
8 | 9 | var src = s[i].getAttribute('src');
|
9 | 10 | if (src) {
|
|
37 | 38 | function supportES6() {
|
38 | 39 | var code = "'use strict'; class Foo {}; class Bar extends Foo {};";
|
39 | 40 | try {
|
40 |
| - (new Function(code))(); |
| 41 | + new Function(code)(); |
41 | 42 | } catch (err) {
|
42 | 43 | return false;
|
43 | 44 | }
|
|
49 | 50 |
|
50 | 51 | //加载类库资源文件
|
51 | 52 | function load() {
|
52 |
| - var includes = (targetScript.getAttribute('include') || "").split(","); |
53 |
| - var excludes = (targetScript.getAttribute('exclude') || "").split(","); |
| 53 | + var includes = (targetScript.getAttribute('include') || '').split(','); |
| 54 | + var excludes = (targetScript.getAttribute('exclude') || '').split(','); |
54 | 55 | // 在线
|
55 | 56 | if (!inArray(excludes, 'leaflet')) {
|
56 |
| - inputCSS('https://cdn.bootcss.com/leaflet/1.6.0/leaflet.css'); |
57 |
| - inputScript('https://cdn.bootcss.com/leaflet/1.6.0/leaflet.js'); |
| 57 | + inputCSS('https://cdn.bootcss.com/leaflet/1.7.1/leaflet.css'); |
| 58 | + inputScript('https://cdn.bootcss.com/leaflet/1.7.1/leaflet.js'); |
58 | 59 | }
|
59 | 60 | if (inArray(includes, 'leaflet.heat')) {
|
60 |
| - inputScript("https://cdn.bootcss.com/leaflet.heat/0.2.0/leaflet-heat.js"); |
| 61 | + inputScript('https://cdn.bootcss.com/leaflet.heat/0.2.0/leaflet-heat.js'); |
61 | 62 | }
|
62 | 63 | if (inArray(includes, 'leaflet.markercluster')) {
|
63 |
| - inputCSS("https://cdn.bootcss.com/leaflet.markercluster/1.4.1/MarkerCluster.Default.css"); |
64 |
| - inputCSS("https://cdn.bootcss.com/leaflet.markercluster/1.4.1/MarkerCluster.css"); |
65 |
| - inputScript("https://cdn.bootcss.com/leaflet.markercluster/1.4.1/leaflet.markercluster.js"); |
| 64 | + inputCSS('https://cdn.bootcss.com/leaflet.markercluster/1.4.1/MarkerCluster.Default.css'); |
| 65 | + inputCSS('https://cdn.bootcss.com/leaflet.markercluster/1.4.1/MarkerCluster.css'); |
| 66 | + inputScript('https://cdn.bootcss.com/leaflet.markercluster/1.4.1/leaflet.markercluster.js'); |
66 | 67 | }
|
67 | 68 | if (inArray(includes, 'leaflet.draw')) {
|
68 |
| - inputCSS("https://cdn.bootcss.com/leaflet.draw/1.0.4/leaflet.draw.css"); |
69 |
| - inputScript("https://cdn.bootcss.com/leaflet.draw/1.0.4/leaflet.draw.js"); |
| 69 | + inputCSS('https://cdn.bootcss.com/leaflet.draw/1.0.4/leaflet.draw.css'); |
| 70 | + inputScript('https://cdn.bootcss.com/leaflet.draw/1.0.4/leaflet.draw.js'); |
70 | 71 | }
|
71 | 72 | if (inArray(includes, 'leaflet-geoman')) {
|
72 |
| - inputCSS('https://cdn.jsdelivr.net/npm/@geoman-io/leaflet-geoman-free@2.3.0/dist/leaflet-geoman.css'); |
73 |
| - inputScript('https://cdn.jsdelivr.net/npm/@geoman-io/leaflet-geoman-free@2.3.0/dist/leaflet-geoman.min.js'); |
| 73 | + inputCSS('https://cdn.jsdelivr.net/npm/@geoman-io/leaflet-geoman-free@2.7.0/dist/leaflet-geoman.css'); |
| 74 | + inputScript('https://cdn.jsdelivr.net/npm/@geoman-io/leaflet-geoman-free@2.7.0/dist/leaflet-geoman.min.js'); |
74 | 75 | }
|
75 | 76 | if (inArray(includes, 'leaflet.miniMap')) {
|
76 |
| - inputCSS("https://cdn.bootcss.com/leaflet-minimap/3.6.1/Control.MiniMap.min.css"); |
77 |
| - inputScript("https://cdn.bootcss.com/leaflet-minimap/3.6.1/Control.MiniMap.min.js"); |
| 77 | + inputCSS('https://cdn.bootcss.com/leaflet-minimap/3.6.1/Control.MiniMap.min.css'); |
| 78 | + inputScript('https://cdn.bootcss.com/leaflet-minimap/3.6.1/Control.MiniMap.min.js'); |
78 | 79 | }
|
79 | 80 | if (inArray(includes, 'mapv')) {
|
80 |
| - inputScript("https://cdn.jsdelivr.net/npm/mapv@2.0.43/build/mapv.min.js"); |
| 81 | + inputScript('https://cdn.jsdelivr.net/npm/mapv@2.0.56/build/mapv.min.js'); |
81 | 82 | }
|
82 | 83 | if (inArray(includes, 'turf')) {
|
83 |
| - inputScript("https://cdn.bootcss.com/Turf.js/5.1.6/turf.min.js"); |
| 84 | + inputScript('https://cdn.bootcss.com/Turf.js/5.1.6/turf.min.js'); |
84 | 85 | }
|
85 | 86 | if (inArray(includes, 'echarts')) {
|
86 |
| - inputScript('https://cdn.jsdelivr.net/npm/echarts@4.5.0/dist/echarts.min.js'); |
| 87 | + inputScript('https://cdn.jsdelivr.net/npm/echarts@4.9.0/dist/echarts.min.js'); |
87 | 88 | }
|
88 | 89 | if (inArray(includes, 'elasticsearch')) {
|
89 |
| - inputScript('https://cdn.bootcss.com/elasticsearch/16.5.0/elasticsearch.js'); |
| 90 | + inputScript('https://cdn.bootcss.com/elasticsearch/16.7.1/elasticsearch.js'); |
90 | 91 | }
|
91 | 92 | if (inArray(includes, 'xlsx')) {
|
92 |
| - inputScript('https://cdn.jsdelivr.net/npm/xlsx@0.15.4/dist/xlsx.core.min.js'); |
| 93 | + inputScript('https://cdn.jsdelivr.net/npm/xlsx@0.16.7/dist/xlsx.core.min.js'); |
93 | 94 | }
|
94 | 95 | // 本地
|
95 | 96 | if (inArray(includes, 'leaflet.sidebyside')) {
|
96 |
| - inputScript("https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet-side-by-side/leaflet-side-by-side.min.js"); |
| 97 | + inputScript( |
| 98 | + 'https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet-side-by-side/leaflet-side-by-side.min.js' |
| 99 | + ); |
97 | 100 | }
|
98 | 101 | if (inArray(includes, 'd3')) {
|
99 |
| - inputScript('https://cdn.bootcss.com/d3/5.14.2/d3.min.js'); |
| 102 | + inputScript('https://cdn.bootcss.com/d3/6.1.1/d3.min.js'); |
100 | 103 | }
|
101 | 104 | if (inArray(includes, 'd3-hexbin')) {
|
102 |
| - inputScript("https://d3js.org/d3-hexbin.v0.2.min.js"); |
| 105 | + inputScript('https://d3js.org/d3-hexbin.v0.2.min.js'); |
103 | 106 | }
|
104 | 107 | if (inArray(includes, 'd3Layer')) {
|
105 |
| - inputScript("https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet.d3Layer/leaflet-d3Layer.js"); |
| 108 | + inputScript('https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet.d3Layer/leaflet-d3Layer.js'); |
106 | 109 | }
|
107 | 110 | if (inArray(includes, 'osmbuildings')) {
|
108 |
| - inputScript("https://iclient.supermap.io/web/libs/osmbuildings/OSMBuildings-Leaflet.js"); |
| 111 | + inputScript('https://iclient.supermap.io/web/libs/osmbuildings/OSMBuildings-Leaflet.js'); |
109 | 112 | }
|
110 | 113 | if (inArray(includes, 'leaflet-icon-pulse')) {
|
111 |
| - inputCSS("https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet-icon-pulse/L.Icon.Pulse.css"); |
112 |
| - inputScript("https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet-icon-pulse/L.Icon.Pulse.js"); |
| 114 | + inputCSS('https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet-icon-pulse/L.Icon.Pulse.css'); |
| 115 | + inputScript('https://iclient.supermap.io/web/libs/leaflet/plugins/leaflet-icon-pulse/L.Icon.Pulse.js'); |
113 | 116 | }
|
114 | 117 | if (inArray(includes, 'deck')) {
|
115 |
| - inputScript("https://iclient.supermap.io/web/libs/deck.gl/5.1.3/deck.gl.min.js"); |
| 118 | + inputScript('https://iclient.supermap.io/web/libs/deck.gl/5.1.3/deck.gl.min.js'); |
116 | 119 | }
|
117 | 120 | if (inArray(includes, 'pixi')) {
|
118 | 121 | inputScript('https://cdn.bootcss.com/pixi.js/4.8.7/pixi.js');
|
119 | 122 | inputScript('https://cdn.jsdelivr.net/npm/leaflet-pixi-overlay@1.8.1/L.PixiOverlay.min.js');
|
120 |
| - inputScript('https://iclient.supermap.io/web/libs/leaflet/plugins/Leaflet.PixiOverlay/1.8.1/MarkerContainer.js'); |
| 123 | + inputScript( |
| 124 | + 'https://iclient.supermap.io/web/libs/leaflet/plugins/Leaflet.PixiOverlay/1.8.1/MarkerContainer.js' |
| 125 | + ); |
121 | 126 | inputScript('https://iclient.supermap.io/web/libs/bezier-easing/2.1.0/bezier-easing.js');
|
122 |
| - } |
| 127 | + } |
123 | 128 |
|
124 | 129 | // iclient
|
125 | 130 | if (!inArray(excludes, 'iclient-leaflet')) {
|
126 |
| - if (supportES6()) { |
127 |
| - inputScript("../../dist/leaflet/iclient-leaflet-es6.min.js"); |
128 |
| - } else { |
129 |
| - inputScript("../../dist/leaflet/iclient-leaflet.min.js"); |
130 |
| - } |
| 131 | + if (supportES6()) { |
| 132 | + inputScript('../../dist/leaflet/iclient-leaflet-es6.min.js'); |
| 133 | + } else { |
| 134 | + inputScript('../../dist/leaflet/iclient-leaflet.min.js'); |
| 135 | + } |
131 | 136 | }
|
132 | 137 | if (inArray(includes, 'iclient-leaflet-css')) {
|
133 |
| - inputCSS("../../dist/leaflet/iclient-leaflet.min.css"); |
| 138 | + inputCSS('../../dist/leaflet/iclient-leaflet.min.css'); |
134 | 139 | }
|
135 | 140 | if (inArray(includes, 'iclient-plot-leaflet')) {
|
136 |
| - inputCSS("https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet.css"); |
| 141 | + inputCSS('https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet.css'); |
137 | 142 | if (supportES6()) {
|
138 |
| - inputScript("https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet-es6.min.js"); |
| 143 | + inputScript( |
| 144 | + 'https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet-es6.min.js' |
| 145 | + ); |
139 | 146 | } else {
|
140 |
| - inputScript("https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet.min.js"); |
| 147 | + inputScript('https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet.min.js'); |
141 | 148 | }
|
142 | 149 | }
|
143 | 150 | if (inArray(includes, 'ant-design-vue')) {
|
144 |
| - inputCSS("https://cdn.jsdelivr.net/npm/ant-design-vue@1.3.9/dist/antd.min.css"); |
145 |
| - inputScript("https://cdn.jsdelivr.net/npm/ant-design-vue@1.3.9/dist/antd.min.js"); |
| 151 | + inputCSS('https://cdn.jsdelivr.net/npm/ant-design-vue@1.3.9/dist/antd.min.css'); |
| 152 | + inputScript('https://cdn.jsdelivr.net/npm/ant-design-vue@1.3.9/dist/antd.min.js'); |
146 | 153 | }
|
147 | 154 | if (inArray(includes, 'echarts-vue')) {
|
148 |
| - inputScript('https://cdn.jsdelivr.net/npm/echarts@4.5.0/dist/echarts.min.js'); |
149 |
| - inputScript("https://cdn.jsdelivr.net/npm/vue-echarts@4.0.4/dist/vue-echarts.min.js"); |
150 |
| - inputScript("https://iclient.supermap.io/web/libs/echarts-liquidfill/echarts-liquidfill.min.js"); |
151 |
| - inputScript("https://iclient.supermap.io/web/libs/echartsLayer/EchartsLayer.min.js"); |
| 155 | + inputScript('https://cdn.jsdelivr.net/npm/echarts@4.9.0/dist/echarts.min.js'); |
| 156 | + inputScript('https://cdn.jsdelivr.net/npm/vue-echarts@4.1.0/dist/vue-echarts.min.js'); |
| 157 | + inputScript('https://cdn.jsdelivr.net/npm/echarts-liquidfill@2.0.6/dist/echarts-liquidfill.min.js'); |
| 158 | + inputScript('https://iclient.supermap.io/web/libs/echartsLayer/EchartsLayer.min.js'); |
152 | 159 | }
|
153 | 160 | if (inArray(includes, 'iclient-leaflet-vue')) {
|
154 |
| - inputCSS("../../dist/leaflet/iclient-leaflet-vue.css"); |
155 |
| - inputScript("../../dist/leaflet/iclient-leaflet-vue.min.js"); |
| 161 | + inputCSS('../../dist/leaflet/iclient-leaflet-vue.css'); |
| 162 | + inputScript('../../dist/leaflet/iclient-leaflet-vue.min.js'); |
156 | 163 | }
|
157 | 164 | }
|
158 | 165 |
|
159 |
| - |
160 | 166 | load();
|
161 | 167 | window.isLocal = false;
|
162 |
| - window.server = document.location.toString().match(/file:\/\//) ? "http://localhost:8090" : document.location.protocol + "//" + document.location.host; |
| 168 | + window.server = document.location.toString().match(/file:\/\//) |
| 169 | + ? 'http://localhost:8090' |
| 170 | + : document.location.protocol + '//' + document.location.host; |
163 | 171 | })();
|
0 commit comments