1$(document).ready(function () { 2 var pageNo = 1; 3 var pageSize = 9; 4 var culture = $("#culture").val(); 5 var hasResult = false; 6 var topics = []; 7 8 $('#filterFaqData').on('click', function () { 9 pageNo = 1; 10 var obj = getDataSet(); 11 getFaqs(obj); 12 }); 13 14 $(".searchInput #eServiceResult").keypress(function (event) { 15 if (event.keyCode === 13) { 16 pageNo = 1; 17 var obj = getDataSet(); 18 getFaqs(obj); 19 } 20 }); 21 22 $('body').on('click', '#activateAllTabsButton', function () { 23 var activeTopic = $(this).attr('data-topic'); 24 var obj = getDataSet(activeTopic); 25 if (obj) { 26 getFaqs(obj); 27 } 28 }); 29 30 $('body').on('click', '#topics-list li a', function () { 31 pageNo = 1; 32 var activeTopic = $(this).attr('data-topic'); 33 var obj = getDataSet(activeTopic); 34 if (obj) { 35 getFaqs(obj); 36 } 37 }); 38 39 var obj = getDataSet(); 40 if (obj) { 41 if (obj.page && obj.page === "faqs") { 42 var query = getQueryParams(); 43 if (query && query.topic) { 44 $(".faqSIdeMenu li a").each(function (ind, val) { 45 var itemId = $(this).attr('data-item-id'); 46 if (itemId && itemId == query.topic) { 47 topic = $(this).attr('data-topic'); 48 if (topic) { 49 obj.topic = topic; 50 } 51 } 52 }); 53 } 54 getFaqs(obj); 55 } 56 } 57 58 function getDataSet(topic = "All") { 59 var obj = { 60 keyword: $('#eServiceResult').val(), 61 page: $('#page').val(), 62 topic: topic 63 } 64 return obj; 65 } 66 67 getTopics(); 68 69 function getTopics() { 70 $('#topics-list li').each(function (ind, val) { 71 var topic = $(val).find('a').attr('data-topic'); 72 if (topic && topic !== "All") { 73 topics.push(topic); 74 } 75 }); 76 } 77 78 function getFaqs(obj) { 79 if (obj) { 80 $.ajax({
81 type: "POST", 82 url: '/api/feature/Faqs/GetFaqs', 83 data: JSON.stringify( 84 { 85 keyword: obj.keyword, 86 topic: obj.topic, 87 pageNo: pageNo, 88 pageSize: pageSize, 89 culture: culture 90 } 91 ), 92 contentType: "application/json; charset=utf-8", 93 success: function (response) { 94 var data = ""; 95 var html = ""; 96 if (response != "error") { 97 data = $.parseJSON(response); 98 } 99 if (data != "" && data != undefined && data != null) { 100 if (data.Items.length > 0) { 101 hasResult = true; 102 html = _topicsTemplate(data.Items, obj.topic); 103 $('#faqTabContent').html(''); 104 $('#faqTabContent').html(html); 105 var showingTitle = $('#showingOf').val(); 106 showingTitle = showingTitle.replace('{0}', data.PageRecordTo); 107 showingTitle = showingTitle.replace('{1}', data.TotalRecordCount); 108 $('.searchResultShowing h6').text(showingTitle); 109 $('.searchResultPagination').show(); 110 111 112 $(".faqSIdeMenu li a").each(function (ind, val) { 113 var datatopic = $(this).attr('data-topic'); 114 if (datatopic && datatopic == obj.topic) { 115 $(this).addClass('active'); 116 } 117 else { 118 $(this).removeClass('active'); 119 } 120 }); 121 122 123 124 125 if (hasResult) { 126 if (data.TotalRecordCount > data.PageSize) { 127 $('.searchResultPagination .general-pagination').show(); 128 $(".Pager").ASPSnippets_Pager({ 129 ActiveCssClass: "active", 130 PagerCssClass: "pager", 131 PageIndex: data.PageNo, 132 PageSize: data.PageSize, 133 RecordCount: data.TotalRecordCount 134 }); 135 } 136 else { 137 $('.general-pagination').hide(); 138 } 139 } 140 animateElements(); 141 142 setTimeout(function () { 143 $(".page").each(function () { 144 $(this).bind("click", function () { 145 pageNo = parseInt($(this).attr('page')); 146 var activeTopic = $(".faqsTabsContainer ul li a.active").attr("data-topic"); 147 var obj = getDataSet(activeTopic); 148 if (obj) { 149 getFaqs(obj); 150 $('html, body').animate({ 151 scrollTop: $(".scrollToSection").offset().top - headerHeight - $('.innerSearchSticky').innerHeight() - 50 152 }, 500); 153 } 154 }) 155 }); 156 }, 800); 157 } 158 else { 159 $('.searchResultPagination .general-pagination').hide(); 160 $('#faqTabContent').html(''); 161 $('#faqTabContent').html('<h3 style="justify-content:center"><span class="resizable">' + $('#noRecordFound').val() + '</span></h3>'); 162 $('.searchResultPagination').hide(); 163 } 164 } 165 else { 166 $('.searchResultPagination .general-pagination').hide(); 167 $('#faqTabContent').html(''); 168 $('#faqTabContent').html('<h3 style="justify-content:center"><span class="resizable">' + $('#noRecordFound').val() + '</span></h3>'); 169 $('.searchResultPagination').hide(); 170 } 171 }, 172 complete: function () { 173 }, 174 error: function (xhr, ajaxOptions, thrownError) { 175 console.log(xhr.status); 176 console.log(thrownError); 177 } 178 }); 179 } 180 } 181 182 function _topicsTemplate(obj, title) { 183 184 let _template = ``; 185 $.each(topics, function (ind, topic) { 186 var topicList = $.grep(obj, function (element) { 187 return element.Topic != null && element.Topic != '' && element.Topic.indexOf(topic) >= 0; 188 }); 189 if (topicList && topicList.length > 0) { 190 _template += `<h2 class="animate" data-animation="fadeInUp" data-duration="300"><span class="resizable">${topic}</span></h2>`; 191 _template += `<div class="accordion accordion-flush faqsAccordion" id="${topic.replace(/\ /g, '-')}">`; 192 $.each(topicList, function (indT, listItem) { 193 _template += `<div class="accordion-item animate" data-animation="fadeInUp" data-duration="300"> 194 <h4 class="accordion-header" id="${listItem.ID}"> 195 <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#impTop-${listItem.ID}" aria-expanded="false" aria-controls="impTop-${listItem.ID}">
196 <span class="resizable">${listItem.QuestionTitle}</span> 197 </button> 198 </h4> 199 <div id="impTop-${listItem.ID}" class="accordion-collapse collapse" aria-labelledby="${listItem.ID}" data-bs-parent="#${topic.replace(/\ /g, '-')}"> 200 <div class="accordion-body"> 201 <div class="accordion-header-detail"> 202 <p class="lead"><span class="resizable">${listItem.QuestionAmswer}</span></p> 203 </div> 204 </div> 205 </div> 206 </div>`; 207 }); 208 _template += `</div>`; 209 } 210 }); 211 return _template; 212 } 213 214 function getQueryParams() { 215 const paramArr = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 216 const params = {}; 217 paramArr.map(param => { 218 var [key, val] = param.split('='); 219 val = decodeURIComponent((val + '').replace(/\+/g, '%20')); 220 const stripHTMLTags = str => str.replace(/<[^>]*>/g, ''); 221 params[key] = stripHTMLTags(val); 222 }); 223 return params; 224 } 225});
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.