- Timestamp:
- 2012-05-31T11:57:46+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js
r25660 r25720 26 26 template += '</xsl:template>'; 27 27 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 28 43 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); 30 45 ajax.onreadystatechange = function() 31 46 { … … 911 926 * HIGHLIGHTING SCRIPTS * 912 927 ***********************/ 913 function addHighlight() 914 { 928 function 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 915 945 var spans = document.getElementsByTagName("span"); 916 946 for(var i = 0; i < spans.length; i++) 917 947 { 918 948 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 } 943 954 } 944 955
Note:
See TracChangeset
for help on using the changeset viewer.