2019-06-11 16:01:16 +03:00
|
|
|
import AbstractIconOverlay from './AbstractIconOverlay.js';
|
2020-04-29 22:51:09 +03:00
|
|
|
import {HtmlSanitizer} from '../../lib/HtmlSanitizer.js';
|
|
|
|
|
2019-02-07 09:56:52 +03:00
|
|
|
|
2019-06-11 16:01:16 +03:00
|
|
|
export default AbstractIconOverlay.extend({
|
2019-09-18 12:53:58 +03:00
|
|
|
initialize: function() {
|
|
|
|
AbstractIconOverlay.prototype.initialize.call(this, "poi");
|
2019-02-07 09:56:52 +03:00
|
|
|
},
|
|
|
|
|
2019-05-02 12:09:29 +03:00
|
|
|
getIcon: function(obj){
|
|
|
|
return L.AwesomeMarkers.icon({
|
|
|
|
icon: obj.attributes.icon || "home",
|
|
|
|
prefix: "fa",
|
|
|
|
markerColor: obj.attributes.color || "blue"
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-03-31 19:19:41 +03:00
|
|
|
getMaxDisplayedZoom: function(){
|
|
|
|
return 5;
|
|
|
|
},
|
|
|
|
|
2019-02-07 09:56:52 +03:00
|
|
|
createPopup: function(poi){
|
2024-06-28 17:32:59 +03:00
|
|
|
var innerHTML = "";
|
2020-04-29 22:51:09 +03:00
|
|
|
|
2024-06-28 17:32:59 +03:00
|
|
|
if (poi.attributes.url) {
|
|
|
|
innerHTML += "<a href=\"" + HtmlSanitizer.SanitizeHtml(poi.attributes.url) + "\">" +
|
|
|
|
"<h4>" + HtmlSanitizer.SanitizeHtml(poi.attributes.name) + "</h4></a>";
|
|
|
|
} else {
|
|
|
|
innerHTML += "<h4>" + HtmlSanitizer.SanitizeHtml(poi.attributes.name) + "</h4>";
|
2020-04-28 14:50:36 +03:00
|
|
|
}
|
2024-06-28 17:32:59 +03:00
|
|
|
|
|
|
|
if (poi.attributes.image) {
|
|
|
|
innerHTML += "<img class=\"poi_image\" src=\"" + HtmlSanitizer.SanitizeHtml(poi.attributes.image) +
|
|
|
|
"\" crossorigin=\"anonymous\" referrerpolicy=\"origin-when-cross-origin\">";
|
2020-04-28 14:50:36 +03:00
|
|
|
}
|
2024-06-28 17:32:59 +03:00
|
|
|
|
|
|
|
innerHTML += "<hr><b>Owner: </b> " + HtmlSanitizer.SanitizeHtml(poi.attributes.owner) + "<br>";
|
|
|
|
|
|
|
|
return innerHTML;
|
2019-02-07 09:56:52 +03:00
|
|
|
}
|
2020-04-29 22:51:09 +03:00
|
|
|
|
|
|
|
|
2019-02-07 09:56:52 +03:00
|
|
|
});
|