Changeset 2543


Ignore:
Timestamp:
04/14/10 18:37:32 (14 years ago)
Author:
nathalie.silva
Message:

Ticket #891 - Alterado o ignore, e quando a palavra foi corrigida, não abre o suggestion- Nathalie

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  
    325325        ajaxSpell.prototype.resetSpellChecker    = resetSpellChecker; 
    326326        ajaxSpell.prototype.resetAction          = resetAction; 
    327  
    328  
    329  
     327        ajaxSpell.prototype.ignore               = ignore; 
     328 
     329 
     330        //set the contentEditable to false for IE browsers 
    330331        var iframe= currObj.objToCheck; 
    331332        if(iframe.contentWindow) 
     
    556557                if (document.addEventListener) { 
    557558                    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" ; 
    560560                } 
    561561                else { 
    562562                    ifr.getElementsByTagName("div")[i].attachEvent("onclick", showMenu ); 
    563                     //ifr.getElementsByTagName("div")[i].contentEditable="false" ; 
     563                    ifr.getElementsByTagName("div")[i].contentEditable="false" ; 
    564564                } 
    565565 
     
    969969            ifr=ifr.contentDocument; 
    970970 
    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 
    10341038}; // end showSuggestions 
    10351039 
     
    10591063    else 
    10601064        ifr=ifr.contentDocument; 
    1061     
    10621065 
    10631066    var valorNo = trim(ifr.getElementById(id).innerHTML); 
    10641067 
    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         
    10751069    // Obtain all span tags which have highlight className and contais the old word 
    10761070    var nodeArray = ifr.getElementsByTagName("div"); 
     
    10901084        ifr.getElementById(nodeRemove[i]).innerHTML = newWord; 
    10911085        ifr.getElementById(nodeRemove[i]).className = "corrected_word"; 
    1092     } 
    1093  
    1094      
     1086    }     
    10951087 
    10961088 
     
    10991091        spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv); 
    11001092        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 
     1112function 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; 
    11011128    } 
    11021129 
    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)); 
    11121136 
    11131137    return false; 
    11141138 
    11151139 
    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 
    11471144 
    11481145 
     
    13011298        } 
    13021299 
    1303  
     1300        //set the contentEditable to true for IE browsers to continue editing 
    13041301        var iframe= currObj.objToCheck; 
    13051302        if(iframe.contentWindow) 
     
    13111308        if (browser == "ie"){ 
    13121309            iframe.body.contentEditable="true" ; 
    1313         //iframe.body.contentEditable="true" ; 
     1310         
    13141311        } 
    1315  
    1316  
    13171312         
    13181313        currObj.switchText(); 
  • sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php

    r2536 r2543  
    129129 
    130130                //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>"; 
    132132 
    133133 
     
    136136        { 
    137137                $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>"; 
    139139        } 
    140140         
Note: See TracChangeset for help on using the changeset viewer.