26

StackInbox Thumbnail 1.1

Screenshot / Code Snippet

Below is a screenshot of the inbox with two viewed yet unread messages:

Inbox Example Two Messages

About

Preserves new Stack Exchange Inbox messages until they are actually read, not just viewed in the inbox. Items appear in the global inbox as they normally would, but the only items marked as read are ones that you click on. If there are unread items in the inbox, but you've viewed the inbox already, the unread count is displayed in blue instead of red. This Chrome Extension was inspired by a Meta Stack Overflow feature request.

Stack Exchange Global Inbox with viewed, but unread items

Viewed, yet unread items, are indicated by a blue counter in lieu of the standard red counter.

When you click on the inbox to view the items, the unread items will never clear until they either scroll beyond the viewable window, or you click on them individually to view them. This is great for those times when you have a lot of unread items but only get a chance to view one or two before you get distracted and have to run.

Come back later, and your unread items are still marked so you can easily find them.

Because the development team is interested in avoiding bloat, anything that adds user preferences to the system or that adds more complexity is avoided. Thus, this extension gives this functionality to those who want it.

Newly received items are still indicated by the standard red counter, as displayed below:

One New Item With Viewed Yet Unread Items

License

This is licensed under the BSD License, but feel free to suggest something more permissive, if necessary.

Install from Chrome Web Store

The easiest way to get started is to Install StackInbox from the Chrome Web Store. Just click the "Add to Chrome" button on the top right.


Chrome Store Install Dialog


Install Firefox Extension from the Firefox Add-ons site

The Firefox extension is hosted on Mozilla Firefox's Add-ons site. Visit the site and click "Add to Firefox". When the dialog shown below appears, click "Install":

Install StackInbox for Firefox Dialog

Platform

The extension has been tested in Chrome Stable on Mac OS 10.9.1. However, it should work on Windows, Mac, and any Unix platform that can run Google Chrome or Chromium version 32.

In addition, you can download and install the Firefox version, which has been tested on Mac OS 10.9.1 in Firefox 27. It should work on Windows, Mac, and any Unix platform that can run Firefox.

Contact

StackInbox has moved to Github. Report bugs in this issue tracker. Additionally, I'm a regular Stack Exchange user and will respond to comments. I also hang out in the Project Management SE Chat room

Since there are two threads of development, one for Chrome and one for Firefox, please be sure to indicate which platform you're using when reporting issues.

Code

StackInbox is both a Chrome Extension as well as a Firefox Extension. See the StackInbox Github repo for more details.

Chrome

The Chrome Extension is developed using Chrome's extensions API and JavaScript. It uses Chrome Extension Storage to store unread inbox items and associate them with each Stack Exchange user who uses the computer the extension is installed in.

Firefox

The Firefox Extension uses the new Add-on SDK, formerly known as Jetpack, which facilitates rapid development of Firefox extensions without browser restarts between changes. It uses JavaScript, as well as the Mozilla Add-on SDK APIs.

Platform Details

The extension also uses the Stack Exchange 2.1 API to get the accountId associated with the user, which is used to link the global inbox across the different Stack Exchange sites.

I chose the extension platform over the simplicity of a Userscript because there was no way to share storage data across domains, since Stack Exchange disabled the ability to embed iframes in the site. I do have a Userscript version, but it lacked the ability to synchronize across the different sites as window.localStorage only operates on a single domain.

You can checkout the code from the StackInbox Github repository.

To contribute something, let me know and I can merge it, or fork the code yourself and submit a pull request. Also, if you wanted to support another browser, feel free to use this code to bootstrap another platform.

Known Issues

  • Chat messages do not clear from the inbox using "right click -> open in new tab" because there is nothing in the transcript pages to identify the specific account user viewing the transcript. To clear chat messages from the inbox, you must left-click on them directly.

  • Some Area 51 messages may not be cleared out with a "right click -> open in new tab" as the format of Area 51 is different than the rest of the network. I don't plan to support Area 51 until Stack Exchange rolls out "codename Area 52". To clear Area 51 notifications, left-click on them directly. The Discussion section of Area 51 is not affected.

  • ****FIXED**** The unread count sometimes disappears on a page that has been loaded for sometime. Stack Exchange updates the unread count via the WebSockets connection, which clears the number if there is nothing new. Once you refresh the page or navigate to another page, you'll see your unread count in blue.

10
  • 1
    @Jonathan - I agree. But SE isn't going to do it, at least that's what Jeff said. Maybe they might do it if this gets a lot of usage. Some add-ons do eventually make their way into the core system.
    – jmort253
    Nov 22, 2012 at 0:19
  • Your extension does not run on the meta sites of http://*.stackexchange.com/* sites. (For example: http://meta.bicycles.stackexchange.com/) Nov 22, 2012 at 17:05
  • @user2428118 - I just tried on meta.bicycles, and I don't see a problem. You could edit the stackInbox.js file in the extension and replaceAll '//console' with 'console' and that will let you see the logs and/or send them to me. However, I just noticed you don't have an account on bicycles SE! Are you logging into Bicycles using another account?
    – jmort253
    Nov 23, 2012 at 1:19
  • I was checking the source code directly, actually. Because of my experience with userscripts, I thought the script would only run on @included locations. I forgot to check the manifest file. Sorry. Nov 23, 2012 at 11:40
  • @user2428118 - I should probably edit out the userscript headers, since I converted this to a Chrome Extension. This would eliminate confusion. With that said, I still have my original userscript and am thinking of including it here. It's not as good as the extension since the inbox data can't be shared across the different SE sites due to same-domain policy...
    – jmort253
    Nov 23, 2012 at 15:41
  • Does this work with the new inbox top bar thingie?
    – terdon
    Jan 14, 2014 at 23:59
  • Hey @terdon, I'm still working on updating this, but if you have Chrome/Chromium, you can checkout from github.com/jamesmortensen/stackInbox and then run unpacked from the extensions folder. If a week goes by without any major issues, I'll publish to the Chrome Web store and update this post. Hope this helps.
    – jmort253
    Feb 17, 2014 at 0:20
  • @terdon - This is live for both Chrome and Firefox.
    – jmort253
    Feb 22, 2014 at 10:02
  • 1
    A nice idea, but middle click on an unread item opens it in the same tab (Chrome 33). This makes it unusable for me. Mar 17, 2014 at 19:49
  • 1
    +1. Feature request; ability to not have this applied to chat notification (it's useful in theory, but in practice I've observed it is often tedious to click all notification links when a conversation generates many notification and not as useful in that case since visiting the chat room is usually enough to see all of these at once).
    – Jason C
    Aug 7, 2014 at 6:52

1 Answer 1

6

It would be really nice if somebody could rewrite this as a Greasemonkey script using Desktop Notifications, so that I could use this with Firefox.

In case that last part left you thinking that there's something wrong with me, take a look at this. :)

8
  • Here's a link to the original Userscript. You can download from Assembla and install via Greasemonkey. As I mentioned here, remember, there's zero cross-domain communication, at least not that I'm aware of, but this will give you an idea of where I started. If you wanted to play w/desktop notifications, you'd add them in the function on line 132 I believe, storeNewInboxItems. You could start by adding in a call to webkitNotifications.
    – jmort253
    Dec 4, 2012 at 7:18
  • so that when a new inbox item was added, it would also generate a webkitNotification. It would be interesting to see if the theory is right that there'd be a notification for each SE tab, or if it just sends one. :) Hope this helps. Enjoy!
    – jmort253
    Dec 4, 2012 at 7:19
  • The Firefox version of StackInbox is complete; however, StackInbox solves a different problem than what you're looking for with desktop notifications. Instead, see Real-Time Desktop Notifications for Stack Exchange. It's a Chrome Extension that does what you're looking for, and I think it would be easier to port that to Firefox than to try and repurpose StackInbox. Hope this helps! :)
    – jmort253
    Dec 9, 2012 at 0:29
  • @jmort253 Ah-ha, I was originally misunderstanding the purpose of this add-on. Thank you for pointing me in the right direction. Dec 9, 2012 at 5:12
  • You're welcome. I did look into it a bit, and it would be hard to implement in StackInbox but not in another extension. You could use document.addEventListener("DOMNodeInserted" event to listen for changes to the inbox's little red icon, then make an AJAX request to meta.pm.stackexchange.com/inbox/genuwine to get the inbox contents and grab the first item, using it in your webkit notification. Hope this helps! :)
    – jmort253
    Dec 9, 2012 at 5:22
  • @jmort253 Oh, man. I wish that I were better at JavaScript. I understood what you said, but I haven't gotten into AJAX yet... I also don't know how to make a Firefox extension... But I understood what you were saying... Dec 9, 2012 at 20:51
  • 2
    @jmort253 FYI, Real-time desktop notifications for Stack Exchange inbox is now also available to Firefox. And no, porting was not trivial :p
    – Rob W
    Dec 10, 2012 at 14:55
  • @RobW Thanks! (I definitely didn't think it was trivial. ;) Dec 10, 2012 at 16:13

You must log in to answer this question.

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