diff --git a/README.md b/README.md index d3d646c..e147618 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Optional properties include - **ttl** : time to live, how long an individual marker stays on map in seconds (overrides general maxage setting, minimum 20 seconds) - **photoUrl** : adds an image pointed at by the url to the popup box. - **videoUrl** : adds an mp4 video pointed at by the url to the popup box. Ideally 320x240 in size. - - **weblink** : adds a link to an external page for more information. Either set a url as a *string*, or an *object* like `{"name":"BBC News", "url":"https://news.bbc.co.uk", "target":"_new"}` + - **weblink** : adds a link to an external page. Either set a url as a *string*, or an *object* like `{"name":"BBC News", "url":"https://news.bbc.co.uk", "target":"_new"}`, or multiple links with an *array of objects* `[{"name":"BBC News", "url":"https://news.bbc.co.uk", "target":"_new"},{"name":"node-red", "url":"https://nodered.org", "target":"_new"}]` - **addtoheatmap** : set to false to exclude point from contributing to the heatmap layer. (default true) - **intensity** : set to a value of 0.1 - 1.0 to set the intensity of the point on the heatmap layer. (default 1.0) - **popped** : set to true to automatically open the popup info box, set to false to close it. diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 728505e..2ebbdbb 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -1734,11 +1734,22 @@ function setMarker(data) { marker.ts = parseInt(Date.now()/1000) + Number(maxage); } if (data.hasOwnProperty("weblink")) { - if (typeof data.weblink === "string") { - words += "more information...
"; + if (!Array.isArray(data.weblink) || !data.weblink.length) { + if (typeof data.weblink === "string") { + words += "more information...
"; + } else { + var tgt = data.weblink.target || "_new"; + words += "" + data.weblink.name + "
"; + } } else { - var tgt = data.weblink.target || "_new"; - words += "" + data.weblink.name + "
"; + data.weblink.forEach(function(weblink){ + if (typeof weblink === "string") { + words += "more information...
"; + } else { + var tgt = weblink.target || "_new"; + words += "" + weblink.name + "
"; + } + }); } delete data.weblink; }