6

I was just browsing some Stack Exchange sites the other day, when I thought about how nice it would be to have a little information bubble every time I get a new thing in my SE inbox.

I already have a plan as to how this would be implemented, I just need somebody who is willing to do the legwork and write up the JavaScript to do this.

The Plan:

Write up a Greasemonkey/Scriptish script that would:

  1. Enable Desktop Notifications, if necessary, even in Firefox, not just Chrome.
  2. Check your SE Inbox
  3. Make a list of everything unread
  4. If it's larger than last time, display the appropriate notification(s).

It needs not to mess up even if there are multiple SE sites open at the same time.
The XSS required to do this is the real problem, so I need some way to do that. I also just need some help fleshing out the script altogether. I'm not very skilled at JavaScript, but I suppose that, given enough time, I could complete it by myself, after the major hurdles are passed...

What I'd really like, though, would be if somebody would take a moment and whip up a Greasemonkey script for this. That would be very much appreciated. I would really, truly be grateful for that.

The reason I want a Greasemonkey script is so I can use this in Firefox. See HTML5 Notifications for Firefox extension to learn more about how desktop notifications are enabled in Firefox.

4
  • 1
    There's this if you're a Chrome user: meta.stackexchange.com/questions/156050/…
    – Adam Lear StaffMod
    Commented Dec 4, 2012 at 5:15
  • Oh, yeah, I forgot to mention: I'm a Firefox user, but I do have an addon that replicates Chrome/Chromium's Desktop Notification functionality. As long as I can get somebody to write up a Greasemonkey script for me that will create the notifications, then I'll be happy. Commented Dec 4, 2012 at 5:30
  • Not to be "that guy", but why not just use Chrome to browse Stack Exchange? I'm not saying "stop using Firefox" just that some browsers work better for different uses. :) Disclaimer: I use both browsers regularly. Also, do you have a link to the FF add-on you're talking about?
    – jmort253
    Commented Dec 4, 2012 at 5:37
  • Oh, yeah, no worries about being "that guy." ;) I actually use both browsers regularly myself; I recently reinstalled my OS, and haven't gotten around to installing Chromium yet. (I did get FF Nightly installed, though.) I generally use my FF Nightly (as opposed to Chromium) for most of my browsing, which brings me to the part where I give you the link to that Firefox add-on: code.google.com/p/ff-html5notifications Enjoy! Commented Dec 4, 2012 at 5:51

1 Answer 1

2

I'm not sure a Greasemonkey script would be the right tool for the job, given the cross-scripting constraints and multiple tabs. I speak from experience, as StackInbox, a Chrome extension I wrote to preserve unread messages in the global inbox, started out as a Userscript.

Because there's no way to share data across different subdomains, I converted it to a Chrome extension and am working on finalizing a Firefox extension version as well. This allows me to save global inbox data first retrieved in, let's say, Meta Stack Overflow, and make sure the user sees the same data on some other Stack Exchange site.

Additionally, when it comes to extensions and pushing out desktop notifications, the extension platforms would be able to provide for a much more robust solution. For instance, both Chrome and Firefox have API's one can use to ensure code only runs in the active tab. Therefore, your code could grab data from the inbox, then send it to the background page, and let the background page do the final filtering to ensure only 1 notification is fired instead of 1 for all 20 tabs you have open. ;)

What's more, the ff-htmlf5notifications extension just simply implements window.webkitNotifications, so the same concrete implementation for Chrome would also work for Firefox with ff-html5notifications installed. So, I'd be tempted to take the lazy route and implement the Stack Exchange extension using ff-html5notifications as a dependency. We're all hackers here, so it wouldn't be overly complex for the installation instructions to say as step 1 to install the other extension. It would also make maintenance easier since there's already a developer maintaining the HTML5 notification extension.

This is the approach that I would take, and adding HTML5 notifications to StackInbox would probably be easier than starting from scratch.

3
  • Cool. Do we have an ETA on the Firefox extension? I'd be willing to help out and be a Beta tester (not an Alpha tester; I don't want to get in trouble because a typo in a for loop ended up pinging me for an attempted DDOS,) so (it it's relatively stable) can you send me the in-progress .xpi file? I'd like to help iron out the bugs. Commented Dec 4, 2012 at 6:22
  • Awesome, you can contact me using LoopTodo, using the feedback link in the bottom of my profile. Give me some time to clean up the code and get it into version control, as it's 11:30PM here and I need to get to bed ;)
    – jmort253
    Commented Dec 4, 2012 at 6:34
  • @jmort253 I have implemented desktop notifications in a Firefox add-on as well, using the SDK's Notifications module. My add-on's source code can be found at github.com/Rob--W/stackexchange-notifications/tree/master/….
    – Rob W
    Commented Dec 10, 2012 at 15:07

Not the answer you're looking for? Browse other questions tagged .