Site Map


3M Aqua-Pure
Bosch
Culligan
Daewoo
SpiroPure
SpiroPure O
'; var thumbnailTemplate = '
'; var contentTemplate = '

[title]

[description]

[metaContentTemplate]
'; var contentWithoutImageTemplate = '

[title]

[description]

[metaContentTemplate]'; var metaContentTemplate = '
[ratingTemplate]
'; var ratingReviewTemplate = ''; var priceTemplate = '

[price] [inStock]

'; searchResult.items.forEach((item, index) => { var description = ''; var thumbnailTemplate1 = thumbnailTemplate; var contentTemplate1 = contentTemplate; var searchResultTemplate1 = searchResultTemplate; var metaContentTemplate1 = metaContentTemplate; var ratingReviewTemplate1 = ratingReviewTemplate; var templateVariableList = {}; var contentTemplateItems = {}; description = item.snippet; contentTemplateItems['[title]'] = item.title; contentTemplateItems['[titleURL]'] = item.link; contentTemplateItems['[description]'] = description; if (item.pagemap != undefined) { var aggregateRating = item.pagemap.aggregaterating; if (aggregateRating != null && aggregateRating != undefined && aggregateRating.length > 0) { var ratingvalue = parseFloat(aggregateRating[0].ratingvalue); var reviewcount = aggregateRating[0].reviewcount; ratingReviewTemplate1 = ratingReviewTemplate1.replace('[rateIndex]', index); ratingReviewTemplate1 = ratingReviewTemplate1.replace('[reviewCount]', reviewcount); var ratingIndex = 0; if (ratingvalue >= 4.5) { ratingReviewTemplate1 = ratingReviewTemplate1.replace('[isChecked5]', 'checked'); } else if (ratingvalue >= 3.5 && ratingvalue < 4.5) { ratingReviewTemplate1 = ratingReviewTemplate1.replace('[isChecked4]', 'checked'); } else if (ratingvalue >= 2.5 && ratingvalue < 3.5) { ratingReviewTemplate1 = ratingReviewTemplate1.replace('[isChecked3]', 'checked'); } else if (ratingvalue >= 1.5 && ratingvalue < 2.5) { ratingReviewTemplate1 = ratingReviewTemplate1.replace('[isChecked2]', 'checked'); } else if (ratingvalue >= 0.5 && ratingvalue < 1.5) { ratingReviewTemplate1 = ratingReviewTemplate1.replace('[isChecked1]', 'checked'); } // Replace rest values with ''. for (var i = 1; i <= 5; i++) { ratingReviewTemplate1 = ratingReviewTemplate1.replace('[isChecked' + i + ']', ''); } metaContentTemplate1 = metaContentTemplate1.replace('[ratingTemplate]', ratingReviewTemplate1); contentTemplateItems['[metaContentTemplate]'] = metaContentTemplate1; } else { contentTemplateItems['[metaContentTemplate]'] = ''; } var source = (item.pagemap == undefined && item.pagemap.thumbnail == undefined) ? (item.pagemap == undefined && item.pagemap.cse_thumbnail == undefined) ? undefined : item.pagemap.cse_thumbnail : item.pagemap.thumbnail; if (source != null && source != undefined && source.length > 0) { // Replacing thumbnail. thumbnailTemplate1 = thumbnailTemplate1.replace('[imageURL]', source[0].src); templateVariableList['[thumbnailTemplate]'] = thumbnailTemplate1; // Replacing content template. Object.keys(contentTemplateItems).forEach((key) => { //console.log(key, contentTemplateItems[key]); contentTemplate1 = contentTemplate1.replace(key, contentTemplateItems[key]); }); templateVariableList['[contentTemplate]'] = contentTemplate1; templateVariableList['[contentWithoutImageTemplate]'] = ''; } else { contentTemplate1 = contentWithoutImageTemplate; // Replacing content template. Object.keys(contentTemplateItems).forEach((key) => { //console.log(key, contentTemplateItems[key]); contentTemplate1 = contentTemplate1.replace(key, contentTemplateItems[key]); }); templateVariableList['[contentTemplate]'] = ''; templateVariableList['[contentWithoutImageTemplate]'] = contentTemplate1; templateVariableList['[thumbnailTemplate]'] = ''; } // Replacing content template. Object.keys(templateVariableList).forEach((key) => { //console.log(key, templateVariableList[key]); searchResultTemplate1 = searchResultTemplate1.replace(key, templateVariableList[key]); }); finalResult += searchResultTemplate1; } }); resultSection.innerHTML = finalResult; document.querySelector('#emptySearch').style.display = 'none'; document.querySelector('#search.new').style.display = 'block'; } else { document.querySelector('#emptySearch').innerHTML = 'No result found'; } } const autocompleteHandler = (autocompleteResult) => { if (autocompleteResult.items != null) { if (autocompleteResult.items.length > 0) { var ulStart = ''; if (isMobile) { autoCompleteId = 'suggestM'; } else { autoCompleteId = 'suggest'; } $('.' + autoCompleteId).show(); $(".suggest_overlay").show(); $('.' + autoCompleteId).html(ulStart + autocompleteHtml + ulEnd); } else { if (isMobile) { autoCompleteId = 'suggestM'; } else { autoCompleteId = 'suggest'; } $('.' + autoCompleteId).hide(); $(".suggest_overlay").hide(); } } else { if (isMobile) { autoCompleteId = 'suggestM'; } else { autoCompleteId = 'suggest'; } $('.' + autoCompleteId).hide(); $(".suggest_overlay").hide(); } } function loadClient() { if (gapi != null && gapi != undefined && gapi.client != null && gapi.client != undefined) { gapi.client.setApiKey('AIzaSyD_MFQlsRaD4jc4i9Nsrfgi5Hh8l0M6sWc'); //"AIzaSyDOXLbD-j9ROkEYEAHZxJ0JTPOZrjVJH-M" return gapi.client.load("https://content.googleapis.com/discovery/v1/apis/customsearch/v1/rest") .then(function () { console.log("GAPI client loaded for API"); let searchParams = new URLSearchParams(window.location.search); const hasQuery = searchParams.has('q'); const hasStart = searchParams.has('start'); let query = ''; let start = 0; if (hasQuery & hasStart) { query = searchParams.get('q'); start = searchParams.get('start'); } else if (hasQuery) { if (hasQuery) { query = searchParams.get('q'); } } if (hasQuery) { $('.st-default-search-input').val(query); execute(query, start, false); } }, function (err) { console.error("Error loading GAPI client for API", err); }); } } // Make sure the client is loaded before calling this method. function execute(query, start, isAutocomplete) { if (query != '' && gapi != null && gapi != undefined) { if (gapi.client != null && gapi.client != undefined) { if (gapi.client.search != null && gapi.client.search != undefined && gapi.client.search.cse != null && gapi.client.search.cse != undefined) { return gapi.client.search.cse.siterestrict.list({ "cx": "cd28f151c55f365c5",//"e653019e2a972ddf2",// "q": query, "start": start, "filter": "1", //"fileType": "-filetype:pdf" }).then(function (response) { // Handle the results here (response.result has the parsed body). if (!isAutocomplete) { searchResultHandler(response.result); } else { autocompleteHandler(response.result); } }, function (err) { console.error("Execute error", err); }); } } } else { document.querySelector('#emptySearch').innerHTML = 'No result found.'; } } $('.st-default-search-input').on("keyup", (e) => { query = $('#' + e.target.id).val(); if (query.length > 2) { if (e.target.id == 'search') { isMobile = false; } else { isMobile = true; } execute(query, 0, true); } else { if (e.target.id == 'search') { $('.suggest').hide(); $(".suggest_overlay").hide(); } else { $('.suggestM').hide(); $(".suggest_overlay").hide(); } } }); $('.st-default-search-input').on("focus", (e) => { query = $('#' + e.target.id).val(); if (query.length > 0) { if (e.target.id == 'search') { isMobile = false; } else { isMobile = true; } var html = $('.suggest').html().trim(); var htmlM = $('.suggestM').html().trim(); if (!isMobile) { if (html != '') { $('.suggest').show(); $(".suggest_overlay").show(); } } else { if (htmlM != '') { $('.suggestM').show(); $(".suggest_overlay").show(); } } } }); $('.suggest_overlay').on("click", (e) => { $(".suggest_overlay").hide(); $('.suggest').hide(); $('.suggestM').hide(); }); function loadPage(ele, event) { event.preventDefault(); var spanEle = ele.getElementsByTagName('span'); var btnIndex = ''; if (spanEle.length > 0) { if (ele.classList.contains('movestepbackward')) { btnIndex = pagination.currentPage - 1; } else { btnIndex = pagination.currentPage + 1; } } else { var id = ele.id; var index = id.split('-')[1]; //var el = ele.getElementsByTagName('a'); btnIndex = parseInt(index); } pagination.currentPage = btnIndex; pagination.startNumber = ((btnIndex - 1) * pagination.pageSize) + 1; pagination.currentpageClicked(); } onLoadCallback = function () { if (gapi != null && gapi != undefined) { gapi.load('client:auth2"', { callback: () => { console.log("gapi callback"); loadClient(); }, onerror: (msg) => { console.log('gapi.client failed to load!'); }, timeout: 20000, // 5 seconds. ontimeout: function () { console.log('gapi.client could not load in a timely manner!'); onLoadCallback(); } }); } }; var pagination = { totalPages: 0, totalCount: 0, pageSize: 10, currentPage: 0, startNumber: 0, endNumber: 0, searchText: "", calculateVariables: (googleSearchPageRequest) => { pagination.totalCount = googleSearchPageRequest.totalResults; pagination.totalPages = Math.ceil(pagination.totalCount / pagination.pageSize); // <= 1 ? 1 : (pagination.totalCount / pagination.pageSize); pagination.currentPage = parseInt(googleSearchPageRequest.startIndex / pagination.pageSize) + 1; pagination.searchText = googleSearchPageRequest.searchTerms; var total = ((parseInt(pagination.currentPage) - 1) * pagination.pageSize) + pagination.pageSize; var start = ((parseInt(pagination.currentPage) - 1) * pagination.pageSize) + 1; if (pagination.totalCount >= total) { pagination.startNumber = start; //((parseInt(request.startIndex) - 1) * pagination.pageSize) + 1; } else { if (pagination.currentPage == 1) { pagination.startNumber = 1; } else { pagination.startNumber = start; //((parseInt(request.startIndex) - 1)) * pagination.pageSize + 1; } } if (pagination.totalCount >= total) { pagination.endNumber = total; } else { if (pagination.currentPage == 1) { pagination.endNumber = googleSearchPageRequest.count; } else { pagination.endNumber = (parseInt(pagination.currentPage) - 1) * pagination.pageSize + googleSearchPageRequest.count; } } pagination.createPagination(); }, nextPage: (event) => { }, previousPage: (event) => { }, currentpageClicked: () => { execute(pagination.searchText, pagination.startNumber, false); //document.body.scrollTop = 0; //document.documentElement.scrollTop = 0; window.scroll({ top: 0, left: 0, behavior: 'smooth' }); }, getNumberOfPages: (event) => { pagination.totalPages = (pagination.totalCount / pagination.pageSize) <= 1 ? 1 : (pagination.totalCount / pagination.pageSize); return pagination.totalPages; }, gotFirst: (event) => { //query = document.querySelector('.st-default-search-input').value; execute(pagination.searchText, 1, false); }, gotoLast: (event) => { //query = document.querySelector('.st-default-search-input').value; var startIndex = ((pagination.totalPages - 1) * pagination.pageSize) + 1; execute(pagination.searchText, startIndex, false); }, createPagination: () => { var paginationArray = pagination.createPaginationArray(pagination.currentPage, pagination.totalPages); console.log(paginationArray); var pagingEle = document.querySelector('.pagination'); var moveStepBackward = '
  • '; var moveStepForward = '
  • '; //pagingEle.append(moveStepBackward); var ele = ''; //if (pagination.currentPage != 1) { ele = moveStepBackward; //} //var breakPaginationLoopAt = (pagination.totalPages - pagination.currentPage) > 8 ? pagination.currentPage + 7 : (pagination.totalPages - pagination.currentPage) > 0 ? pagination.currentPage + (pagination.totalPages - pagination.currentPage) : 1; //for (var i = pagination.currentPage; i <= pagination.totalPages; i++) { // ele += '
  • ' + i + '
  • '; // if (breakPaginationLoopAt == i) { break; } //} //if ((pagination.totalPages - breakPaginationLoopAt) > 0) { // ele += '
  • ...
  • '; //} paginationArray.forEach((item, index) => { var i = item; if (item == '...') { i = paginationArray[index - 1] + 1; } ele += '
  • ' + item + '
  • '; }); //if (pagination.currentPage != pagination.totalPages) { ele += moveStepForward; //} pagingEle.innerHTML = ele; }, createPaginationArray: (currentPage, LastPage) => { var current = currentPage, last = LastPage, delta = 3, left = current - delta, right = current + delta + 1, range = [], rangeWithDots = [], l; for (let i = 1; i <= last; i++) { if (i == 1 || i == last || i >= left && i < right) { range.push(i); } } for (let i of range) { if (l) { if (i - l === 2) { rangeWithDots.push(l + 1); } else if (i - l !== 1) { rangeWithDots.push('...'); } } rangeWithDots.push(i); l = i; } return rangeWithDots; } } window.fcSettings = { token: "97829940-75e5-47b4-a5a2-6b9a146d761e", host: "https://wchat.freshchat.com", config: { headerProperty: { hideChatButton: true } }, onInit: function () { window.fcWidget.on("widget:loaded", function () { document.getElementById('custom_fc_button').style.visibility = 'visible'; window.fcWidget.on("unreadCount:notify", function (resp) { $(".newChatCount").html(resp.count); if (resp.count > 0) { $(".newChatCount").show(); } else { $(".newChatCount").hide(); } }); window.fcWidget.on("widget:closed", function () { document.getElementById('fc_frame').style.visibility = 'hidden'; document.getElementById('open_fc_widget').style.visibility = 'visible'; }); window.fcWidget.on("widget:opened", function (resp) { document.getElementById('open_fc_widget').style.visibility = 'hidden'; $(".newChatCount").html(""); $(".newChatCount").hide(); }); }); } }; var openWidget = function () { document.getElementById('fc_frame').style.visibility = 'visible'; $(".newChatCount").html(""); $(".newChatCount").hide(); window.fcWidget.open(); };