X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fsquirrelspell%2Fjs%2Fcheck_me.js;h=332c62cdbdbd923d79ba27c35b8d1ead2e375526;hp=852ca0e4d56b7d0dbf6554fe9ba7fbba40fc63ba;hb=c4faef335b2362c81b8ebf026d4066c12d70536c;hpb=849bdf42ed7bd7cca68909d2b46869742dfd210e diff --git a/plugins/squirrelspell/js/check_me.js b/plugins/squirrelspell/js/check_me.js index 852ca0e4..332c62cd 100644 --- a/plugins/squirrelspell/js/check_me.js +++ b/plugins/squirrelspell/js/check_me.js @@ -1,10 +1,14 @@ /** - CHECK_ME.JS - ------------ - 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. ;)) - **/ + * check_me.js + * + * 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. ;)) + * + * @copyright 1999-2020 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + */ var CurrentError=0; var CurrentLocation=0; @@ -13,8 +17,13 @@ var CurrentLine; var CurrentSymbol; var ChangesMade=false; +/** + * This function loads spellchecking errors into the form + * displayed to the user. + * + * @return void + */ function populateSqspellForm(){ - // this function loads error data into the form. CurrentWord=Word=misses[CurrentError]; WordLocations = locations[CurrentError].split(", "); CurrentLoc = WordLocations[CurrentLocation]; @@ -23,7 +32,7 @@ function populateSqspellForm(){ } else { CurrentLocation++; } - + tmp = CurrentLoc.split(":"); CurrentLine=parseInt(tmp[0]); CurrentSymbol=parseInt(tmp[1]); @@ -43,7 +52,7 @@ function populateSqspellForm(){ } 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(":"); - } - } + if (allLoc[j].indexOf(lLine+":")==0){ + tmp = allLoc[j].split(":"); + tmp[0] = parseInt(tmp[0]); tmp[1] = parseInt(tmp[1]); + if (tmp[1] > 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(){ - // Write the changes back into the compose form - if (navigator.appName.indexOf("Microsoft")==0){ - // MSIE doesn't have array.shift() - newSubject = sqspell_lines[0]; - newBody = ""; - for (i=1; i