lethargic_man: (Default)
[personal profile] lethargic_man
At home, when I'm writing a blog post (or anything else) with Hebrew in, it's quite convenient; I have Emacs ready to hand with the Hebrew mode I made for it. At work, it's rather less convenient; and anywhere else, it's downright inconvenient: I have to fire up Word, and, using "Insert symbol", insert the characters one at a time, taking several mouse clicks to do each.

Fed up with this, I have made myself a little web-based Hebrew text entry gizmo, and offer it up here because I think it might be of use to other readers of this journal.

Note that this does not utilise the standard Hebrew keyboard layout; it's intended for (people like) myself, who do not know the standard Hebrew keyboard layout, and want a layout in which, as much as possible, Hebrew letters are generated by their QWERTY equivalents.

Because I wrote this primarily for myself, it's also not been tested other than on Firefox 1.5 on Linux and Windows, and IE 6 on Windows. If people have issues with it on other browsers, let me know (though I do not promise to necessarily do anything about it).

Date: 2007-04-19 12:48 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
It just types in Latin chars on my browser (Mozilla 1.7.8 - Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060628 Debian/1.7.8-1sarge7.1)

Date: 2007-04-19 12:50 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Does the JavaScript error console say anything? (And, for that matter, do you have JavaScript enabled?)

Date: 2007-04-19 12:54 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
Error: jemail is not defined
Source File: http://www.michaelgrant.dsl.pipex.com/hebrew_entry.html
Line: 199

Error: missing variable name
Source File: http://www.michaelgrant.dsl.pipex.com/hebrew_entry.html
Line: 10, Column: 8
Source Code:
var char = "";

Date: 2007-04-19 01:08 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Odd; I've been using jemail for ages and never noticed a problem yet. It's certainly there in the source, and Firefox 1.5 is happy with it. <finds a computer with Mozilla 1.7.6> Hmm.. . <digs around in menus> How do you access the JavaScript console on this? (And how good's your JavaScript anyway?)

Date: 2007-04-19 01:28 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
Tools, Web Development, Javascript Console. My javascript knowledge isn't great, but I can cope with it given a search engine to find documentation.

Date: 2007-04-19 01:32 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
Try replacing all instances of "char" with something looking less like a reserved word? Seems to help.

Date: 2007-04-19 01:51 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Closer now, but no cigar. And it's also complaining "window.handleEvent is not a function"; must have been introduced in a later version of JavaScript... May look further into this later, after work...

Date: 2007-04-19 01:52 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
I don't get the window.handleEvent stuff; might be something fixed between versions.

Date: 2007-04-19 01:57 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Do you get the extraneous Latin characters appearing after every Hebrew one?

Date: 2007-04-19 02:20 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
I did when I replaced "char", yes.

Date: 2007-04-19 02:40 pm (UTC)
From: [identity profile] ploni-bat-ploni.livejournal.com
Looks great!

If only if I knew how to use it...

Date: 2007-04-19 02:43 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Click in the entry box to put your cursor there, and type using the key mapping below.

Date: 2007-04-19 02:48 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
I think I've fixed it.

// At the top of the javascript section, outside any function definition:
var allstr = '';
// ...

// at the bottom of insertHebrewChar function
// change
// document.forms[0].elements[0].value += char;
// to:
allstr += char; // whatever you're calling char these days
document.forms[0].elements[0].value = allstr;

// ...

//and change
// document.forms[0].onkeydown = onKeyDownH;
// to

document.forms[0].onkeyup = onKeyDownH;

Also might be good practice to refer to the form by a name rather than an index, but it won't really matter for this.

Date: 2007-04-19 03:03 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Well done. Except that it now looks ugly, with the letters only appearing on the key release. (And allstr needs clearing on hitting the "clear" button too.)

There, I've rearranged the file so it now works for both of us, but only looks ugly for you. ;^b (On the grounds that there's likely to be more users using Firefox or IE 6 than an old version of Mozilla.)

Date: 2007-04-19 03:10 pm (UTC)
From: [identity profile] pseudomonas.livejournal.com
It still has broken logic, really. If you use the cursor keys to move into the middle of a word and then type a character it appears at the end of the word. And numbers and other characters just get deleted without trace. Pasting into it now (as a result of my changes, I'm afraid) is reverted at the next keystroke. I think there must be a better solution, but I'm not about to write one just this moment.

Date: 2007-04-19 06:16 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Numbers and some other characters now work. A quick google reveals it's not easy to work out textarea cursor position, particularly for a variable-width font (where some characters are themselves of variable width depending on the previous character), so that's unlikely to get done. And the problem with handling pasting is that Mozilla-based browsers, at least, withhold by default permission for JavaScript to make use of the clipboard.

I suppose it would be possible to work around this, by (say) allowing keystrokes to insert normally, then reinterpreting every Latin character when the key or mouse is released (or, if all else fails, starting from scratch in Java), but really this is somewhat overkill for the purpose. It's just meant as a simple way of being able to type the odd Hebrew word or phrase for copying into a predominantly Latin-alphabet editor, and not as a sophisticated text editor in its own right.

Date: 2007-04-19 04:04 pm (UTC)
liv: alternating calligraphed and modern letters (letters)
From: [personal profile] liv
That's very useful indeed, but you have over-determined X in your key mapping, you've made it stand for both tsaddi sofit and tsereh. When I tried it, the character it chose was the former, but that doesn't help if I want a tsereh. Thanks, though!

Date: 2007-04-19 04:09 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
Whoops; I moved צֵרֵה to Z, and forgot to update the listed mapping. Will update now.

Date: 2007-04-19 05:07 pm (UTC)
From: [identity profile] zevabe.livejournal.com
i tried it, but it didn't come out in hebrew at all, but in English.

Date: 2007-04-19 05:37 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
What browser are you using, and which OS? (BTW, as you'll possibly have seen from upthread, I fixed a number of problems with it earlier this afternoon, so hit refresh in your browser and check it to see if it works for you now.)

Date: 2007-04-22 08:10 pm (UTC)
From: [identity profile] elianarus.livejournal.com
It works well for me, but is there a way to cut-and-paste to Word without having it come out with the letters in inverted order?

If so, this would make my life ever so much easier! (My Hebrew spelling is lame enough that if I have to take half a minute per character insertion, I keep forgetting how to spell whatever I am trying to write - pathetically this sometimes includes my own name...)

Eliana

Date: 2007-04-23 08:19 am (UTC)
From: [identity profile] lethargic-man.livejournal.com
It works well for me, but is there a way to cut-and-paste to Word without having it come out with the letters in inverted order?

Sounds like you have an old version of Word that can't handle bidirectional text; it comes out the right way around for me. Possible solutions: (a) upgrade to a later version of Word. (b) If you're not prepared to spend the money for this, download an open-source word processor such as Open Office (http://www.openoffice.org/) to use when you need Hebrew in your document. (c) Wait and I may add a "reverse text" button to it.

Date: 2007-05-20 03:09 am (UTC)
From: [identity profile] zsero.livejournal.com
Thanks. I've been using this, which at least has the advantage of being only one click per letter, but I may start using yours instead.

Profile

lethargic_man: (Default)
Lethargic Man (anag.)

May 2025

S M T W T F S
    123
45678910
11121314151617
181920212223 24
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Thursday, June 12th, 2025 09:44 am
Powered by Dreamwidth Studios