PageSourceSearch

https://www.metro-nom.eu/themes/theme940/js/modules/blocksearch/blocksearch.js

js metro-nom.eu collected 2026-10-10 01:24:01 UTC 3,637 bytes, 120 lines download raw bytes

1/*
2* 2007-2014 PrestaShop
3*
4* NOTICE OF LICENSE
5*
6* This source file is subject to the Academic Free License (AFL 3.0)
7* that is bundled with this package in the file LICENSE.txt.
8* It is also available through the world-wide-web at this URL:
9* http://opensource.org/licenses/afl-3.0.php
10* If you did not receive a copy of the license and are unable to
11* obtain it through the world-wide-web, please send an email
12* to [email protected] so we can send you a copy immediately.
13*
14* DISCLAIMER
15*
16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
17* versions in the future. If you wish to customize PrestaShop for your
18* needs please refer to http://www.prestashop.com for more information.
19*
20*  @author PrestaShop SA <[email protected]>
21*  @copyright  2007-2014 PrestaShop SA
22*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23*  International Registered Trademark & Property of PrestaShop SA
24*/
25
26var instantSearchQueries = [];
27$(document).ready(function()
28{
29	/* TODO floodding server */
30	/*
31	if (typeof instantsearch != 'undefined' && instantsearch)		
32		$("#search_query_" + blocksearch_type).keyup(function(){
33			if($(this).val().length > 4){
34				stopInstantSearchQueries();
35				instantSearchQuery = $.ajax({
36					url: search_url + '?rand=' + new Date().getTime(),
37					data: {
38						instantSearch: 1,
39						id_lang: id_lang,
40						q: $(this).val()
41					},
42					dataType: 'html',
43					type: 'POST',
44					headers: { "cache-control": "no-cache" },
45					async: true,
46					cache: false,
47					success: function(data){
48						if($("#search_query_" + blocksearch_type).val().length > 0)
49						{
50							tryToCloseInstantSearch();
51							$('#center_column').attr('id', 'old_center_column');
52							$('#old_center_column').after('<div id="center_column" class="' + $('#old_center_column').attr('class') + '">'+data+'</div>');
53							$('#old_center_column').hide();
54							// Button override
55							ajaxCart.overrideButtonsInThePage();
56							$("#instant_search_results a.close").click(function() {
57								$("#search_query_" + blocksearch_type).val('');
58								return tryToCloseInstantSearch();
59							});
60							return false;
61						}
62						else
63							tryToCloseInstantSearch();
64					}
65				});
66				instantSearchQueries.push(instantSearchQuery);
67			}
68			else
69				tryToCloseInstantSearch();
70		});
71	/*	*/
72	/* TODO Ids aa blocksearch_type need to be removed*/
73	if (typeof ajaxsearch != 'undefined' && ajaxsearch && typeof blocksearch_type !== 'undefined' && blocksearch_type)
74		$("#search_query_" + blocksearch_type).autocomplete(
75			search_url,
76			{
77				minChars: 3,
78				max: 10,
79				width: 500,
80				selectFirst: false,
81				scroll: false,
82				dataType: "json",
83				formatItem: function(data, i, max, value, term) {
84					return value;
85				},
86				parse: function(data) {
87					var mytab = new Array();
88					for (var i = 0; i < data.length; i++)
89						mytab[mytab.length] = { data: data[i], value: data[i].cname + ' > ' + data[i].pname };
90					return mytab;
91				},
92				extraParams: {
93					ajaxSearch: 1,
94					id_lang: id_lang
95				}
96			}
97		)
98		.result(function(event, data, formatted) {
99			$('#search_query_' + blocksearch_type).val(data.pname);
100			document.location.href = data.product_link;
101		});
102});
103
104function tryToCloseInstantSearch()
105{
106	if ($('#old_center_column').length > 0)
107	{
108		$('#center_column').remove();
109		$('#old_center_column').attr('id', 'center_column');
110		$('#center_column').show();
111		return false;
112	}
113}
114
115function stopInstantSearchQueries()
116{
117	for(i=0;i<instantSearchQueries.length;i++)
118		instantSearchQueries[i].abort();
119	instantSearchQueries = new Array();
120}

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.