octatone / reddit.tv

HTML5 and AJAX display of videos from reddit.com to replace reddit.tv. Includes any video embed type from reddit. Only backend is reddit.com's API, everything else is clientside.
http://reddit.tv
MIT License
64 stars 72 forks source link

Vim homerow #12

Closed fagga closed 13 years ago

fagga commented 13 years ago

I added support for hjkl keybindings like in Vim.

I also tried to bind 'c' to open the comments page but couldn’t get it to work with jQuery’s .click(). Maybe you know how this could be done?

octatone commented 13 years ago

You'll have to bind 'c' within the ajax callback that updates the comment links for it to work - after the comment link has finished it's animation (probably as a finish callback on the animation). Also, since it will be updated frequently you have to make sure you are unbinding the previous click action before each updated binding.

fagga commented 13 years ago

The problem seems to be calling the .click() event on tags. It gets called but doesn’t do anything. Searching for it gave a possible explanation but I didn’t understand it.

In the reddit enhancement suite initMouseEvent and dispatchEvent are used, but those didn’t do anything either.

Maybe this is intentional to prevent popups.

octatone commented 13 years ago

Ah, well you could do a simple window.open(url)

fagga commented 13 years ago

Yes, but that’s where the popup blockers pop up. I thought there could be a way to avoid them because it’s not really a popup as it opens via key stroke. But if there is no other way, it’s probably better than nothing.

octatone commented 13 years ago

Yeah, we can't defeat popup blockers, and we shouldn't be trying :) Most browsers will at least give the option to the user to let the website open the window or not.

fagga commented 13 years ago

Well, the popup blocker is oversensitive here, at least in Firefox. It shouldn’t matter how the user indicates that he wants to open the comments, via mouse or keyboard.

Anyway, a used window.open() now and it works somehow.