Skip to content

Instantly share code, notes, and snippets.

@youpy
Created September 5, 2011 05:01
Show Gist options
  • Save youpy/1194127 to your computer and use it in GitHub Desktop.
Save youpy/1194127 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Google Latitude: Notify Location
// @namespace http://buycheapviagraonlinenow.com/
// @include https://www.google.com/latitude/*
// ==/UserScript==
var notifyServerUrl = 'http://localhost:5678/', // https://gist.github.com/1021283
location = {}, lastLocation = {};
setInterval(function() {
var profiles = document.querySelectorAll('.friendprofile');
if(profiles.length > 0) {
Array.forEach(profiles, function(profile) {
var id = profile.querySelector('img.active').id.replace(/_photo$/, '');
var elem = profile.querySelector('.reversegeocode');
location[id] = elem.textContent;
if(!lastLocation[id] || location[id] != lastLocation[id]) {
notify(id + ': ' + location[id]);
lastLocation[id] = location[id];
}
});
}
}, 5000);
function notify(msg) {
document.createElement('img')
.src = notifyServerUrl + '?text=' + encodeURIComponent(msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment