PageSourceSearch

https://marblehillpublishers.co.uk/js/custom.js

js marblehillpublishers.co.uk collected 2026-09-26 09:24:21 UTC 25,806 bytes, 830 lines download raw bytes

1/******************************************************************************/
2/*				=== EHAUS BOOTSTRAP - CUSTOM JS === 			          */
3/* ---------------------------------------------------------------------------*/
4// /<![CDATA[
5/******************************************************************************/
6
7	$(document).ready(function(){
8		
9
10	// BACK LINKS
11		$('.back-link').on('click', function(){
12			javascript:history.back(1);
13		});
14		
15		
16	// Paroller
17		$('.jumbotron').paroller();
18
19	// TAB-Select
20		var hash = window.location.hash;
21		if (hash) {
22			console.log('tab-select', hash);
23			$('.nav-tabs a[href="' + hash + '"]').tab('show');
24		}
25
26		
27	//AOS Slide Animations
28		AOS.init();
29		
30	// NavBar Transitions OnScroll
31		$(window).on("scroll", function() {
32			let navbar = $(".navbar-transition");
33			if ($(window).scrollTop() >= 40) {
34				if (navbar.hasClass("py-1")) {
35					navbar.removeClass("py-1");
36					navbar.addClass("compressed");
37				}
38			} else {
39				if (navbar.hasClass("compressed")) {
40					navbar.addClass("py-1");
41					navbar.removeClass("compressed");
42				}
43			}
44		});
45  
46	// SlimSelect https://slimselectjs.com/
47		if( $('body').data('page-id').match(/advanced-search|list|index/) ){
48			
49			 /* https://slimselectjs.com/ */
50			const selects = document.querySelectorAll('.sselect')
51			selects.forEach((selectElement) => {
52			new SlimSelect({
53				select: selectElement
54				})
55			})
56		}
57		
58	// VIEW PUBLIC SLIDESHOW
59		$('.view-public-list-btn').on('click', function(){
60			
61			event.preventDefault();
62			$('#ps-ds').val( $("#frmSearchPublic option:selected").text() );
63			$('#frmSearchPublic').submit();
64			
65			
66		});
67		
68	
69	// Sidebar Hamburger animation
70		$('.menu_icon').click(function(){
71			$(this).toggleClass('clicked');
72		});
73		
74	/* Sidebar Hamburger animation reset on hide */
75		var myOffcanvas = document.getElementById('sidebar-1');
76		if(!empty(myOffcanvas)){
77			myOffcanvas.addEventListener('hide.bs.offcanvas', function () {
78				$('.menu_icon').removeClass('clicked');	// reset hamburger
79			});
80		}
81	
82	/* Quick Search Form - reset/clear icon */	
83		$('.reset-icon').on('click', function(){
84			$(this).fadeOut('fast');
85			$(this).siblings('.form-control').val('').focus();
86		});
87
88		$('.quick-search-form input').on('keyup', function (event) {
89			var $icon = $(this).siblings('.reset-icon');
90			$icon.fadeIn('slow');
91		});
92		
93		
94	/* Mega-Menus fade-in/out */
95		$( ".dropdown-mega" ).on( "click", function(){
96			event.preventDefault();
97			$('.mega-menu').css('top', $('header').outerHeight());
98			$me = $(this).siblings('.mega-menu').fadeToggle( 400, "linear" );
99			$('.mega-menu').not($me).hide();
100		});
101			
102		$('.mega-menu').mouseenter(function () {
103			$(this).siblings('.nav-link').find('span.animated-underline').addClass('active');
104		});
105		
106		$('.mega-menu').mouseleave(function () {
107			$(this).siblings('.nav-link').find('span.animated-underline').removeClass('active');
108		});
109		
110		// fadeOut mega-menu if you click elsewhere...
111		$(document).on("click", function (event) {
112			if ($(event.target).closest(".mega-menu, .dropdown-mega").length === 0) {
113				$('.mega-menu').fadeOut();
114			}
115		});
116		
117
118	/* */
119		
120
121	
122	// Quick Search Button: Toggle the Nav button and set the focus
123		$("a[href='#quick-search-collapse-lg'], a[href='#quick-search-collapse-sm'], button[href='#quick-search-collapse-lg'], button[href='#quick-search-collapse-sm']").click( function() {
124			
125			$('#quick-search-collapse-lg').css('top', $('header').outerHeight());
126			if( $('body').data('user-search') ){
127				
128				if(typeof $('body').data('user-search') == 'string'){
129					/* Set in SiteFunctions.inc::mtMainBodyTags() - but... */
130					//var q = $('body').data('user-search').replace(/\<fv_search_terms\>/, '') || '';
131					var q = ''
132				} else {
133					var q = '';
134				}
135				
136			}
137			setTimeout(function() { // Hack to make sure the focus is called after the event has been handled
138				$('#quick-search-input-sm').focus().val(q);
139				$('#quick-search-input-lg').focus().val(q);
140				
141			});
142
143		}); 
144		
145	// QUICK SEARCH FORM - Populate DisplayString
146		$('#quick-search-lg-btn').on('click', function() {
147			//$('#main-dynamic-ds').val($('#quick-search-input-lg').val()); 
148			if($('#quick-search-input-lg').val()){
149				$('#quick-search-form-lg').submit()
150			}else{
151				$('#quick-search-collapse-lg').collapse('hide');
152			};
153		});
154		
155		$('body').click(function(evt){ 
156		
157		   if(evt.target.id == "quick-search-collapse-lg"){
158			  return;
159		   }
160		   //For descendants of quick-search-collapse-lg being clicked, remove this check if you do not want to put constraint on de
160scendants.
161		   if($(evt.target).closest('#quick-search-collapse-lg').length){
162			  return;   
163		   }				  
164
165			  //Do processing of click event here for every element except with id menu_content
166			$('#quick-search-collapse-lg').collapse('hide');
167		});
168		
169		$('#quick-search-lg-clear').on('click', function() {
170			$('#quick-search-input-lg').val('');
171			$('#quick-search-input-lg').focus();
172		});
173		
174		// Quick Search Ahead Dropdown suggestions - tabbing
175		document.addEventListener('keydown', e => {
176		
177			if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return;
178			const focusElem = document.querySelector(':focus');
179			const tabElements = [...document.querySelectorAll('#quick-search-input-lg, #livesearch_result>a')];
180			const tabElementsCount = tabElements.length - 1;
181			if (!tabElements.includes(focusElem)) return;
182			e.preventDefault();
183			const focusIndex = tabElements.indexOf(focusElem);
184			let elemToFocus;
185			if (e.key === 'ArrowUp') elemToFocus = tabElements[focusIndex > 0 ? focusIndex - 1 : tabElementsCount];
186			if (e.key === 'ArrowDown') elemToFocus = tabElements[focusIndex < tabElementsCount ? focusIndex + 1 : 0];
187			elemToFocus.focus();
188		  
189		});
190		
191		
192	// NAV Hide on Scroll [????]
193		var previousScroll = 50;
194		// scroll functions
195		$(window).scroll(function(e) {
196		
197			// add/remove class to navbar when scrolling to hide/show
198			var scroll = $(window).scrollTop();
199			if (scroll >= previousScroll) {
200				$('.navbar').addClass("navbar-hide");
201			
202			}else if (scroll < previousScroll) {
203				$('.navbar').removeClass("navbar-hide");
204			}
205			previousScroll = scroll;
206		
207		});
208
209		
210	// scroll-to-top 		
211		$(window).scroll(function() {
212
213			if ($(this).scrollTop() > 50) {
214				$('.back-to-top').fadeIn(900);
215			} else {
216				$('.back-to-top').fadeOut(900);
217			}
218			
219		});
220		
221	// scroll-to-top 
222		$('.back-to-top').click(function(event) {
223	 
224			event.preventDefault();
225			$('html, body').animate({scrollTop: 0}, 900, 'swing');
226			return false;
227			 
228		});
229		
230	// Transparent background toggle
231	$(document).scroll(function () {
232		var $nav = $(".transparent-header");
233		$nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
234	});
235
236		
237	// Add FancyBox to PDF links if not already present
238	/**/
239		$("a").each(function(e) {
240			
241			var $href = $(this);
242			if(typeof $href.attr('href') !== 'undefined'){
243				//console.log( $(this).attr('href') );
244				if( $href.attr('href').match(/(\.pdf)$/) ){
245					$href.fancybox();
246				}
247				if( $href.prop('class').match(/(pdf)/) ){
248					$href.fancybox();
249				}
250				if( $href.attr('href').match(/^(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?(?=.*v=((\w|-){11}))(?:\S+)?$/) ){
251					$href.fancybox();
252				}
253				
254			}
255			
256		});
257		
258	// SLICK CAROUSELS (see also slick.css & custom.css)
259		 $('.slick-books').slick({
260			infinite: true,
261			slidesToShow: 4,
262			slidesToScroll: 4,
263			//variableWidth: true,
264			//centerMode: true,
265			//arrows: true,
266			nextArrow: '<i class="fas fa-arrow-circle-right slick-next"></i>',
267			prevArrow: '<i class="fas fa-arrow-circle-left slick-prev"></i>',
268			responsive: [
269				{
270				  breakpoint: 992,
271				  settings: {
272					slidesToShow: 3,
273					slidesToScroll: 3,
274					infinite: true,
275					dots: true
276				  }
277				},
278				{
279				  breakpoint: 768,
280				  settings: {
281					slidesToShow: 2,
282					slidesToScroll: 2
283				  }
284				},
285				{
286				  breakpoint: 576,
287				  settings: {
288					slidesToShow: 1,
289					slidesToScroll: 1
290				  }
291				}
292			]
293			
294		  });
295		  
296
297		
298	// LISTPRODUCTS AJAX	element calls..
299		$('listproducts').each(function() {
300			
301			var rel = $(this).attr('rel') + '&rid=' + $(this).attr('id');
302			var callback = function(response){
303				list_product_response(response);	
304			};
305			iLookUp('', rel, callback);
306
307		});
308	// ====
309
310
311
312	// SmartCart Buy Buttons [BOOKS] (Deprecated. Use mtSmartCartBookItems() & .product-buy-btn
313		$('.book-buy-btn').on('click', function(e) {
314		
315			$button = $(this);
316			// e.g. Title Detail Book Buy button
317			$('.form-check-label').each(function(e) {
318				
319				if($(this).hasClass('active')){
320					
321					$id = $(this).data('id');
322					$product = $(this).data('product');
323					//console.log($product);
324					// Set the Add to Basket Button with the selected product
325					$button.data('product', $product);
326					
327				}else{
328					//console.log('aargh2');
329				}
330						
331			});
332					
333		// ehTrack the event (results AND detail pages)
334			if(typeof $product == 'undefined'){ $product = $button.data('product'); }
335			var $track = {}; $track = track_page_data();
336			$track['data-track-event'] = 'add2basket';
337			$track['data-track-type'] = 'click';
338			$track['data-item-id'] = $product.product_id;
339			$track['data-item-barcode'] = $product.product_isbn;
340			$track['data-item-name'] = $product.product_name;
341			$track['data-item-price'] = $product.product_stp;
342			
343			//console.log("tracking3");
344			//console.log( $track );
345
346			track_save($track);
347															
348		});
349		
350	// SmartCart Buy Buttons [PRODUCTS] and BOOKS too!
351		$('.product-buy-btn').on('click', function(e) { 
352		
353			event.preventDefault();
354			$button = $(this);
355			
356			var $data = $(this).parent().find('.product-item').attr('data-product');
357			$data = JSON.parse($data);
358			//console.log($data);
359			$available = false;
360			$(this).parent().find('.product-format-item').each(function(e) {
361			// checks for case where no items are available	
362				if($(this).hasClass('active')){
363					$available = true;
364				}
365				
366			});
367			
368			if( $available ){
369				
370				$data.product_format = $(this).parent().find('.product-format-item.active > .product-format').html();
371				if( !empty($data.product_format) ){ $data.product_format = $data.product_format.replace(/[\t\n\r]+/g, ''); }
372				$data.product_format_code = $(this).parent().find('.product-format-item.active > .product-format').data('format-code');
373				$data.product_size_code = $(this).parent().find('.product-size.active').data('size-code');
374				$data.product_colour_code = $(this).parent().find('.product-colour.active').data('colour-code');
375				$data.product_id = $(this).parent().find('.product-format-item.active > .product-format').data('sku')[0];
376				$data.product_rrp = $(this).parent().find('.product-format-item.active > .product-format').data('rrp');
377				$data.product_ddp = $(this).parent().find('.product-format-item.active > .product-format').data('ddp');
378				$data.product_stp = $(this).parent().find('.product-format-item.active > .product-format').data('stp');
379				
380				$keys =  $(this).parent().find('.product-item').data('key');
381				if( typeof $data.product_size_code !== 'undefined' && typeof $data.product_colour_code !== 'undefined'){
382				
383					$data.product_avail = $keys[ $data.product_size_code + "_" + $data.product_colour_code ]['product_avail'];
384					$data.product_avail_code = $keys[ $data.product_size_code + "_" + $data.product_colour_code ]['product_avail_code'];
385					$data.product_id = $keys[ $data.product_size_code + "_" + $data.product_colour_code ]['product_sku'];
386					$data.product_rrp = $keys[ $data.product_size_code + "_" + $data.product_colour_code ]['product_rrp'];
387					$data.product_ddp = $keys[ $data.product_size_code + "_" + $data.product_colour_code ]['product_ddp'];
388					$data.product_stp = $keys[ $data.product_size_code + "_" + $data.product_colour_code ]['product_stp'];
389					
390				}
391			
392				$button.attr('data-product', JSON.stringify($data) );
393			
394			// ehTrack the event (results AND detail pages)
395				var $track = {}; $track = track_page_data();
396				$track['data-track-event'] = 'add2basket';
397				$track['data-track-type'] = 'click';
398				$track['data-item-id'] = $data.product_id;
399				$track['data-item-barcode'] = $data.product_sku;
400				$track['data-item-name'] = $data.product_name;
401				$track['data-item-price'] = $data.product_stp;
402				//console.log( $track );
403				track_save($track);
404				
405				
406				//console.log($data);
407				
408			}
409			
410		});
411		
412		$('.product-buy-btn').on('mouseover', function(e) { 
413		
414			if( $('.product-size-container').attr('data-size-active') == 'true' && typeof $('.product-size.active').data('size-code') == 'undefined' ){
415				$(this).addClass('disabled');
416			}
417			
418			if( $('.product-colour-container').attr('data-colour-active') == 'true' && typeof $('.product-colour.active').data('colour-code') == 'undefined' ){
419				$(this).addClass('disabled');
420			}
421		
422			$available = false;			
423			$(this).parent().find('.product-format-item').each(function(e) {
424				
425				if($(this).hasClass('active')){
426					$available = true;
427				}
428				
429			});
430			if( $available == false ){
431				$(this).addClass('disabled');
432				$(this).html('Not available');
433			}
434		
435		});
436		
437		$('.product-size').click(function() { 
438		
439			$('.product-size').not(this).removeClass('active');
440			$(this).toggleClass('active');
441			$('.product-buy-btn').removeClass('disabled');
442			$colours = $(this).data('colours');
443			
444			$('.product-colour').each(function(e){
445				
446				if(  $.inArray( $(this).data('colour-code'), $colours ) >= 0 ){
447					$(this).removeClass('disabled');
448				}else{
449					$(this).removeClass('active').addClass('disabled');
450				}
451				
452			});
453			
454							
455		});
456	
457		$('.product-colour').click(function() { 
458			$('.product-colour').not(this).removeClass('active');
459			$(this).toggleClass('active');
460			$('.product-buy-btn').removeClass('disabled');
461		});
462		
463		$('.product-format-item').click(function() { 
464		
465			$format_id = $(this).data('id');
466		
467			$('.product-format-item').not(this).removeClass('active');
468			$(this).toggleClass('active');
469			//console.log('fmt'); console.log($('.product-item').attr('data-product')); console.log('fmt');
470			$('.product-buy-btn').data('data-product', '');
471			$('.product-buy-btn').removeClass('disabled');
472			$('.product-buy-btn').html('Add to Basket');
473			
474		// Toggle inner-hits fields
475			$('.inner-hits').each(function(e) {
476				$id = $(this).data('id');
477				if($id != $format_id){
478					$(this).addClass('d-none');
479				}else{
480					$(this).removeClass('d-none');
481				}
482			});
483			
484		});
485		
486		
487	// SmartCart Buy Unit Button e.g. where one btn for each product (i.e. search results pages)
488	/* Collapse should be off - <inner_hits> not required */
489		$('.product-buy-unit-btn').on('click', function(e) { 
490		
491			event.preventDefault();
492			$button = $(this);
493			
494			var $data = $(this).data('product');
495			$available = $.inArray($data.product_avail_code, ['10', '20', '21', '22', '23', '24']);
496			
497			if( $available >= 0 ){
498				
499				$data.product_quantity = 2;
500				$(this).attr('data-product', JSON.stringify($data));
501				console.log($data);
502				
503			}
504			
505		});
506		
507	/* Infiniti Search */
508	
509		// SORT - dropdown select
510		$('#infiniti-sort').on('change', function(event, handler){
511			$('#infiniti-results').data('next', ''); // we need to clear results of more...
512			$('#infiniti-results').data('btn', '');
513			$data = $('#infiniti-results').data();
514			$data.sort = $('#infiniti-sort').val();
515			infinitiSearch('', $data, '');
516			//console.log($data);
517				
518		});
519		// SORT - radio buttons [<input type="radio" class="form-check-input" id="sort-01" name="sort-radio" value="sort_date/d">]
520		$('input[type="radio"][name="sort-radio"]').on('change', function(event, handler){
521			$('#infiniti-results').data('next', ''); // we need to clear results of more...
522			$('#infiniti-results').data('btn', '');
523			$data = $('#infiniti-results').data();
524			$data.sort = $('input[name="sort-radio"]:checked').val();
525			infinitiSearch('', $data, '');
526			//console.log($data);
527				
528		});
529		// CLEAR ALL FILTERS
530		$('.infiniti-clear-filters').on('click', function(event, handler){
531			$('.filter-tags').html('');
532			// reset to initial search values
533			$('#infiniti-results').data('next', '');
534			$('#infiniti-results').data('btn', '');
535			$('#infiniti-results').data('show', '');
536			$('#infiniti-results').data('doc_end', '');
537			$('#infiniti-results').data('doc_count', '');
538			$('#infiniti-results').data('prev', '');
539			$('#infiniti-results').data('sort', 'sort_date/d');
540			$('#infiniti-results').data('query', $('#infiniti-results').data('default_query') );
541			// clear all the checkboxes and radio buttons
542			$('input[type="radio"][name="sort-radio"]').each(function () { $(this).prop('checked', false); });
543			$("input:checkbox:checked").each(function() { $(this).prop('checked', false); });
544			// run the search
545			infinitiSearch('', '', '');
546		
547		});
548		
549	/* 
550		This function applies click event to all input:checkboxes with class .infiniti-filter
551		- no form required
552		- filters are appended onto the default_query (set via the querystring)
553		- then we fire off the search again
554	*/
555		$('.infiniti-filter').on('click', function(event, handler){
556			
557			//$(this).toggleClass('is-selected');
558			$('.filter-tags').html('');
559			var $arr = {};
560			// pick up any search filters from the #i-filter-form
561			$("input:checkbox:checked").each(function(){
562				
563				if( $(this).hasClass('infiniti-filter') ){
564					
565					var $val = $(this).val();
566					var $key = $(this).attr('name');
567					var $id = $(this).attr('id');
568					var $id_show = $id.split('--', 2)[1];
569					var $tag = '<a href="#" class="btn btn-primary btn-rounded filter-tag" data-id="' + $id + '">' + $id_show + ' x </a>';
570					$('.filter-tags').append($tag);
571					
572					if( typeof $arr[$key] === 'undefined') {
573						$arr[$key] = '(\'' + $val + '\')';						
574					} else {
575						$arr[$key] += ' OR ' + '(\'' + $val + '\')';
576					}
577					
578				}
579
580			});
581			
582			var $query = ''; $count = 1;
583			$.each( $arr, function( index, value ){
584				$count ++;
585				$query += 'sf' + $count + ':' + index + '@st' + $count + ':' + value + '@';
586			});
587				
588			$query = $query.replace(/@+$/,'');
589			$('#infiniti-results').data('next', '');  // we need to clear results of more...
590			$('#infiniti-results').data('btn', '');
591			$data = $('#infiniti-results').data();
592			//console.log('infinitiSearch::data:', $data);			
593			infinitiSearch('', '', $data.default_query + '@' + $query);
594			console.log('infinitiSearch::query:', $query);
595			
596		});	
597
598			$('body').on('click', '.filter-tag', function(event, handler){
599			
600			var $id = $(this).data('id');
601			$(this).remove();
602			$('#'+$id).trigger('click');
603			
604		});
605	/* 
606		This function called by Scroll-To above & More button
607		See also: ehaus.functions.js
608			
609	*/
610		$('#infiniti-search-more').on('click', function(event, handler){
611			
612			//console.log('eek:more');
613			event.preventDefault();	// stops page scrolling back up when yoiu click the button
614			var $target = $(this).data('target-id');
615			$data = $('#'+$target).data();
616			$data.btn = $(this).data('btn');	// i.e. next / prev
617			$data.rid = $target;	
618			$data.sort = $('#infiniti-sort').val() || $('#infiniti-results').data('sort');
619			$data.show = $(this).data('show');
620			//console.log($data);			
621			
622			// bespoke function for presenting the results
623			var callback = function(response){
624				infinitiResults(response, $data.show);	// see ehaus.functions.js
625			};
626			
627			// call the Ajax function[  iLookUp(url["include/xml.proxy.php"], $data, callback);  ], sends response to callback function
628			iLookUp('', $data, callback);  
629			
630		 });
631		 
632		 /* Next : Prev buttons. By default these are hidden: .d-none (See WP_Product_Results.tpl)*/
633		 $('.infiniti-search-nav').on('click', function(event, handler){
634			 
635			//console.log('eek:next:prev');
636			event.preventDefault();	// stops page scrolling back up when yoiu click the button
637			var $target = $(this).data('target-id');
638			$data = $('#'+$target).data();
639			$data.btn = $(this).data('btn');	// i.e. next / prev
640			$data.rid = $target;	
641			$data.sort = $('#infiniti-sort').val() || $('#infiniti-results').data('sort');
642						
643			infinitiSearch('', $data);
644			
645		 });
646		 
647		// fire off the default_search when page loads [set default_query in WP_Infiniti_Results.tpl]
648		if(!empty( $('#infiniti-results').data() ) ){
649			data = $('#infiniti-results').data();
650			//console.log(data);
651			if(typeof $filter !== 'undefined' && !empty($filter)){
652				// Set filter via $params['ds'] in WP.tpl
653				$chk = $('.form-check-label[for='+$filter+']');
654				$chk.addClass('active');
655				$chk.siblings("input").prop('checked', true);
656				$q = "sf1:product_type@st1:"+$filter+"@sort:sort_date/d";
657			
658			} else {
659				
660				$q = data.default_query;
661				
662		}
663		
664			infinitiSearch('', '', $q);
665			
666		}
667		
668		// Bestsellers - write out the text from the button you clicked
669		$('.btn-bestseller').on('click',function(e){
670		  
671			$hdr = $(this).html();
672			
673			 $('.bestseller-header').animate({opacity: 0}, 750, function() {
674				$('.bestseller-header').html($hdr).animate({opacity: 1}, 750);
675				
676			});
677					
678			
679		});
680	
681
682	/* /Infiniti Search */
683
684	// Search Ahead with LiveSearch..	
685	
686		//if( typeof livesearch === 'function' ) {	
687			var $rid = 'livesearch_result';		
688			if ($(window).width() < 769) {
689				$rid = 'livesearch_result_sidebar';
690			} 	
691			
692			/* SET type of search bar: DEFAULT */
693			var $live_search_form = 'quick-search-input-lg';
694			
695			/* Search bar showing inside Navbar see Header-Default-Alt-Header.inc */
696			//var $live_search_form = 'alt-header-search-input';
697			if ($(window).width() < 769) {
698				$live_search_form = 'sidebar-search-input';
699			}
700			
701			$('#'+$live_search_form).livesearch({
702				searchCallback: searchFunction,
703				queryDelay: 400,
704			//	innerText: "Search by Title, Author, Keyword..",
705				minimumSearchLength: 3
706			});
707			
708		//}
709			
710		function searchFunction(searchTerm) {
711			searchTerm = searchTerm.replace(/\s+/ig, '+');
712			
713			var sitename = $('body').data('sitename');
714			lsLookup('main','q=' + searchTerm + '&rid='+$rid+'&dbm='+sitename+'-main', function(errCode, rID, resTxt){
715				//console.log('LiveSearch: '+resTxt);
716				$('#'+$rid).html( resTxt ).show();
717			});
718
719		}
720		
721		/* Search bar showing inside Navbar see Header-Default-Alt-Header.inc
722		$('#' + $rid).on('mouseleave', function() {
723			$('#' + $rid).hide('slow');
724		});
725		 */
726		/*
727			$("a.livesearch").live('mouseenter',function(){
728				var title = ($(this).attr('title')).replace(/(\bnot\b )|(\band\b )|(\bthe\b )|(\b\w{1}\b )|(\b\w{2}\b )|(\(.+?\))|(\,)|(\?)|(\')/gi,' ');
729				$('#qsearch').val(title.replace(/\s+/g,' ')); 
730			});
731			
732			// Clear live search box if a click is made anywhere /
733		$("#quick-search-collapse-lg").on('blur', function(event){
734			$(this).hide('slow');
735		});
736			
737		*/
738		
739	// /Search Ahead with LiveSearch..	
740
741
742	// Grid / List: MT_Searech_Results.tpl
743		$('#list').click(function(event){
744			event.preventDefault();
745			$('#products .view-group').addClass('animated fadeout slow');
746			$('#products .item').addClass('list-group-item');
747			$('#products .item').removeClass('grid-group-item');
748		});
749        $('#grid').click(function(event){
750			event.preventDefault();
751			$('#products .item').removeClass('list-group-item');
752			$('#products .item').addClass('grid-group-item');
753		});
754		
755	// Grid / List: MT_Search_Results_Grid.tpl
756		$myGrid = Cookie.get('eh_grid'); // default is 'grid' view
757		var doc_count = $('body').data('doc-count') || 4;
758		if(typeof doc_count == 'undefined'){doc_count=4;}
759		if($myGrid == 'row' || doc_count < 3){
760			$('.results-grid').addClass('results-grid-row');
761		}
762		
763		$('#list').click(function(event){
764			event.preventDefault();
765			$('.results-grid').addClass('results-grid-row');
766			Cookie.set('eh_grid', 'row');
767			
768		});
769        $('#grid').click(function(event){
770			event.preventDefault();
771			$('.results-grid').removeClass('results-grid-row');
772			Cookie.delete('eh_grid');
773			
774		});
775		
776		if( $('body').data('page-id').match(/list-print-results/) ){
777			console.log('list-print-results:', 'setting grid layout = grid-row');
778			$('#results').addClass('results-grid-row');
779			Cookie.set('eh_grid', 'row');
780		}
781
782
783	// Force search results to results-grid layout on resize
784		(function($) {
785			var $window = $(window),
786				$results_grid = $('#results');
787
788			$window.resize(function resize(){
789				if ($window.width() < 768) {
790					
791					$results_grid.removeClass('results-grid-row');
792					return $results_grid.addClass('results-grid');
793				}
794
795				
796			}).trigger('resize');
797		})(jQuery);
798
799
800
801
802
803
804
805
806
807
808
809			
810	});	//end docready 
811/******************************************************************************/
812/******************************************************************************/
813	
814	$(window).on('load', function() {
815	 
816		// Default No-Image
817		$("img").on('error', function(){
818			
819			$(this).onerror=null;
820			$(this).attr("src", give_me_a_baseref() + "/img/no-image.jpg");
821			
822		  
823		 });	
824		 
825		
826	});
827/******************************************************************************/
828
829	
830// ]]>

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.