Changeset 2430 for sandbox/expressoMail1_2/corretor_ortografico
- Timestamp:
- 04/06/10 13:38:20 (14 years ago)
- Location:
- sandbox/expressoMail1_2/corretor_ortografico/spell_checker
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/css/spell_checker.css
r2375 r2430 26 26 .corrected_word 27 27 { 28 color: #005500; 29 } 30 31 32 .ignore { 33 cursor: pointer; 34 text-decoration: underline; 35 font-family: Verdana, Arial, Helvetica, sans-serif; 36 font-size: 11px; 28 37 color: #005500; 29 38 } -
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/js/spell_checker.js
r2407 r2430 40 40 var currObj; //the current spell checker being used 41 41 var spellingSuggestionsDiv; 42 var old_onclick 42 var old_onclick; 43 var positionEditor; 44 var areaEditor; 45 var abaEditor; 43 46 cp = new cpaint(); 44 47 cp.set_transfer_mode('post'); 45 48 cp.set_response_type('text'); 46 function beginSpellCheck(){ 47 49 function beginSpellCheck(position, area, aba){ 50 51 48 52 //var cp = new cpaint(); 49 // alert("Seta globals");53 // alert("Seta globals"); 50 54 //cp = new cpaint(); 51 55 //cp.set_transfer_mode('post'); … … 56 60 //var spellingSuggestionsDiv = null; // Auto-generated suggestions div 57 61 62 spellingSuggestionsDiv = null; 63 positionEditor = position; 64 areaEditor = area; 65 abaEditor = aba; 58 66 59 spellingSuggestionsDiv = null;60 67 61 68 //alert("Seta globals"); … … 118 125 function setupSpellCheckers() 119 126 { 120 var ifr = document.getElementsByTagName('iframe')[0]; 121 var numSpellCheckers = 0; 122 //var tempSpellCheckers = Array(); 123 124 if(ifr.contentWindow) 125 ifr=ifr.contentWindow.document; 126 else 127 ifr=ifr.contentDocument; 128 var texto = ifr.body.innerHTML; 129 130 // alert("valor textarea"); 131 // alert(texto); 132 // //tempSpellCheckers[numSpellCheckers] = textareas; 133 var tempWidth = "300"; 134 var tempHeight = "300"; 135 136 // alert("Antes AjaxSpell"); 137 eval('spellCheckers' + numSpellCheckers + '= new ajaxSpell("spellCheckers' + numSpellCheckers + '", tempWidth, tempHeight, "spell_checker/spell_checker.php", "body_position_1", "Nome", "body_1", "Titulo", texto);'); 138 139 140 //new ajaxSpell('spellTexto', tempWidth, tempHeight, 'spell_checker.php' ,'body_position_1', 'Nome','body_1', 'Titulo', texto); 141 142 //ajaxSpell("", "", "", "" ,"", "","", "", ""); 143 144 //} 145 146 /*for(var i=0; i < textareas.length; i++) 147 { 148 alert("ok iframe"); 149 if(textareas[i].getAttribute("title") == "spellcheck" || textareas[i].getAttribute("title") == "spellcheck_icons") 150 { 151 tempSpellCheckers[numSpellCheckers] = textareas[i]; 152 153 //create a new spellchecker for this textarea 154 var tempWidth = tempSpellCheckers[numSpellCheckers].offsetWidth + 'px'; 155 var tempHeight = tempSpellCheckers[numSpellCheckers].offsetHeight + 'px'; 156 eval('spellCheckers' + numSpellCheckers + '= new ajaxSpell("spellCheckers' + numSpellCheckers + '", tempWidth, tempHeight, tempSpellCheckers[' + numSpellCheckers + '].getAttribute("accesskey"), "spellCheckDiv' + numSpellCheckers + '", tempSpellCheckers[' + numSpellCheckers + '].getAttribute("name"), tempSpellCheckers[' + numSpellCheckers + '].id, tempSpellCheckers[' + numSpellCheckers + '].title, tempSpellCheckers[' + numSpellCheckers + '].value);'); 157 numSpellCheckers++; 158 } 159 }*/ 127 var ifr = document.getElementsByTagName('iframe')[0]; 128 var numSpellCheckers = abaEditor; 129 130 if(ifr.contentWindow) 131 ifr=ifr.contentWindow.document; 132 else 133 ifr=ifr.contentDocument; 134 var texto = ifr.body.innerHTML; 135 136 var tempWidth = "99%"; 137 var tempHeight = "300"; 138 139 eval('spellCheckers' + numSpellCheckers + '= new ajaxSpell("spellCheckers' + numSpellCheckers + '", tempWidth, tempHeight, "spell_checker/spell_checker.php", positionEditor, "Nome", areaEditor, "Titulo", texto);'); 160 140 161 141 }; // end setInit … … 181 161 function ajaxSpell(varName, width, height, spellUrl, divId, name, id, title, value) 182 162 { 183 //alert("ajaxSpell"); 184 163 185 164 currObj = this; 186 165 … … 195 174 currObj.config['title'] = title; //the title (specifies whether to use icons or not); 196 175 currObj.config['value'] = value; //the value of the text box when the page was loaded 197 198 currObj.config['value'] = currObj.config['value'].replace(/<br *\/?>/gi, "\n"); 176 currObj.config['aba'] = abaEditor; 177 178 //currObj.config['value'] = currObj.config['value'].replace(/<br *\/?>/gi, "\n"); // Comment from the original by Nathalie 199 179 200 180 currObj.config['useIcons'] = false; … … 243 223 oldElement.value = currObj.config['value']; 244 224 document.getElementById(currObj.config['divId']).appendChild(oldElement); 225 245 226 246 227 currObj.objToCheck = document.getElementById(currObj.config['id']); //the actual object we're spell checking … … 258 239 ajaxSpell.prototype.resetSpellChecker = resetSpellChecker; 259 240 ajaxSpell.prototype.resetAction = resetAction; 241 242 243 260 244 }; // end ajaxSpell 261 245 … … 271 255 function setCurrentObject(obj) 272 256 { 273 currObj = obj; 257 currObj = obj; 258 274 259 275 260 }; // end setCurrentObject … … 295 280 var isThereAMisspelling = new_data.charAt(0); 296 281 new_data = new_data.substring(1); 297 282 298 283 if(currObj.spellingResultsDiv) 299 284 { 285 300 286 currObj.spellingResultsDiv.parentNode.removeChild(spellingResultsDiv); 301 287 } 302 303 currObj.spellingResultsDiv =document.createElement('DIV');288 289 currObj.spellingResultsDiv = document.createElement('DIV'); 304 290 currObj.spellingResultsDiv.className = 'edit_box'; 305 currObj.spellingResultsDiv.style.width = currObj.objToCheck.style.width; 306 currObj.spellingResultsDiv.style.height = currObj.objToCheck.style.height; 291 currObj.spellingResultsDiv.id = 'edit_box'; //Added the id property - By Nathalie 292 currObj.spellingResultsDiv.style.width = "99%";//the width of the textarea 293 currObj.spellingResultsDiv.style.height = 300; // = height; //currObj.objToCheck.style.height; 307 294 currObj.spellingResultsDiv.innerHTML = new_data; 308 309 currObj.objToCheck.style.display = "none";295 296 currObj.objToCheck.style.display = "none"; 310 297 currObj.objToCheck.parentNode.insertBefore(currObj.spellingResultsDiv,currObj.objToCheck); 311 currObj.statusSpan.innerHTML = ""; 312 298 currObj.statusSpan.innerHTML = ""; 299 300 313 301 if(currObj.config['useIcons']) 314 302 { … … 346 334 with(currObj); 347 335 var query; 348 336 349 337 if(currObj.spellingResultsDiv) 350 338 { … … 382 370 383 371 query = texto; 384 //query = currObj.objToCheck.value; 385 386 query = query.replace(/\r?\n/gi, "<br />"); 372 //query = currObj.objToCheck.value; 373 374 //query = query.replace(/\r?\n/gi, "<br />"); // Commented from the original by Nathalie 375 query = query.replace(/\r?\n/gi, " "); // replace \n with " " - By Nathalie 376 387 377 388 378 cp.call(currObj.config['spellUrl'], 'spellCheck', spellCheck_cb, query, currObj.config['varName']); … … 436 426 function addWord_cb(returnedData) 437 427 { 438 //alert(returnedData);439 428 with(currObj); 440 429 currObj.statusSpan.innerHTML = ""; … … 459 448 function checkClickLocation(e) 460 449 { 461 462 // alert("checkClickLocation"); 450 463 451 if(spellingSuggestionsDiv) 464 452 { … … 523 511 function checkBrowser() 524 512 { 513 525 514 var theAgent = navigator.userAgent.toLowerCase(); 526 515 if(theAgent.indexOf("msie") != -1) … … 581 570 function showSuggestions_cb(new_data) 582 571 { 583 with(currObj); 572 573 with(currObj); 584 574 spellingSuggestionsDiv.innerHTML = new_data; 585 575 spellingSuggestionsDiv.style.display = 'block'; … … 605 595 function showSuggestions(word, id) 606 596 { 607 with(currObj); 597 598 with(currObj); 608 599 if(currObj.config['useIcons']) 609 600 { … … 663 654 function replaceWord(id, newWord) 664 655 { 656 665 657 document.getElementById(id).innerHTML = trim(newWord); 666 658 if(spellingSuggestionsDiv) … … 688 680 function switchText() 689 681 { 690 with(currObj); 691 var parentElement = currObj.spellingResultsDiv; 682 683 with(currObj); 684 685 //By Nathalie - The Element means that this div belongs to the current tab 686 var parentElement = Element(currObj.spellingResultsDiv.id); 692 687 693 688 // Obtain all span tags which have highlight className or corrected_word className … … 735 730 function switchText_cb(new_string) 736 731 { 737 with(currObj); 738 732 733 with(currObj); 734 739 735 new_string = new_string.replace(/ %u2026/gi, " "); // Replace the code %u2026 with 740 736 … … 745 741 746 742 747 currObj.objToCheck.style.display = "none";743 currObj.objToCheck.style.display = "none"; 748 744 var ifr= currObj.objToCheck; 749 745 if(ifr.contentWindow) … … 755 751 ifr.body.innerHTML = new_string; 756 752 currObj.objToCheck.disabled = false; 753 757 754 if(currObj.spellingResultsDiv) 758 755 { … … 776 773 function resumeEditing() 777 774 { 775 776 with(currObj); 777 if(currObj.config['useIcons']) 778 { 779 currObj.actionSpan.innerHTML = "<a class=\"resume_editing\"><img src=\"images/page_white_edit.png\" width=\"16\" height=\"16\" title=\"Continuar Editando\" alt=\"Continuar Editando\" border=\"0\" /></a>"; 780 } 781 else 782 { 783 currObj.actionSpan.innerHTML = "<a class=\"resume_editing\">Continuar Editando</a>"; 784 } 785 if(currObj.config['useIcons']) 786 { 787 currObj.statusSpan.innerHTML = "<img src=\"images/working.gif\" width=\"16\" height=\"16\" title=\"Carregando...\" alt=\"Carregando...\" border=\"0\" />"; 788 } 789 else 790 { 791 currObj.statusSpan.innerHTML = "Carregando..."; 792 } 793 794 795 if(spellingSuggestionsDiv) 796 { 797 798 spellingSuggestionsDiv.id.parentNode.removeChild(spellingSuggestionsDiv); 799 spellingSuggestionsDiv = null; 800 } 801 802 currObj.switchText(); 803 }; // end resumeEditing 804 805 806 /************************************************************* 807 * resetAction 808 * 809 * The resetAction function just resets the status message to 810 * the default action of "Check Spelling". 811 *************************************************************/ 812 function resetAction() 813 { 814 778 815 with(currObj); 779 816 if(currObj.config['useIcons']) 780 817 { 781 currObj.actionSpan.innerHTML = "<a class=\"resume_editing\"><img src=\"images/page_white_edit.png\" width=\"16\" height=\"16\" title=\"Continuar Editando\" alt=\"Continuar Editando\" border=\"0\" /></a>";782 }783 else784 {785 currObj.actionSpan.innerHTML = "<a class=\"resume_editing\">Continuar Editando</a>";786 }787 if(currObj.config['useIcons'])788 {789 currObj.statusSpan.innerHTML = "<img src=\"images/working.gif\" width=\"16\" height=\"16\" title=\"Carregando...\" alt=\"Carregando...\" border=\"0\" />";790 }791 else792 {793 currObj.statusSpan.innerHTML = "Carregando...";794 }795 796 797 if(spellingSuggestionsDiv)798 {799 800 spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv);801 spellingSuggestionsDiv = null;802 }803 804 currObj.switchText();805 }; // end resumeEditing806 807 808 /*************************************************************809 * resetAction810 *811 * The resetAction function just resets the status message to812 * the default action of "Check Spelling".813 *************************************************************/814 function resetAction()815 {816 with(currObj);817 if(currObj.config['useIcons'])818 {819 818 currObj.actionSpan.innerHTML = "<a class=\"check_spelling\" onclick=\"setCurrentObject(" + currObj.config['varName'] + "); " + currObj.config['varName'] + ".spellCheck();\"><img src=\"images/spellcheck.png\" width=\"16\" height=\"16\" title=\"Verificar Ortografia\" alt=\"Verificar Ortografia\" border=\"0\" /></a>"; 820 819 } … … 836 835 function resetSpellChecker() 837 836 { 837 838 838 with(currObj); 839 839 currObj.resetAction(); … … 870 870 function findPosXById(object) 871 871 { 872 var curleft = 0; 872 873 var curleft = 0; 873 874 var obj = document.getElementById(object); 874 875 if(obj.offsetParent) … … 900 901 function findPosYById(object) 901 902 { 903 902 904 var curtop = 0;var curtop = 0; 903 905 var obj = document.getElementById(object); … … 928 930 function trim(s) 929 931 { 932 930 933 while(s.substring(0,1) == ' ') 931 934 { -
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php
r2405 r2430 126 126 $retVal .= "<div class=\"addtoDictionary\" onclick=\"addWord('" . addslashes_custom($id) . "'); return false;\">Add To Dictionary</div>"; 127 127 } 128 129 //Ignore the suggestion - Added by Nathalie 130 $retVal .= "<div class=\"ignore\" onclick=\"replaceWord('" . addslashes_custom($id) . "', '" . addslashes($word) . "'); return false;\"> Ignorar </div>"; 131 132 128 133 } 129 134 else 130 135 { 131 $retVal .= " No Suggestions";136 $retVal .= "Sem sugestão"; 132 137 } 133 138
Note: See TracChangeset
for help on using the changeset viewer.