(msg, olat, olong, sessid, icostr, expir, pokenick)
| 250 | } |
| 251 | |
| 252 | function displayMessageOnMap(msg, olat, olong, sessid, icostr, expir, pokenick) { |
| 253 | // @ro: passing values split from incoming payload into two variables for now (lat and long) |
| 254 | var newPosition = new google.maps.LatLng(olat, olong); |
| 255 | var msgSessionId = sessid; |
| 256 | var expiration = expir; |
| 257 | var pName = ''; |
| 258 | if(typeof pokenick === 'undefined'){ |
| 259 | var pName = " <i>just appeared! </i></b><br>lat: " + olat + " / long: " + olong; |
| 260 | } else { |
| 261 | var pName = "<b>" + pokenick + "</b><i> just appeared! </i></b><br>lat: " + olat + " / long: " + olong; |
| 262 | } |
| 263 | // console.log(pName); |
| 264 | // @ro: just checking the output |
| 265 | //console.log(olat); |
| 266 | //console.log(olong); |
| 267 | |
| 268 | // xss prevention hack |
| 269 | msg.text = html_sanitize(msg.text); |
| 270 | |
| 271 | msg.text = String(msg.text).replace(/[&<>"#'\/卐卍]/g, function (s) { |
| 272 | return entityMap[s]; |
| 273 | }); |
| 274 | |
| 275 | // msg.text = msg.text ? embedTweet(msg.text) : ""; |
| 276 | msg.text = msg.text.replace(/#(\S*)/g, '<a href="http://maps.pikabot.org/#$1" target="_blank">#$1</a>'); |
| 277 | |
| 278 | // linkify |
| 279 | msg.text = msg.text.replace( |
| 280 | /(\b(https?|ftp|file)://[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, |
| 281 | "<a target='_blank' href='$1'>$1</a>" |
| 282 | ); |
| 283 | |
| 284 | var icon = { url: icostr, scaledSize: new google.maps.Size(36, 36) }; |
| 285 | var markerMap = setupMarkerAndInfoWindow(msgSessionId, pName, newPosition, map, icon, icon); |
| 286 | var marker = markerMap.marker; |
| 287 | var infoWindow = markerMap.infoWindow; |
| 288 | |
| 289 | if (!markersMap[msgSessionId]) { // new marker |
| 290 | //disable it for now |
| 291 | //infoWindow.open(map, marker); |
| 292 | |
| 293 | var timeoutId = setTimeout(function () { infoWindow.close() }, 10000); |
| 294 | markersMap[msgSessionId] = { |
| 295 | marker: marker, |
| 296 | infoWindow: infoWindow, |
| 297 | timeoutId: timeoutId, |
| 298 | disabled: false |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | if (advanced) { |
| 303 | runAdvancedOptions(msg); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | function embedTweet(text) { |
| 308 | var tweetText = "Someone wrote " + text + " on "; |
no test coverage detected