Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #36328

Re: How to check if a key is currently down ...

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Peter Büttner <not_for_mail_peb@gmx.net>
Newsgroups comp.lang.javascript
Subject Re: How to check if a key is currently down ...
Date Sun, 07 Apr 2019 19:53:44 +0200
Lines 61
Message-ID <ggurp9Fkiq1U1@mid.individual.net> (permalink)
References <q79vlh$1li$1@gioia.aioe.org> <gfsif9F4cf9U1@mid.individual.net> <q7b6b4$1mqo$1@gioia.aioe.org> <gg1thtFa2vsU1@mid.individual.net> <q86vpv$1k4d$1@gioia.aioe.org>
Reply-To peter.buettner@gmx.net
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net w2z1lMIpmjkdPlE6Zea5ZQGTSVbg5YPL9fdzFdF1L/tGyqfT8w
Cancel-Lock sha1:o3FrKE9QZpHl8oHpUJUglu8tzhw=
User-Agent Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5
In-Reply-To <q86vpv$1k4d$1@gioia.aioe.org>
Xref csiph.com comp.lang.javascript:36328

Show key headers only | View raw


Am 05.04.2019 09:23, schrieb R.Wieser:
> Peter,
>
> Sorry for the late reply, I got a bit distracted with another project ...

Usenet is no chat, and I need some time to reply too.


>> Maybe store a flag with GM and do your action on the next page if it is
>> set
>
> If I can do that (store a flag into GM space which survives page changes)

GM_getValue(), GM_setValue()
like localStorage, but not accessible by the webpage.

> than I can probably do with the already available catching key-state change
> events (or the 'User Script Commands' below).
>
>> That behavior can also be implemented by a simple button anywhere on the
>> page
>
> I only realized that after I conceeded that getting a keystate isn't
> possible and started looking for other possibilities.  Heck, I've already
> used a similar method elsewhere (capturing mouse clicks) ...
>
>> The 'User Script Commands' were removed in GM 4.
>
> I'm (still) running 3.17 (on FF 52), and yesterday saw that it indeed does
> work.   Bummer though, I assumed them to be some kind of page-local hotkeys,
> not a Alt-T, G, C, {my key} sequence.

add an event listner to the page.

I do that on some forum sites. Just need to press a single key 'N'=Next.
Very useful.

E.g.:
    map ={ 'N': 'a[rel="next"]', 'P':'a[rel="prev"]'};
and find the link and 'click' it by code after the keypress.
Google search uses special id= for next/previous links.

Here <link rel="prev"> and <link rel="next"> from older days comes
to mind, rarely used today, and AFAIK not supported by browsers any
more (in menus or with shortcuts).


Some websites (e.g. heise.de) also use single key shortcuts for
navigation.


> Thanks for the info about it though.  Might come in handy elsewhere. :-)

I find the menu good for seldom used actions, as a reminder. Like menus
in 'normal' programs, real menus, not burger menus.

Peter



Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

How to check if a key is currently down ... "R.Wieser" <address@not.available> - 2019-03-25 08:23 +0100
  Re: How to check if a key is currently down ... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-03-25 02:33 -0700
    Re: How to check if a key is currently down ... "R.Wieser" <address@not.available> - 2019-03-25 11:48 +0100
  Re: How to check if a key is currently down ... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-03-25 02:39 -0700
  Re: How to check if a key is currently down ... Julio Di Egidio <julio@diegidio.name> - 2019-03-25 04:08 -0700
  Re: How to check if a key is currently down ... JJ <jj4public@vfemail.net> - 2019-03-25 19:42 +0700
    Re: How to check if a key is currently down ... "R.Wieser" <address@not.available> - 2019-03-25 17:21 +0100
    Re: How to check if a key is currently down ... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-03-26 17:09 +0100
      Re: How to check if a key is currently down ... Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-03-26 16:12 +0000
        Re: How to check if a key is currently down ... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-03-26 17:35 +0100
          Re: How to check if a key is currently down ... Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-03-26 16:48 +0000
            Re: How to check if a key is currently down ... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-03-26 18:29 +0100
              Re: How to check if a key is currently down ... Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-03-26 17:36 +0000
    Re: How to check if a key is currently down ... Julio Di Egidio <julio@diegidio.name> - 2019-03-26 18:23 -0700
  Re: How to check if a key is currently down ... Peter Büttner <not_for_mail_peb@gmx.net> - 2019-03-25 18:46 +0100
    Re: How to check if a key is currently down ... "R.Wieser" <address@not.available> - 2019-03-25 19:23 +0100
      Re: How to check if a key is currently down ... Peter Büttner <not_for_mail_peb@gmx.net> - 2019-03-27 19:26 +0100
        Re: How to check if a key is currently down ... "R.Wieser" <address@not.available> - 2019-04-05 09:23 +0200
          Re: How to check if a key is currently down ... Peter Büttner <not_for_mail_peb@gmx.net> - 2019-04-07 19:53 +0200

csiph-web