On Fri, Aug 10, 2012 at 06:53:35PM +0200, Vincent Bernat wrote:
> Hi!
>
> I am loading Twitter page mode with the following snippet:
>
> #v+
> require("twitter");
> undefine_key(twitter_keymap, "f");
> #v-
>
> While the `f` key can now be used for its original purpose without
> prefixing it with `C-z`, Twitter still manages to receive this
> keypress. I have looked at the code of Twitter and it registers an event
> handler on `document.body` for `keydown`, `keypress` and `keyup`.
>
> What would be the best way to not allowing it to receive the `f` key?
> Which event does Conkeror will intercept? `keypress`?
> --
> printk("What? oldfid != cii->c_fid. Call 911.\n");
> 2.4.3 linux/fs/coda/cnode.c
Conkeror's input system only deals with keypress events, so dealing with
websites that listen to keyup and keydown is a long-standing annoyance.
There is an experimental solution, but it is known to have problems on OS X:
function input_setup_extra_key_events (window) {
window.addEventListener("keydown", input_handle_keydown, true);
window.addEventListener("keyup", input_handle_keyup, true);
}
add_hook("window_initialize_hook", input_setup_extra_key_events);
Or here is another snippet of code that can be used on a per-site
basis.. modify it for the event(s) you want to intercept and the sites you
want it to work on:
define_page_mode("keyup-kill-mode",
[],
function enable (buffer) {
buffer.browser.addEventListener("keyup", event_kill, true);
},
function disable (buffer) {
buffer.browser.removeEventListener("keyup", event_kill, true);
},
$display_name = "Keyup-kill");
page_mode_activate(keyup_kill_mode);
keyup_kill_mode.test.push(build_url_regexp($domain = "www.smbc-comics"));
--
John Foerch
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror