Changeset 2543
- Timestamp:
- 04/14/10 18:37:32 (14 years ago)
- Location:
- sandbox/expressoMail1_2/corretor_ortografico/spell_checker
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/js/spell_checker.js
r2540 r2543 325 325 ajaxSpell.prototype.resetSpellChecker = resetSpellChecker; 326 326 ajaxSpell.prototype.resetAction = resetAction; 327 328 329 327 ajaxSpell.prototype.ignore = ignore; 328 329 330 //set the contentEditable to false for IE browsers 330 331 var iframe= currObj.objToCheck; 331 332 if(iframe.contentWindow) … … 556 557 if (document.addEventListener) { 557 558 ifr.getElementsByTagName("div")[i].addEventListener("click", showMenu , true); 558 ifr.getElementsByTagName("div")[i].style.cursor = "pointer"; 559 //ifr.getElementsByTagName("div")[i].contentEditable="false" ; 559 ifr.getElementsByTagName("div")[i].contentEditable="false" ; 560 560 } 561 561 else { 562 562 ifr.getElementsByTagName("div")[i].attachEvent("onclick", showMenu ); 563 //ifr.getElementsByTagName("div")[i].contentEditable="false" ;563 ifr.getElementsByTagName("div")[i].contentEditable="false" ; 564 564 } 565 565 … … 969 969 ifr=ifr.contentDocument; 970 970 971 //alterado - colocar ifr 972 languageId = document.getElementById("selectLanguage"); 973 languageId = languageId[document.getElementById("selectLanguage").selectedIndex].value; 974 975 976 with(currObj); 977 if(currObj.config['useIcons']) 978 { 979 currObj.statusSpan.innerHTML = "<img src=\"images/working.gif\" width=\"16\" height=\"16\" title=\"Procurando...\" alt=\"Procurando...\" border=\"0\" />"; 980 } 981 else 982 { 983 currObj.statusSpan.innerHTML = "Procurando..."; 984 } 985 986 var x = findPosXById(id); 987 var y = findPosYById(id); 988 989 var scrollPos = 0; 990 if(checkBrowser() != "ie") 991 { 992 993 994 //scrollPos = ifr.getElementById(currObj.spellingResultsDiv.id).scrollTop; 995 scrollPos = ifr.getElementsByTagName("body")[0].scrollTop; 996 997 } 998 999 if(spellingSuggestionsDiv) 1000 { 1001 spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv); 1002 } 1003 spellingSuggestionsDiv = ifr.createElement('div'); 1004 spellingSuggestionsDiv.style.display = "none"; 1005 spellingSuggestionsDiv.className = 'suggestion_box'; 1006 spellingSuggestionsDiv.style.position = 'absolute'; 1007 spellingSuggestionsDiv.style.left = x + 'px'; 1008 spellingSuggestionsDiv.style.top = (y+16-scrollPos) + 'px'; 1009 spellingSuggestionsDiv.id = 'suggestion_box'; //Adicionado Nathalie 1010 spellingSuggestionsDiv.contentEditable="false" ; 1011 1012 1013 1014 1015 1016 1017 1018 1019 // Bah. There's got to be a better way to deal with this, but the click 1020 // on a word to get suggestions starts up a race condition between 1021 // showing and hiding the suggestion box, so we'll ignore the first 1022 // click. 1023 //spellingSuggestionsDiv.ignoreNextClick = true; // comentado Nathalie 1024 1025 1026 //document.body.appendChild(spellingSuggestionsDiv); 1027 ifr.body.appendChild(spellingSuggestionsDiv); //alterado nathalie 1028 1029 1030 1031 1032 1033 cp.call(currObj.config['spellUrl'], 'showSuggestions', showSuggestions_cb, word, id, languageId); 971 if (ifr.getElementById(id).className == "highlight"){ //show the suggestion box only when the words are in red 972 973 //alterado - colocar ifr 974 languageId = document.getElementById("selectLanguage"); 975 languageId = languageId[document.getElementById("selectLanguage").selectedIndex].value; 976 977 978 with(currObj); 979 if(currObj.config['useIcons']) 980 { 981 currObj.statusSpan.innerHTML = "<img src=\"images/working.gif\" width=\"16\" height=\"16\" title=\"Procurando...\" alt=\"Procurando...\" border=\"0\" />"; 982 } 983 else 984 { 985 currObj.statusSpan.innerHTML = "Procurando..."; 986 } 987 988 var x = findPosXById(id); 989 var y = findPosYById(id); 990 991 var scrollPos = 0; 992 if(checkBrowser() != "ie") 993 { 994 995 996 //scrollPos = ifr.getElementById(currObj.spellingResultsDiv.id).scrollTop; 997 scrollPos = ifr.getElementsByTagName("body")[0].scrollTop; 998 999 } 1000 1001 if(spellingSuggestionsDiv) 1002 { 1003 spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv); 1004 } 1005 spellingSuggestionsDiv = ifr.createElement('div'); 1006 spellingSuggestionsDiv.style.display = "none"; 1007 spellingSuggestionsDiv.className = 'suggestion_box'; 1008 spellingSuggestionsDiv.style.position = 'absolute'; 1009 spellingSuggestionsDiv.style.left = x + 'px'; 1010 spellingSuggestionsDiv.style.top = (y+16-scrollPos) + 'px'; 1011 spellingSuggestionsDiv.id = 'suggestion_box'; //Adicionado Nathalie 1012 spellingSuggestionsDiv.contentEditable="false" ; 1013 1014 1015 1016 1017 1018 1019 1020 1021 // Bah. There's got to be a better way to deal with this, but the click 1022 // on a word to get suggestions starts up a race condition between 1023 // showing and hiding the suggestion box, so we'll ignore the first 1024 // click. 1025 //spellingSuggestionsDiv.ignoreNextClick = true; // comentado Nathalie 1026 1027 1028 //document.body.appendChild(spellingSuggestionsDiv); 1029 ifr.body.appendChild(spellingSuggestionsDiv); //alterado nathalie 1030 1031 1032 1033 1034 1035 cp.call(currObj.config['spellUrl'], 'showSuggestions', showSuggestions_cb, word, id, languageId); 1036 } 1037 1034 1038 }; // end showSuggestions 1035 1039 … … 1059 1063 else 1060 1064 ifr=ifr.contentDocument; 1061 1062 1065 1063 1066 var valorNo = trim(ifr.getElementById(id).innerHTML); 1064 1067 1065 //ifr.location.reload(true); 1066 1067 //alert(ifr.getElementById(currObj.spellingResultsDiv.id).getElementsByTagName("div").length); 1068 //ifr.getElementById(currObj.spellingResultsDiv.id).style.display = 'none'; 1069 1070 1071 //ifr.getElementById(currObj.spellingResultsDiv.id). 1072 1073 1074 1068 1075 1069 // Obtain all span tags which have highlight className and contais the old word 1076 1070 var nodeArray = ifr.getElementsByTagName("div"); … … 1090 1084 ifr.getElementById(nodeRemove[i]).innerHTML = newWord; 1091 1085 ifr.getElementById(nodeRemove[i]).className = "corrected_word"; 1092 } 1093 1094 1086 } 1095 1087 1096 1088 … … 1099 1091 spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv); 1100 1092 spellingSuggestionsDiv = null; 1093 } 1094 1095 return false; 1096 1097 1098 }; // end replaceWord 1099 1100 1101 /************************************************************* 1102 * ignore 1103 * 1104 * The ignore function removes the span tags and mantain 1105 * the original word. So, the word comes back to the original, without 1106 * css. 1107 * 1108 * @param id The id of the element to be checked 1109 * @param word The original word. 1110 *************************************************************/ 1111 1112 function ignore(id, word){ 1113 1114 1115 var ifr= currObj.objToCheck; 1116 if(ifr.contentWindow) 1117 ifr=ifr.contentWindow.document; 1118 else 1119 ifr=ifr.contentDocument; 1120 1121 var valorNo = trim(word); 1122 if(spellingSuggestionsDiv) 1123 { 1124 1125 spellingSuggestionsDiv.style.display = 'none'; 1126 spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv); 1127 spellingSuggestionsDiv = null; 1101 1128 } 1102 1129 1103 /*var nodeArray = ifr.getElementsByTagName("img"); 1104 1105 var totArray = nodeArray.length; 1106 for (var i = 0 ; i < totArray ; i++) { 1107 alert("Tem Imagem"); 1108 var node = nodeArray[i]; 1109 ifr.getElementsByTagName("img")[i].style = 'none'; 1110 }*/ 1111 1130 var fake = ifr.createTextNode(valorNo); 1131 1132 var parent = ifr.getElementById(id).parentNode; 1133 1134 1135 parent.replaceChild(fake, ifr.getElementById(id)); 1112 1136 1113 1137 return false; 1114 1138 1115 1139 1116 // FIMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 1117 1118 //Função antiga - substitui apenas uma palavra 1119 /* var ifr= currObj.objToCheck; 1120 if(ifr.contentWindow) 1121 ifr=ifr.contentWindow.document; 1122 else 1123 ifr=ifr.contentDocument; 1124 1125 var valorNo = trim(newWord); 1126 if(spellingSuggestionsDiv) 1127 { 1128 1129 spellingSuggestionsDiv.style.display = 'none'; 1130 spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv); 1131 spellingSuggestionsDiv = null; 1132 } 1133 1134 var fake = document.createTextNode(valorNo); 1135 1136 var parent = ifr.getElementById(id).parentNode; 1137 1138 1139 parent.replaceChild(fake, ifr.getElementById(id)); 1140 1141 return false;*/ 1142 1143 1144 1145 1146 }; // end replaceWord 1140 1141 }; 1142 1143 1147 1144 1148 1145 … … 1301 1298 } 1302 1299 1303 1300 //set the contentEditable to true for IE browsers to continue editing 1304 1301 var iframe= currObj.objToCheck; 1305 1302 if(iframe.contentWindow) … … 1311 1308 if (browser == "ie"){ 1312 1309 iframe.body.contentEditable="true" ; 1313 //iframe.body.contentEditable="true" ;1310 1314 1311 } 1315 1316 1317 1312 1318 1313 currObj.switchText(); -
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php
r2536 r2543 129 129 130 130 //Ignore the suggestion - Added by Nathalie 131 $retVal .= "<div class=\"ignore\" onclick=\" replaceWord('" . addslashes_custom($id) . "', '" . addslashes($word) . "'); return false;\"> Ignorar </div>";131 $retVal .= "<div class=\"ignore\" onclick=\"ignore('" . addslashes_custom($id) . "', '" . addslashes($word) . "'); return false;\"> Ignorar </div>"; 132 132 133 133 … … 136 136 { 137 137 $retVal .= "Sem sugestão"; 138 $retVal .= "<div class=\"ignore\" onclick=\" replaceWord('" . addslashes_custom($id) . "', '" . addslashes($word) . "'); return false;\"> Ignorar </div>";138 $retVal .= "<div class=\"ignore\" onclick=\"ignore('" . addslashes_custom($id) . "', '" . addslashes($word) . "'); return false;\"> Ignorar </div>"; 139 139 } 140 140
Note: See TracChangeset
for help on using the changeset viewer.