Ignore:
Timestamp:
2012-05-31T11:57:46+12:00 (12 years ago)
Author:
sjm84
Message:

Fixing missing annotations from searching

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js

    r25660 r25720  
    2626    template += '</xsl:template>';
    2727
     28    var hlCheckBox = document.getElementById("highlightOption");
     29   
     30    var hl = "";
     31    if(hlCheckBox)
     32    {
     33        if(hlCheckBox.checked)
     34        {
     35            hl = "on";
     36        }
     37        else
     38        {
     39            hl = "off";
     40        }
     41    }
     42   
    2843    var ajax = gs.functions.ajaxRequest();
    29     ajax.open("GET", gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?p.s=TextQuery&ilt=" + template.replace(" ", "%20"), true);
     44    ajax.open("GET", gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?hl=" + hl + "&p.s=TextQuery&ilt=" + template.replace(" ", "%20"), true);
    3045    ajax.onreadystatechange = function()
    3146    {
     
    911926* HIGHLIGHTING SCRIPTS *
    912927***********************/
    913 function addHighlight()
    914 {
     928function swapHighlight()
     929{
     930    var hlCheckbox = document.getElementById("highlightOption");
     931   
     932    var from;
     933    var to;
     934    if(hlCheckbox.checked)
     935    {
     936        from = "noTermHighlight";
     937        to = "termHighlight";
     938    }
     939    else
     940    {
     941        from = "termHighlight";
     942        to = "noTermHighlight";
     943    }
     944   
    915945    var spans = document.getElementsByTagName("span");
    916946    for(var i = 0; i < spans.length; i++)
    917947    {
    918948        var currentSpan = spans[i];
    919         if(currentSpan.getAttribute("class") == "noTermHighlight")
    920         {
    921             currentSpan.setAttribute("class", "termHighlight");
    922         }
    923     }
    924    
    925     var option = document.getElementById("highlightOption");
    926     option.setAttribute("onclick", "removeHighlight();");
    927 }
    928 
    929 function removeHighlight()
    930 {
    931     var spans = document.getElementsByTagName("span");
    932     for(var i = 0; i < spans.length; i++)
    933     {
    934         var currentSpan = spans[i];
    935         if(currentSpan.getAttribute("class") == "termHighlight")
    936         {
    937             currentSpan.setAttribute("class", "noTermHighlight");
    938         }
    939     }
    940    
    941     var option = document.getElementById("highlightOption");
    942     option.setAttribute("onclick", "addHighlight();");
     949        if(currentSpan.getAttribute("class") == from)
     950        {
     951            currentSpan.setAttribute("class", to);
     952        }
     953    }
    943954}
    944955
Note: See TracChangeset for help on using the changeset viewer.