1// JavaScript Document 2 3$(document).ready(function() { 4 5 var errMsg = readCookie('ERRMSG'); 6 if (errMsg) { 7 eraseCookie('ERRMSG'); 8 $('#errMsg').html('<table border="1" cellpadding="11"><tr>' + 9 '<td style="color:red;background-color:#e8e8e8;font-size:14px;text-align:center">' + 10 unescape(errMsg) + '</td></tr></table>'); 11 } 12 13 var isloggedin = readCookie('caloggedin'); 14 15 if (isloggedin) { 16 //must be a member. we have a cookie 17 memberMenus(); 18 } 19 else { 20 visitorMenus(); 21 } 22 23 // Handle the enter key in the FAQ search text box 24 $('#faqSearchField').on('keypress', function (event) { 25 if (event.key === 'Enter') { 26 27 faqSearch(); 28 event.preventDefault(); 29 return false; 30 //Do Stuff, submit, etc.. 31 } 32 }); 33}); 34 35function verifyLogin() { 36} 37 38function setMemberCookie() { //cookie is set 39 createCookie('caloggedin', 'Bill Briant', 0); 40 memberMenus(); 41} 42 43function memberMenus() { //This sets up the menus for members only 44 $("li.memberonly").show(); 45 $("li#loggedin").show(); 46 $("li.visitoronly").hide(); 47} 48 49function visitorMenus() { //This sets up the menus for visitors only 50 $("li.memberonly").hide(); 51 $("li#loggedin").hide(); 52 $("li.visitoronly").show(); 53} 54 55function createCookie(name, value, days) { 56 if (days) { 57 var date = new Date(); 58 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 59 var expires = "; expires=" + date.toGMTString(); 60 } 61 else var expires = ""; 62 document.cookie = name + "=" + value + expires + "; path=/"; 63} 64 65function readCookie(name) { 66 var nameEQ = name + "="; 67 var ca = document.cookie.split(';'); 68 for (var i = 0; i < ca.length; i++) { 69 var c = ca[i]; 70 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 71 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 72 } 73 return null; 74} 75 76function eraseCookie(name) { 77 createCookie(name, "", -1); 78} 79 80 81 82function resetMemberCookie(){// 83eraseCookie('caloggedin'); 84visitorMenus(); 85 } 86 87function faqSearch(){ 88 var searchedText = ($("#faqSearchField").val() || "").trim().toLowerCase(); 89 90 $(".answer, .question").each(function () { 91 var found = 0; 92 var text = new Array(); 93 text = $(this).text().split(/[.,?\/ -]/); 94 95 for (i = 0; i < text.length; i++) { 96 if ((text[i].toLowerCase()) == searchedText) { 97 text[i] = "<span class='found'>" + 98 text[i] + "</span>" ; 99 found = 1; 100 } 101 if (found == 1){ 102 $(this).removeClass("show"); 103 $(this).addClass("show"); 104 } 105 else{$(this).removeClass("show");} 106 } 107 108 $('.question, .answer').removeHighlight(); 109 $('.question, .answer').highlight(searchedText); 110 }); 111} 112 113function scrollToItem(event, theitem) { 114 event.preventDefault(); // Prevents default anchor click behavior 115 116 $('html, body').animate({ 117 scrollTop: $(theitem).offset().top - 90 118 }, 500); 119}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.