Are there API docs for the "custom JS" feature?


I’d like to use the custom JS feature to do stuff with feed items or format comment threads, but I can’t see how to do that. Are there events/hooks/callbacks I can use for when a feed item loads?

For a practical example, if I wanted to parse markdown in shared item comment threads, how could I do that?
I’m hoping I can write a callback and get access to some kind of item context object or something.


Yeah it’s not going to be easy to do that unless you know Backbone.js and what NewsBlur callbacks look like. I’d like to document how to do things like this but I don’t have the time to do that now.

This will give you the hook you want:

NEWSBLUR.assets.stories.bind('change:selected', function() { console.log('Story changed', this); });


Thanks, @samuelclay. That looks like a good place for me to start. But now I’ve got to mention another question (and the reason I didn’t look into this months ago): is the custom JS input cached on the server, or do I need to wrap it in an IIFE or something? If I put something like console.log('foobar'); in there and refresh newsblur, it doesn’t ever print foobar in the log.

I did that when the feature was first introduced and then I gave up (custom CSS works fine, however) – then a long time later I noticed my test line was being printed in the console even though I hadn’t changed anything recently. It’s as if the custom JS input is ignored for some amount of time before taking effect. Confusing.


I’m not sure why the custom JS would execute only after some time. You’re adding a binding to the stories collection, which is initialized by load time.


I mean anything I put in there (even a single console.log) doesn’t appear to get executed at all during the entire session. At least, not on the same day that I change the value.