11/* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
22 * This program are made available under the terms of the Apache License, Version 2.0
33 * 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-ol\ .js)(\\?|$)" ) ,
4+ ( function ( ) {
5+ var r = new RegExp ( ' (^|(.*?\\/))(include-ol.js)(\\?|$)' ) ,
66 s = document . getElementsByTagName ( 'script' ) ,
77 targetScript ;
88 for ( var i = 0 ; i < s . length ; i ++ ) {
3838 function supportES6 ( ) {
3939 var code = "'use strict'; class Foo {}; class Bar extends Foo {};" ;
4040 try {
41- ( new Function ( code ) ) ( ) ;
41+ new Function ( code ) ( ) ;
4242 } catch ( err ) {
4343 return false ;
4444 }
5050
5151 //加载类库资源文件
5252 function load ( ) {
53- var includes = ( targetScript . getAttribute ( 'include' ) || "" ) . split ( "," ) ;
54- var excludes = ( targetScript . getAttribute ( 'exclude' ) || "" ) . split ( "," ) ;
53+ var includes = ( targetScript . getAttribute ( 'include' ) || '' ) . split ( ',' ) ;
54+ var excludes = ( targetScript . getAttribute ( 'exclude' ) || '' ) . split ( ',' ) ;
5555 // 在线
5656 if ( ! inArray ( excludes , 'ol' ) && ! inArray ( includes , 'ol-debug' ) && ! inArray ( includes , 'ol@4.6.5' ) ) {
57- inputCSS ( " https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.1.1 /css/ol.css" ) ;
58- inputScript ( " https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.1.1 /build/ol.js" ) ;
57+ inputCSS ( ' https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3 /css/ol.css' ) ;
58+ inputScript ( ' https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3 /build/ol.js' ) ;
5959 }
60- if ( inArray ( includes , 'ol@4.6.5' ) ) {
61- inputCSS ( " https://cdn.bootcss.com/openlayers/4.6.5/ol.css" ) ;
62- inputScript ( " https://cdn.bootcss.com/openlayers/4.6.5/ol.js" ) ;
60+ if ( inArray ( includes , 'ol@4.6.5' ) ) {
61+ inputCSS ( ' https://cdn.bootcss.com/openlayers/4.6.5/ol.css' ) ;
62+ inputScript ( ' https://cdn.bootcss.com/openlayers/4.6.5/ol.js' ) ;
6363 }
6464 if ( inArray ( includes , 'ol-debug' ) ) {
65- inputCSS ( " https://cdn.bootcss.com/openlayers/4.6.5/ol-debug.css" ) ;
66- inputScript ( " https://cdn.bootcss.com/openlayers/4.6.5/ol-debug.js" ) ;
65+ inputCSS ( ' https://cdn.bootcss.com/openlayers/4.6.5/ol-debug.css' ) ;
66+ inputScript ( ' https://cdn.bootcss.com/openlayers/4.6.5/ol-debug.js' ) ;
6767 }
6868 if ( inArray ( includes , 'mapv' ) ) {
69- inputScript ( " https://cdn.jsdelivr.net/npm/mapv@2.0.56/build/mapv.min.js" ) ;
69+ inputScript ( ' https://cdn.jsdelivr.net/npm/mapv@2.0.56/build/mapv.min.js' ) ;
7070 }
7171 if ( inArray ( includes , 'turf' ) ) {
72- inputScript ( " https://cdn.bootcss.com/Turf.js/5.1.6/turf.min.js" ) ;
72+ inputScript ( ' https://cdn.bootcss.com/Turf.js/5.1.6/turf.min.js' ) ;
7373 }
7474 if ( inArray ( includes , 'echarts' ) ) {
75- inputScript ( 'https://cdn.jsdelivr.net/npm/echarts@4.9.0/dist/echarts.min.js' ) ;
75+ inputScript ( 'https://cdn.jsdelivr.net/npm/echarts@4.9.0/dist/echarts.min.js' ) ;
7676 }
7777 if ( inArray ( includes , 'proj4' ) ) {
78- inputScript ( 'https://cdn.bootcss.com/proj4js/2.6.2/proj4.js' ) ;
78+ inputScript ( 'https://cdn.bootcss.com/proj4js/2.6.2/proj4.js' ) ;
7979 }
8080 if ( inArray ( includes , 'ol3-echarts' ) ) {
81- inputScript ( " https://cdn.jsdelivr.net/npm/ol3-echarts@2.0.1 /dist/ol3Echarts.min.js" ) ;
81+ inputScript ( ' https://cdn.jsdelivr.net/npm/ol3-echarts@2.0.3 /dist/ol3Echarts.min.js' ) ;
8282 }
8383 if ( inArray ( includes , 'ol3-echarts@1.3.6' ) ) {
84- inputScript ( " https://cdn.jsdelivr.net/npm/ol3-echarts@1.3.6/dist/ol3Echarts.min.js" ) ;
84+ inputScript ( ' https://cdn.jsdelivr.net/npm/ol3-echarts@1.3.6/dist/ol3Echarts.min.js' ) ;
8585 }
8686 if ( inArray ( includes , 'ol-mapbox-style' ) ) {
87- inputScript ( " https://iclient.supermap.io/web/libs/openlayers/plugins/ol-mapbox-style/2.11.2/olms.js" ) ;
87+ inputScript ( ' https://iclient.supermap.io/web/libs/openlayers/plugins/ol-mapbox-style/2.11.2/olms.js' ) ;
8888 }
8989 if ( inArray ( includes , 'deck' ) ) {
90- inputScript ( " https://iclient.supermap.io/web/libs/deck.gl/5.1.3/deck.gl.min.js" ) ;
90+ inputScript ( ' https://iclient.supermap.io/web/libs/deck.gl/5.1.3/deck.gl.min.js' ) ;
9191 }
9292 if ( inArray ( includes , 'osmbuildings' ) ) {
93- inputScript ( " https://iclient.supermap.io/web/libs/osmbuildings/OSMBuildings-OL3.js" ) ;
93+ inputScript ( ' https://iclient.supermap.io/web/libs/osmbuildings/OSMBuildings-OL3.js' ) ;
9494 }
9595 if ( inArray ( includes , 'animatedclusterlayer' ) ) {
96- inputScript ( "https://iclient.supermap.io/web/libs/openlayers/plugins/animatedclusterlayer/animatedclusterlayer.js" ) ;
96+ inputScript (
97+ 'https://iclient.supermap.io/web/libs/openlayers/plugins/animatedclusterlayer/animatedclusterlayer.js'
98+ ) ;
9799 }
98100 if ( inArray ( includes , 'layerswitcher' ) ) {
99- inputCSS ( " https://iclient.supermap.io/web/libs/openlayers/plugins/ ol-layerswitcher/2.0 .0/ol-layerswitcher.css" ) ;
100- inputScript ( " https://iclient.supermap.io/web/libs/openlayers/plugins/ ol-layerswitcher/2.0 .0/ol-layerswitcher.js" ) ;
101+ inputCSS ( ' https://cdn.jsdelivr.net/npm/ ol-layerswitcher@3.6 .0/src/ ol-layerswitcher.css' ) ;
102+ inputScript ( ' https://cdn.jsdelivr.net/npm/ ol-layerswitcher@3.6 .0/dist/ ol-layerswitcher.min.js' ) ;
101103 }
102104 if ( inArray ( includes , 'jsonsql' ) ) {
103- inputScript ( " https://iclient.supermap.io/web/libs/jsonsql/jsonsql.js" ) ;
105+ inputScript ( ' https://iclient.supermap.io/web/libs/jsonsql/jsonsql.js' ) ;
104106 }
105107 if ( inArray ( includes , 'geostats' ) ) {
106- inputScript ( " https://iclient.supermap.io/web/libs/geostats/geostats.js" ) ;
108+ inputScript ( ' https://iclient.supermap.io/web/libs/geostats/geostats.js' ) ;
107109 }
108110 if ( inArray ( includes , 'canvg' ) ) {
109- inputScript ( " https://cdn.jsdelivr.net/npm/canvg@3.0.6/lib/umd.min.js" ) ;
111+ inputScript ( ' https://cdn.jsdelivr.net/npm/canvg@3.0.6/lib/umd.min.js' ) ;
110112 }
111-
113+
112114 // dist
113115 if ( ! inArray ( excludes , 'iclient-ol' ) ) {
114- if ( supportES6 ( ) ) {
115- inputScript ( " ../../dist/ol/iclient-ol-es6.min.js" ) ;
116- } else {
117- inputScript ( " ../../dist/ol/iclient-ol.min.js" ) ;
118- }
116+ if ( supportES6 ( ) ) {
117+ inputScript ( ' ../../dist/ol/iclient-ol-es6.min.js' ) ;
118+ } else {
119+ inputScript ( ' ../../dist/ol/iclient-ol.min.js' ) ;
120+ }
119121 }
120122 if ( ! inArray ( excludes , 'iclient-ol-css' ) ) {
121- inputCSS ( " ../../dist/ol/iclient-ol.min.css" ) ;
123+ inputCSS ( ' ../../dist/ol/iclient-ol.min.css' ) ;
122124 }
123125 }
124126
125127 load ( ) ;
126128 window . isLocal = false ;
127- window . server = document . location . toString ( ) . match ( / f i l e : \/ \/ / ) ? "http://localhost:8090" : document . location . protocol + "//" + document . location . host ;
128- } ) ( ) ;
129+ window . server = document . location . toString ( ) . match ( / f i l e : \/ \/ / )
130+ ? 'http://localhost:8090'
131+ : document . location . protocol + '//' + document . location . host ;
132+ } ) ( ) ;
0 commit comments