-
-
Save anonymous/9d1f162a36a4a0c925136b394697fd0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--fire base declaration--> | |
<script src="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; | |
function getNotify(){ | |
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++; | |
}); | |
} | |
function getUserData(){ | |
} | |
// 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--> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<title>Untitled Document</title> | |
<link rel="stylesheet" href="css/style.css" type="text/css"/> | |
</head> | |
<body onLoad=""> | |
<img src="Images/Notify.png" style="position:absolute;width:50px;height:50px;left:95%;top:5%"/> | |
<div style="margin-top:0.8%;float:right;margin-right:2.5%"><span class="badge" style="font-size:20px" id="notification" onClick="makeRead();">0</span></div><br> | |
<div class="Right_notice"> | |
<ul class="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> | |
<div class="middle"> | |
<section class="satellite" onClick="satellite"> | |
<a href="Admin_Index.php"><h3> Satellite Map </h3></a> | |
</section> | |
<section class="fire" onClick="fire"> | |
<a href="FileFighter.php"><h3> Fire Fighter </h3></a> | |
</section> | |
<section class="user_map" onClick="user"> | |
<a href="user.php"><h3> User </h3></a> | |
</section> | |
</div> | |
</div> | |
<div class="Left_side"> | |
<img src="Images/Logo.png" height="100" width="200"/> | |
<div class="user"> | |
<img src="Images/user.png" width="50" height="50"/> | |
<h3> User Name </h3> | |
</div> | |
<div class="detail"> | |
<ul> | |
<li><a href="#"> Item One </a></li> | |
<li><a href="#"> Item Two </a></li> | |
<li><a href="#" > Item Three </a></li> | |
<li><a href="#"> Item four </a></li> | |
<li><a href="#"> Item Five </a></li> | |
</ul> | |
</div> | |
</div> | |
<div id="map"></div> | |
<script> | |
function initMap() { | |
var map = new google.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 = new google.maps.Marker({ | |
position: {lat: parseInt(lat1), lng: parseInt(long1)}, | |
map: map, | |
icon: image | |
}); | |
}); | |
}, function (error) { | |
console.log("Error: " + error.code); | |
}); | |
//riffat end | |
} | |
</script> | |
<script src="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 | |
--> | |
<button onClick="writeUserData();">dsgdsg</button> | |
<button onClick="child_added();">added</button> | |
<p id="data"></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment