1function Search() { 2 this.searchBarWrapper = $('.search-bar-wrapper'); 3 this.searchBarMobile = $(".search-bar-mobile"); 4 this.siteBaseUrl = $("#siteBaseUrl").val(); 5} 6 7Search.prototype = { 8 init: function () { 9 var self = this; 10 11 if ($(window).width() <= 1075) { 12 this.removeSearchOpen(); 13 } 14 15 $(window).on("resize.searchOpen", function () { 16 if ($(window).width() <= 1075) { 17 self.removeSearchOpen(); 18 } 19 20 }); 21 22 23 24 this.searchBarWrapper.each(function () { 25 var searchBarWrapper = $(this); 26 27 if (searchBarWrapper.length > 0 && !searchBarWrapper.hasClass('search-open')) { 28 searchBarWrapper.click(function () { 29 //console.log('Search clicked') 30 31 if (self.searchBarMobile.hasClass("mobile-search-open") && $(this).find("svg.ico-close-search").is(":visible")) { 32 //console.log('removing class') 33 self.searchBarMobile.removeClass("mobile-search-open"); 34 searchBarWrapper.removeClass("search-open"); 35 36 } else { 37 //console.log('adding class'); 38 39 if ($(this).find(".ico-search").length > 0) { 40 self.searchBarMobile.addClass("mobile-search-open"); 41 } 42 43 44 if (!searchBarWrapper.hasClass('search-open')) { 45 searchBarWrapper.addClass('search-open'); 46 setTimeout(function () { 47 48 if (searchBarWrapper.find(".ico-close-search").is(":visible")) { 49 self.searchBarMobile.find("input").focus(); 50 51 } else { 52 searchBarWrapper.find("#txHeaderSearch").focus(); 53 self.bindSearch(searchBarWrapper); 54 55 } 56 57 58 }, 100); 59 } 60 } 61 }); 62 } else { 63 self.bindSearch(searchBarWrapper); 64 } 65 }) 66 }, 67 removeSearchOpen: function () { 68 this.searchBarWrapper.removeClass("search-open"); 69 this.searchBarMobile.removeClass("mobile-search-open"); 70 }, 71 bindSearch: function (searchBarWrapper) { 72 var that = this; 73 if (searchBarWrapper.length > 0) { 74 75 searchBarWrapper.each(function () { 76 var self = this; 77 $(this).find("svg").click(function () { 78 79 if ($(this).hasClass('ico-close-search')) { 80 81 //self.removeClass('search-open'); 82 } else { 83 //window.location = '/search/?search_field=' + searchBarWrapper.find("input").val(); 84 85 if ($(this).parent().parent().find('.site-search-options-wrapper').length > 0 && $(this).parent().parent().find(".site-search-options-wrapper input[name='searchType']:checked").val() == 'catalogue') { 86 //alert($(this).parent().parent().find(".site-search-options-wrapper input[name='searchType']:checked").val()) 87 window.location = 'https://ent.kotui.org.nz/client/en_AU/westland/search/results?qu=' + searchBarWrapper.find("input").val(); 88 } else { 89 window.location = that.siteBaseUrl + 'search/?search_field=' + searchBarWrapper.find("input").val(); 90 } 91 92 } 93 }); 94 95 $(this).find("input").keyup(function (e) { 96 e.preventDefault(); 97 if (e.keyCode == 13) { 98 //window.location = '/search/?search_field=' + searchBarWrapper.find("input").val(); 99 //alert($(this).parent().parent().find(".site-search-options-wrapper input[name='searchType']:checked").val()) 100 if ($(this).parent().parent().find('.site-search-options-wrapper').length > 0 && $(this).parent().parent().find(".site-search-options-wrapper input[name='searchType']:checked").val() == 'catalogue') { 101 102 window.location = 'https://ent.kotui.org.nz/client/en_AU/westland/search/results?qu=' + searchBarWrapper.find("input").val(); 103 } else { 104 window.location = that.siteBaseUrl + 'search/?search_field=' + searchBarWrapper.find("input").val(); 105 } 106 } 107 }); 108 }); 109 } 110 111 } 112} 113 114var search = null; 115 116$(function () { 117 search = new Search(); 118 search.init(); 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.