Permalink
Browse files

fbnotify initial commit and README changes

  • Loading branch information...
1 parent 51f3b7b commit e5dcef4d53477bc1bc27ab839c1aa56e1e46cb0a Tom Robinson committed Sep 17, 2008
Showing with 57 additions and 0 deletions.
  1. +3 −0 fbnotify/README
  2. +50 −0 fbnotify/fbnotify.js
  3. +4 −0 growlbridge/README
View
@@ -0,0 +1,3 @@
+http://tlrobinson.net/blog/?p=48
+
+Requires growlbridge.py
View
@@ -0,0 +1,50 @@
+// ==UserScript==
+// @name Facebook News Feed Notifier
+// @namespace http://tlrobinson.net/
+// @description Notify user of new Facebook News Feed items via Growl
+// @include http://*.facebook.com/home.php
+// ==/UserScript==
+
+function GM_init()
+{
+ var fbNewsFeedNotification = new Growl.NotificationType("Facebook News Feed", true);
+ Growl.register("Facebook", [fbNewsFeedNotification]);
+
+ unsafeWindow.HomeFeed.prototype._addStoriesToQueueOriginal = unsafeWindow.HomeFeed.prototype._addStoriesToQueue
+ unsafeWindow.HomeFeed.prototype._addStoriesToQueue = function(stories) {
+ this._addStoriesToQueueOriginal(stories);
+
+ var testDiv = document.createElement("div");
+ for (var i = 0; i < stories.length; i++)
+ {
+ testDiv.innerHTML = stories[i];
+ var spans = testDiv.getElementsByTagName("span");
+
+ var message = (spans.length > 0) ? spans[0].textContent : "Unknown update";
+
+ Growl.notify(fbNewsFeedNotification, "Facebook News Feed", message, Growl.Priority.Normal, false);
+ }
+ }
+}
+
+// Add growl.js
+var GM_GROWL = document.createElement(’script’);
+GM_GROWL.src = ‘http://www.tripthevortex.com/growl/growl.js’;
+GM_GROWL.type = ‘text/javascript’;
+document.getElementsByTagName(‘head’)[0].appendChild(GM_GROWL);
+
+// Check if growl.js’s loaded
+function GM_wait()
+{
+ if (typeof unsafeWindow.Growl ==undefined’)
+ {
+ console.log("waiting");
+ window.setTimeout(GM_wait, 100);
+ }
+ else
+ {
+ Growl = unsafeWindow.Growl;
+ GM_init();
+ }
+}
+GM_wait();
View
@@ -0,0 +1,4 @@
+http://tlrobinson.net/blog/?p=48
+
+Requires netgrowl and simplejson
+

0 comments on commit e5dcef4

Please sign in to comment.