gomita / firegestures

FireGestures, a Firefox extension.
http://www.xuldev.org/firegestures/
Other
128 stars 30 forks source link

keydown listener don't work #38

Open 0rt opened 12 years ago

0rt commented 12 years ago

I want to combine 2 similar feature in same gesture, press a key to switch between them:

var BBcode = false;

function listener(e){
    if(e.keyCode == 81){  // press Q switch to feature A, else feature B
        BBcode= true;
    }
}

document.addEventListener('keydown', listener ,false);
document.removeEventListener('keydown',listener,false);

if ( BBcode ){
         // feature A
}
else {
       // feature B
}

but it doesn't work, any clue?

0rt commented 12 years ago
var BBcode = false;
if(event.DOM_VK_Q){BBcode = true;};
alert(BBcode);

just try the FG api event, still no good, always prompt false