Jeremy wrote:
Thomas 'PointedEars' Lahn wrote:
>i.*********@any.more.email wrote:
>>I want to create a small bit of javascript to enable a key based
selection within a text area. My users are in the habit of
delineating options within anecdotal text using forward slashes, and
I wanted to facilitate this more formally.
I want to trap Ctrl+/ and Shift+Ctrl+/ to navigate to the next '/'
character inside the text area or select that text respectively.
Trapping the keystrokes was relatively easy (event.ctrlKey==1 &&
event.ctrlKey or event.ctrlKey === true
<snip>
Note that in Firefox, "/" brings up the type-to-search bar,
When a textarea has the focus? Not here.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404
Firefox/2.0.0.14
and there is no way (that I could find) to disable this in Javascript
(preventDefault, et al did nothing for me). This may have been fixed in
recent versions,
I don't remember observing the described behavior in any previous Firefox
version, and I have been testing nightlies and on other OSes as well.
but it's something to look out for.
Yes, but not in a textarea.
However, more important is that `keyCode' is not a reliable property for a
character key. For example, `/' has keyCode == 55 here, the same as `7'
(German 89-key compact laptop keyboard layout). `charCode' is the property
one should be looking for, which yields the Unicode codepoint of the
character that would be entered (here: 47); it is available with the
proprietary `keypress' event type and perhaps the proposed `textInput' event
type of W3C DOM Level 3 Events (WD, apparently not fully implemented yet in
Fx 2); in any case with the standards-compliant `onkeypress' attribute.
Your Message-ID header also appears to violate RFC2822 (and, consequently,
RFC1036): AFAIK `.lga' is not a registered TLD (CMIIW). Since this appears
to be caused by a flawed news server configuration, you should
a) tell your NetNews provider to update their configuration (recommended)
b) change to a standards-compliant NetNews provider
c) use the following in your Thunderbird's user.js:
user_pref("mail.identity.default.generate_news_mes sage_id", true);
user_pref("mail.identity.default.FQDN", "your-domain.example");
(Replace the FQDN with a domain that you own or have permission to use.
This is how I generate my M-IDs.)
(This hint might also be useful for the OP and others [and is somewhat
script-related ;-)], so I am posting it here.)
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>