jackun / VLCTube

The Unlicense
16 stars 4 forks source link

Reply to comments is broken sometimes #59

Open ghost opened 9 years ago

ghost commented 9 years ago

When I try to reply to comments, the space bar activates the player. It seems YT has redone their comment js and now the comment section is a DIV. I fixed this issue by changing line 1137 from

if(ev.target.tagName == "TEXTAREA" || 

to

if(ev.target.tagName == "TEXTAREA" || ev.target.tagName == "DIV" ||
jackun commented 9 years ago

For me the "textbox" (actually the whole comments area once the comment textbox loads) eats the keydown events before they even get to the shortcut handler. But seems that checking for body might be enough.

ghost commented 9 years ago

Note that the change by YouTube of their comments section only effects replies. Posting an original comment always works, and the original comment box is still a "TEXTAREA", and it does consume the event, but the error occurs when attempting to reply to a comment, then it seems ev.target.tagName == "DIV", but checking for body may be a more suitable or stable workaround, a little more general and future proof. I replaced

if(ev.target.tagName == "TEXTAREA"  ||
                (ev.target.tagName == "INPUT" && ev.target.type != "button"))
            return;

with

if(ev.target.tagName != "BODY") return;

and it works.

Thank you

jackun commented 9 years ago

https://github.com/jackun/VLCTube/commit/e994c314284c2c509dca5cd64318434b6db5b893 Does this break chatting? Commenting seemed to work for me, but as usual...

ghost commented 9 years ago

No problems for me

ghost commented 9 years ago

This does make space bar pause when I reply to a comment. I made a comment on a video, thumbed up another comment and tried to reply to it, but space bar made me start chopping the video.

Sonic0170 commented 9 years ago

ok i can confirm that space bar pauses and unpauses the video regardless of focus or not. so i would assume typing a comment would result in constant pausing and unpausing with each spacebar press.

Sonic0170 commented 9 years ago

"clarification" by focus i meant focus on player not the window itself