mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
ok getting better
This commit is contained in:
parent
8e8eb4f4a9
commit
e424bc27aa
5 changed files with 96 additions and 111 deletions
|
@ -21,10 +21,30 @@ var init = function(){
|
|||
el: $('#canvasWrapper')[0]
|
||||
});
|
||||
|
||||
// set up event baton for certain things
|
||||
$(window).focus(function() {
|
||||
eventBaton.trigger('windowFocus');
|
||||
});
|
||||
// we always want to focus the text area to collect input
|
||||
var focusTextArea = function() {
|
||||
console.log('focusing text area');
|
||||
$('#commandTextField').focus();
|
||||
};
|
||||
focusTextArea();
|
||||
|
||||
$(window).focus(focusTextArea);
|
||||
$(document).click(focusTextArea);
|
||||
|
||||
// but when the input is fired in the text area, we pipe that to whoever is
|
||||
// listenining
|
||||
var makeKeyListener = function(name) {
|
||||
return function() {
|
||||
var args = [name];
|
||||
_.each(arguments, function(arg) {
|
||||
args.push(arg);
|
||||
});
|
||||
eventBaton.trigger.apply(eventBaton, args);
|
||||
};
|
||||
};
|
||||
|
||||
$('#commandTextField').on('keydown', makeKeyListener('keydown'));
|
||||
$('#commandTextField').on('keyup', makeKeyListener('keyup'));
|
||||
|
||||
/* hacky demo functionality */
|
||||
if (/\?demo/.test(window.location.href)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue