Commit 04b21afb38daea002458a2571ddbc66dca3a595c
1 parent
35c4a6d8
leafletjs-datlet update
Showing
1 changed file
with
5 additions
and
2 deletions
datalets/leafletjs-datalet/leafletjs-datalet.html
... | ... | @@ -80,9 +80,12 @@ Example: |
80 | 80 | |
81 | 81 | var marker = L.marker([coordinates[i][0], coordinates[i][1]]).addTo(this._component.map); |
82 | 82 | |
83 | - if(this.data[2]) | |
83 | + if(this.data.length > 1) | |
84 | 84 | { |
85 | - var popup = L.popup().setContent('<image height="100" width="100" src="' + this.data[2].data[i] + '" />'); | |
85 | + if(this.data[this.data.length - 1].data[i].match(new RegExp("^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?"))) | |
86 | + var popup = L.popup().setContent('<image height="100" width="100" src="' + this.data[this.data.length - 1].data[i] + '" />'); | |
87 | + else | |
88 | + var popup = L.popup().setContent('<span>' + this.data[this.data.length - 1].data[i] + '</span>'); | |
86 | 89 | marker.bindPopup(popup); |
87 | 90 | } |
88 | 91 | } | ... | ... |