/** * check_me.js * * Copyright (c) 1999-2005 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This JavaScript app is the driving power of the SquirrelSpell's * main spellchecker window. Hope you have as much pain figuring * it out as it took to write. ;)) * * $Id: check_me.js,v 1.2.4.3 2005/06/04 21:57:32 jervfors Exp $ */ var CurrentError=0; var CurrentLocation=0; var CurrentLine; var CurrentSymbol; var ChangesMade=false; /** * This function loads spellchecking errors into the form * displayed to the user. * * @return void */ function populateSqspellForm(){ CurrentWord=Word=misses[CurrentError]; WordLocations = locations[CurrentError].split(", "); CurrentLoc = WordLocations[CurrentLocation]; if(CurrentLocation==WordLocations.length-1) { CurrentLocation=0; } else { CurrentLocation++; } tmp = CurrentLoc.split(":"); CurrentLine=parseInt(tmp[0]); CurrentSymbol=parseInt(tmp[1]); document.forms[0].sqspell_error.value=Word; LineValue=sqspell_lines[CurrentLine]; StartWith=0; NewLineValue=""; if (CurrentSymbol > 40){ StartWith=CurrentSymbol-40; NewLineValue = "..."; } EndWith=LineValue.length; EndLine=""; if (EndWith > CurrentSymbol + 40){ EndWith=CurrentSymbol+40; EndLine="..."; } NewLineValue+=LineValue.substring(StartWith, CurrentSymbol) + "*" + Word + "*" + LineValue.substring(CurrentSymbol + Word.length, EndWith) + EndLine; document.forms[0].sqspell_line_area.value=NewLineValue; if (suggestions[CurrentError]){ WordSuggestions = suggestions[CurrentError].split(", "); for (i=0; i= 0){ allLoc = locations[i].split(", "); for (j=0; j lSymbol){ tmp[1] = tmp[1] + difference; allLoc[j] = tmp.join(":"); } } } locations[i] = allLoc.join(", "); } } } /** * This function writes the changes back into the compose form. * * @return void */ function sqspellCommitChanges(){ newSubject = sqspell_lines[0]; newBody = ""; for (i=1; i