Skip to content

Instantly share code, notes, and snippets.

@user890104
Created January 16, 2018 17:43
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 user890104/0953178e77ff854c420c194c5d64d9c5 to your computer and use it in GitHub Desktop.
Save user890104/0953178e77ff854c420c194c5d64d9c5 to your computer and use it in GitHub Desktop.
// run in console
// enable popups for website first
if (!('lastLat' in window)) {
window.lastLat = 0;
}
if (!('lastLon' in window)) {
window.lastLon = 0;
}
setInterval(function() {
$.getJSON(location.href.replace('/tracking', '/status')).then(function(data){
if (!data.courier){
console.log('no courier');
return;
}
console.log(lastLat,data.courier.latitude,lastLon,data.courier.longitude);
if (lastLat != data.courier.latitude || lastLon != data.courier.longitude) {
console.log('location changed');
window.open('https://maps.google.com/?q=loc:' + data.courier.latitude + ',' + data.courier.longitude, 'gMapsWin');
}
else {
console.log('location unchanged');
}
window.lastLat = data.courier.latitude;
window.lastLon = data.courier.longitude;
});
}, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment