<!--fire base declaration--> | |
<scriptsrc="https://www.gstatic.com/firebasejs/3.9.0/firebase.js"></script> | |
<script> | |
// Initialize Firebase | |
var config = { | |
apiKey:"AIzaSyDB4Ix9qbTR0lwbUOeQhr7XZqZUPIq7uTI", | |
authDomain:"fire-fighter-b8ba2.firebaseapp.com", | |
databaseURL:"https://fire-fighter-b8ba2.firebaseio.com", | |
projectId:"fire-fighter-b8ba2", | |
storageBucket:"fire-fighter-b8ba2.appspot.com", | |
messagingSenderId:"371108948933" | |
}; | |
firebase.initializeApp(config); | |
var database =firebase.database(); | |
// function readAllData(){ | |
// var ref = firebase.database().ref('NasaData/'); | |
// ref.limitToLast(10).on("value", function(snapshot) { | |
// snapshot.forEach(function(data) { | |
// var lat= data.val().Latitude; | |
// var long1= data.val().Longitude; | |
// }); | |
// }, function (error) { | |
// console.log("Error: " + error.code); | |
// }); | |
// } | |
var count=0; | |
functiongetNotify(){ | |
var playersRef =firebase.database().ref("user/"); | |
playersRef.on("child_added", function(data, prevChildKey) { | |
var newPlayer =data.val(); | |
console.log("name: "+newPlayer.name); | |
console.log("Latitude "+newPlayer.Latitude); | |
console.log("Longitude "+newPlayer.Longitude); | |
console.log("Previous Player: "+ prevChildKey); | |
document.getElementById('notification').innerHTML=count++; | |
}); | |
} | |
functiongetUserData(){ | |
} | |
// function writeUserData() { | |
// firebase.database().ref('locationDetail2/').push({ | |
// name:"riffat", | |
// latPoint: "11", | |
// longPoint: "22", | |
// status:"unread" | |
// }); | |
// } | |
// var count=0; | |
// var arr=new Array(); | |
// function child_added(){ | |
// var ref = firebase.database().ref("locationDetail2/"); | |
// ref.orderByChild("status").equalTo("unread").once("value", function(snapshot) { | |
// /* snapshot.forEach(function(childSnapshot) { | |
// */ | |
// document.getElementById('notification').innerHTML=snapshot.numChildren(); | |
// /* | |
// console.log(childSnapshot.val()); | |
// //document.getElementById('notification').innerHTML=childSnapshot.val().name+" "; | |
// count=childSnapshot.length; | |
// }); | |
// */ | |
// }); | |
// //document.getElementById('notification').innerHTML=count; | |
//} | |
</script> | |
<!--fire ase declaration--> | |
<metaname="viewport"content="width=device-width, initial-scale=1"> | |
<linkrel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | |
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<htmlxmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<metahttp-equiv="Content-Type"content="text/html; charset=utf-8" /> | |
<metaname="viewport"content="initial-scale=1.0, user-scalable=no"> | |
<title>Untitled Document</title> | |
<linkrel="stylesheet"href="css/style.css"type="text/css"/> | |
</head> | |
<bodyonLoad=""> | |
<imgsrc="Images/Notify.png"style="position:absolute;width:50px;height:50px;left:95%;top:5%"/> | |
<divstyle="margin-top:0.8%;float:right;margin-right:2.5%"><spanclass="badge"style="font-size:20px"id="notification"onClick="makeRead();">0</span></div><br> | |
<divclass="Right_notice"> | |
<ulclass="resources_det"> | |
<li> No of Equiments ...... 25</li> | |
<li> Avaible Equiments ...... 25</li> | |
<li> Populations ...... 25</li> | |
<li> Distance ...... 25</li> | |
<li> Fire Purpose ...... 25</li> | |
</ul> | |
</div> | |
<divclass="middle"> | |
<sectionclass="satellite"onClick="satellite"> | |
<ahref="Admin_Index.php"><h3> Satellite Map </h3></a> | |
</section> | |
<sectionclass="fire"onClick="fire"> | |
<ahref="FileFighter.php"><h3> Fire Fighter </h3></a> | |
</section> | |
<sectionclass="user_map"onClick="user"> | |
<ahref="user.php"><h3> User </h3></a> | |
</section> | |
</div> | |
</div> | |
<divclass="Left_side"> | |
<imgsrc="Images/Logo.png"height="100"width="200"/> | |
<divclass="user"> | |
<imgsrc="Images/user.png"width="50"height="50"/> | |
<h3> User Name </h3> | |
</div> | |
<divclass="detail"> | |
<ul> | |
<li><ahref="#"> Item One </a></li> | |
<li><ahref="#"> Item Two </a></li> | |
<li><ahref="#" > Item Three </a></li> | |
<li><ahref="#"> Item four </a></li> | |
<li><ahref="#"> Item Five </a></li> | |
</ul> | |
</div> | |
</div> | |
<divid="map"></div> | |
<script> | |
functioninitMap() { | |
var map =newgoogle.maps.Map(document.getElementById('map'), { | |
zoom:4, | |
center: {lat:-33, lng:151} | |
}); | |
var image ='images/fire.png'; | |
//riffat code | |
var ref =firebase.database().ref('NasaData/'); | |
ref.limitToFirst(10).on("value", function(snapshot) { | |
snapshot.forEach(function(data) { | |
var lat1=data.val().Latitude; | |
var long1=data.val().Longitude; | |
var beachMarker =newgoogle.maps.Marker({ | |
position: {lat:parseInt(lat1), lng:parseInt(long1)}, | |
map: map, | |
icon: image | |
}); | |
}); | |
}, function (error) { | |
console.log("Error: "+error.code); | |
}); | |
//riffat end | |
} | |
</script> | |
<scriptsrc="https://maps.googleapis.com/maps/api/js?key=AIzaSyB7NAjFqlgz-7mwhG7mEy76ER1U7xfyHa4&callback=initMap"> | |
</script> | |
<!-- | |
To use this code on your website, get a free API key from Google. | |
Read more at: https://www.w3schools.com/graphics/google_maps_basic.asp | |
--> | |
<buttononClick="writeUserData();">dsgdsg</button> | |
<buttononClick="child_added();">added</button> | |
<pid="data"></p> | |
</body> | |
</html> |
In Process
SpaceApps is a NASA incubator innovation program.