|
19 | 19 | var css = '<link rel="stylesheet" href="' + url + '">'; |
20 | 20 | document.writeln(css); |
21 | 21 | } |
22 | | - Array.prototype.contains = function ( needle ) { |
23 | | - for (i in this) { |
24 | | - if (this[i] == needle){ |
| 22 | + function inArray(arr,item){ |
| 23 | + for (i in arr) { |
| 24 | + if (arr[i] == item){ |
25 | 25 | return true; |
26 | 26 | } |
27 | 27 | } |
|
31 | 31 | function load() { |
32 | 32 | var includes=(targetScript.getAttribute('include')||"").split(","); |
33 | 33 | var excludes=(targetScript.getAttribute('exclude')||"").split(","); |
34 | | - if(!excludes.contains('mapbox-gl')) { |
| 34 | + if(!inArray(excludes,'mapbox-gl')) { |
35 | 35 | inputCSS("https://cdn.bootcss.com/mapbox-gl/0.39.1/mapbox-gl.css"); |
36 | 36 | inputScript("https://cdn.bootcss.com/mapbox-gl/0.39.1/mapbox-gl.js"); |
37 | 37 | } |
38 | | - if(includes.contains('mapv')){ |
| 38 | + if(inArray(includes,'mapv')){ |
39 | 39 | inputScript("http://mapv.baidu.com/build/mapv.min.js"); |
40 | 40 | } |
41 | | - if(!excludes.contains('iclient9-mapboxgl')) { |
| 41 | + if(!inArray(excludes,'iclient9-mapboxgl')) { |
42 | 42 | inputScript("../../dist/iclient9-mapboxgl.min.js"); |
43 | 43 | } |
44 | | - if(includes.contains('echarts')){ |
| 44 | + if(inArray(includes,'echarts')){ |
45 | 45 | inputScript("http://cdn.bootcss.com/echarts/3.6.2/echarts.min.js"); |
46 | 46 | inputScript("http://iclient.supermapol.com/libs/echartsLayer/EchartsLayer.js"); |
47 | 47 | } |
48 | | - if(includes.contains('proj4')){ |
| 48 | + if(inArray(includes,'proj4')){ |
49 | 49 | inputScript("https://cdn.bootcss.com/proj4js/2.4.3/proj4.js"); |
50 | 50 | } |
51 | 51 | } |
|
0 commit comments