Commit db65a851fa6d7c8f6ad0b8805c8e138f2d995497

Authored by Andrea Petta
1 parent 7f299165

leafletjs

datalets/leafletjs-datalet/leafletjs-datalet.html
... ... @@ -103,10 +103,16 @@ Example:
103 103  
104 104 if(t.data.length > 2)
105 105 {
106   - if(t.data[t.data.length - 1].data[i].toString().match(new RegExp("^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?")))
107   - var popup = L.popup().setContent('<image height="100" width="100" src="' + t.data[t.data.length - 1].data[i] + '" />');
108   - else
109   - var popup = L.popup().setContent('<span>' + t.data[t.data.length - 1].data[i] + '</span>');
  106 + var popupText = "";
  107 + for(var j=2; j<t.data.length; j++)
  108 + {
  109 + if(t.data[j].data[i].toString().match(new RegExp("^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?")))
  110 + popupText += '<image height="100" width="100" src="' + t.data[j].data[i] + '" /><br/>';
  111 + else
  112 + popupText += '<span>' + t.data[j].data[i] + '</span><br/>'
  113 + }
  114 +
  115 + var popup = L.popup().setContent(popupText);
110 116 marker.bindPopup(popup);
111 117 }
112 118 }
... ...