Skip to content

Instantly share code, notes, and snippets.

@aaronlidman
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronlidman/8908291 to your computer and use it in GitHub Desktop.
Save aaronlidman/8908291 to your computer and use it in GitHub Desktop.
IRC problem
<script>
var map = L.mapbox.map('map', 'examples.map-9ijuk24y')
.setView([38.9880463, -76.9442844], 15),
markers;
$.getJSON("jsonRetrieval.php", function (data) {
markers = L.geoJson(data, {
onEachFeature: onEachFeature
}).addTo(map);
});
function onEachFeature(feature, layer) {
layer.bindPopup('this is popup text');
}
markers.on('click', function(e){
console.log(e);
});
map.on('click',function(e){
document.getElementById('info').innerHTML = '';
});
//Get coordinates from click
var click = document.getElementById('click'),
mousemove = document.getElementById('mousemove');
map.on('click', function(e) {
//window[e.type].innerHTML = e.containerPoint.toString() + ', ' + e.latlng.toString();
var latLong = e.latlng.toString();
var replaceLatLng = latLong.replace("LatLng", "");
var replaceLeftParen = replaceLatLng.replace("(","");
var replaceRightParen = replaceLeftParen.replace(")","");
var removeSpace = replaceRightParen.replace(" ", "");
var positionArray = removeSpace.split(",");
document.getElementById("requiredlatitude").value = positionArray[0];
document.getElementById("requiredlongitude").value = positionArray[1];
});
$(document).ready(function() {
$('#addEventMenu').sidr({
name: 'sidr-left',
side: 'left'
}); // initialize left side menu
});
//initilize date
$(function() {
$( "#requiredstartDate" ).datepicker();
$( "#requiredendDate" ).datepicker();
$( "#requiredstarttime" ).timepicker({
timeFormat: "hh:mm:ss TT"//,
//controlType: 'select'
});
$( "#requiredendtime" ).timepicker({
timeFormat: "hh:mm:ss TT"//,
//controlType: 'select'
});
});
//REQUIRED vs OPTIONAL
function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("One or more of the required elements are not completed. Please complete them, then submit again!")
return false
}
else
return true
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment