sharadmv / quizbowl

upgraded version of old quizbowl central
http://www.quizbowldb.com
9 stars 7 forks source link

Clean up space to buzz binding code #20

Closed achalddave closed 12 years ago

achalddave commented 12 years ago

In multiplayer.js, instead of using unbind on focus and blur of particular elements, use e.target to see if the space was pressed in a particular event.

$(document).keydown(function(e) {
  if (!unbind)  {
    if (e.which == 32) {
      if (roomHandler) {
        roomHandler.buzz(function(buzzed) {
          if (buzzed) {
            $('#gameBuzz').hide();
            $('#gameAnswer').show();
            $('#gameAnswer').focus();
          }
        });
      }
    }
  }
});
$("#gameAnswer").focus(function(e) {
  unbind = true;
});
$("#gameAnswer").blur(function(e) {
  unbind = false;
});
$("#roomChatMessage").focus(function(e) {
  unbind = true;
});
$("#roomChatMessage").blur(function(e) {
  unbind = false;
});
sharadmv commented 12 years ago

not exactly sure how to do this...

achalddave commented 12 years ago

This is helpful but I can take care of it later if you want.

sharadmv commented 12 years ago

due to some event binding hilarity, the space button no longer works on the multiplayer page, (at least for the "Name" and "Message" input fields for create game

achalddave commented 12 years ago

That's... a feature! Who wants spaces anyways?

(On a serious note: that's pretty easy to fix, I'll take care of it)