PURVEYOR OF FINE WORDS

May 24, 2006

May 24 2006

Ajax spell check as you type

I’ve been looking for a nice web Javascript spell checker, and came across a great implementation by Emil that he named LiteSpellChecker. It mimics the spell checker in MS Word by underlining misspelled words and presenting a nice substitute word selection menu. The javascript takes a standard <textarea> element, erases the background, and inserts a shadow <div> underneath that holds the redline segments.
spell check screenshot in Firefox OS X

Bug Fixes (based on 2005-7-24 version of LiteSpellChecker)

The current implementation on his site has some bugs, so I’ve started to tackle some of them:

  • Fixed: Redlines get misaligned when scrolling with arrow keys in Firefox
    When scrolling long text using Firefox, the redlines become misaligned as you move towards the bottom of the page. Once they begin to misalign, you have to manually refresh in order get it right again.
  • Fixed: Ignore word function breaks if there are non-word segments in the text
    If the text contains characters like ++ or @@, then the ignore words function fails. This problem crops up whenever you have wiki markup syntax.
  • Fixed: Numbers are flagged as misspelled
    Any word that contains a number is now ignored by the spell checker.

Performance Improvements

Since many of my users will be working with long documents, performance is key.

  • Sped up ignore function by almost 5x
    The ignore word function loops through all words and feeds it back into the spellchecker. In long documents, the lag becomes noticable, and also causes a flicker of all the redlines. Instead of blindly looping through all words, I changed it to a case-insensitive search for the ignored word, and only processed the matching words. Venkman reports a speed up from 278.2ms to 57.95ms on a Powerbook G4.
  • Improved responsiveness while editing long text
    Since the spell checker updates the spelling status on every keystroke, the UI becomes unusable when editing long text. I added a spell check delay that suspends the spell checker while typing continuously. You can adjust the sensitivity via the SPELL_CHECK_DELAY variable.

Download my source code. Important: read Emil’s demo page before attempting to do anything with these files.



5 Comments »

  1. Hello,

    Great news. There is a site where you implemented all these changes and we can test the spell checker without bugs?

    bye

    Comment by Paul — August 1, 2006 @ 10:31 am

  2. cool

    Comment by mel — September 20, 2006 @ 12:41 pm

  3. Here’s a commercial quality Ajax spell checker that my company has been working on for almost a year. It integrates with FCKEditor, TinyMCE and others also, check it out at http://www.thesolutioncafe.com/ajax-spell-checker.html

    Later!

    Comment by Cliff Helsel — September 21, 2006 @ 4:16 am

  4. I think this is just like”Google Suggest”,right?

    Comment by anish — October 16, 2006 @ 5:09 pm

  5. Is there a place where I could test this out?
    The best free spell checker I have found so far has been http://www.spelljax.com - but I can’t figure out how to embed it into my own website, so I’m looking for alternatives.

    Comment by Mike — June 28, 2007 @ 9:14 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

 

Linking

  • The combination of Pitt and Soderbergh and Lewis wasn't enough to keep the Moneyball movie afloat...Sony canceled it "days before shooting was to begin".

    Accounts from more than a dozen people involved with the film, who spoke on the condition of anonymity to avoid damaging professional relationships, described a process in which the heady rush toward production was halted by a studio suddenly confronted by plans for something artier and more complex than bargained for.

    Sony was probably looking for something more BIG RED TEXTish.

    Tags: books   Brad Pitt   Michael Lewis   Moneyball   movies   Steven Soderbergh
  • Ben Fry just updated his interactive salary vs performance graph that compares the payrolls of major league teams to their records. Look at those overachieving Rays and Marlins! And those underachieving Indians, Mets, and Cubs!

    Tags: baseball   Ben Fry   infoviz   sports
  • Things will be significantly slower than usual around here this week...I am on vacation. Aside from some sporadic updates, I'll see you next week.

    Tags: kottke.org
  • The New Yorker has an iPhone-specific site up. (thx, @level39)

    Tags: iPhone   The New Yorker
  • From Joseph Clarke in Triple Canopy, a comparison of the histories of the American megachurch and corporation.

    Lakewood and America's twelve hundred other megachurches -- congregations that draw between two thousand and fifty thousand people per weekend -- are not simply vast machines for passive spectatorship. Sunday services are convergences of worshipers who spend their weeknights at prayer groups, Bible studies, ministries, and missionary training sessions. Successful megachurches are like well-run companies, with intricate corporate structures devised to keep each member personally engaged; their pastors are like chief executives, maximizing the productivity of laborers in the evangelism enterprise. Jumbotron notwithstanding, the architectural and organizational tropes of the megachurch are best compared to those of the modern white-collar workplace.

    Tags: Joseph Clarke   religion
  • It looks as though the Netflix Prize might have been won through a combined effort of the top two teams. (thx, bergmayer)

    Update: All teams have 30 days to better the current high score before the winner is declared. But, someone has won the Prize. (thx, all)

    Tags: Netflix   Netflix Prize
  • New father Paul Drielsma thinks that the language around fatherhood needs to change.

    Scour the parenting forums on the Internet and you'll find the common lament that "DH" (darling husband) expects a medal whenever he "babysits" junior for a few hours. I have little sympathy for DH in these cases, but maybe a step in the right direction would be to stop using language that suggests hired help -- to stop referring to DH's job in the same terms as somebody who could legitimately stick his hand out at the end of his shift and demand a tip. DH isn't babysitting, he's parenting, and just changing that one word changes, for me at least, all sorts of connotations.

    Tags: language   parenting   Paul Drielsma
  • The clothes from Irina Shaposhnikova's Crystallographica show look as though they were created with 3-D rendering software but haven't quite finished rendering yet.

    Irina Shaposhnikova

    (via today and tomorrow)

    Tags: fashion   Irina Shaposhnikova
  • A short appreciation of the SR-71 Blackbird, an airplane that was literally faster than a speeding bullet.

    "It wasn't like any other airplane," he told me. It was terrifying, exciting, intense and humbling every time you flew. Each mission was designed to fly at a certain speed; you always knew the airplane had more. It was like driving to work in a double-A fuel dragster."

    The skin of the plane's fuselage was a whopping 85% titanium, which was purchased, during the Cold War, from the Soviet Union.

    Update: See also SR-71 Groundspeed Check, Google Map of where all the Blackbirds are, and SR-71 Disintegrates Around Pilot During Flight Test:

    Everything seemed to unfold in slow motion. I learned later the time from event onset to catastrophic departure from controlled flight was only 2-3 sec. Still trying to communicate with Jim, I blacked out, succumbing to extremely high g-forces. The SR-71 then literally disintegrated around us. From that point, I was just along for the ride.

    (thx, doug, clay & tom)

    Tags: airplanes   SR-71
  • David Galbraith calculates that if buildings by famous architects were priced like paintings, a Le Corbusier building would be worth more than the entire US GDP.

    The top floor of Corbusier's Villa Stein (one of perhaps the top 500 most important houses of the late 19th/early 20th centuries - i.e. a Van Gogh of houses) is for sale for the same price per sq.ft. (approx $1400) as buildings in the same area of suburban Paris, designed by nobody in particular. Meanwhile, Van Gogh's Portrait of Dr. Gachet sold for an inflation adjusted price of $136 million yet a poster of similar square footage and style costs around $10.

    In terms of signaling, it's difficult to hang a house on one's parlor wall...buying a Corbusier means living in it wherever it happens to be located, at least part of the year.

    Tags: architecture   art   David Galbraith   economics   lecorbusier
  • You've likely seen this comparison of Harry Potter and the first Star Wars movie but that comparison has recently been expanded to include not only Potter and Star Wars but also The Matrix and Abrams' Star Trek.

    Once upon a time, Luke | Kirk | Neo | Harry was living a miserable life. Feeling disconnected from his friends and family, he dreams about how his life could be different. One day, he is greeted by Obi Wan | Captain Pike | Trinity | Hagrid and told that his life is not what it seems, and that due to some circumstances surrounding his birth | birth | birth | infancy he was meant for something greater.

    Update: The connecting theme is the monomyth. (via @adamlgerber)

    Update: Or perhaps Potter is really Young Sherlock Holmes? (thx, stephen)

    Tags: Harry Potter   movies   Star Trek   Star Wars   thematrix

Links provided by kottke.org.

Offering

Syndicating