Created
September 5, 2011 05:01
-
-
Save youpy/1194127 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // ==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