PageSourceSearch

https://www.menfashion.gr/catalog/view/javascript/common_04.js?8

js menfashion.gr collected 2026-10-09 04:13:04 UTC 39,524 bytes, 1,143 lines download raw bytes

1function gtag_product_click(id, name, list_name, brand, category, list_position, quantity, price ,url){
2	gtag('event', 'select_content', {
3	'send_to': 'AW-618500717',
4		"content_type": "product",
5		"items": [
6			{
7				"id": id,
8				"name": name,
9				"list_name": list_name,
10				"brand": brand,
11				"category": category,
12				"list_position":list_position,
13				"quantity": quantity,
14				"price": price
15			}
16		]
17	});
18	document.location = url;
19}
20function gtag_add_to_cart(id, name, list_name, brand, category, list_position, quantity, price){
21	gtag('event', 'add_to_cart', {
22	'send_to': 'AW-618500717',
23		"items": [
24			{
25				"id": id,
26				"name": name,
27				"list_name": list_name,
28				"brand": brand,
29				"category": category,
30				"list_position":list_position,
31				"quantity": quantity,
32				"price": price
33			}
34		]
35	});
36}
37function gtag_remove_from_cart(id, name, brand, category, quantity, price ){
38	gtag('event', 'remove_from_cart', {
39	'send_to': 'AW-618500717',
40		"items": [
41			{
42				"id": id,
43				"name": name,
44				"brand": brand,
45				"category": category,
46				"quantity": quantity,
47				"price": price
48			}
49		]
50	});
51}
52function getURLVar(key) {
53	var value = [];
54
55	var query = String(document.location).split('?');
56
57	if (query[1]) {
58		var part = query[1].split('&');
59
60		for (i = 0; i < part.length; i++) {
61			var data = part[i].split('=');
62
63			if (data[0] && data[1]) {
64				value[data[0]] = data[1];
65			}
66		}
67
68		if (value[key]) {
69			return value[key];
70		} else {
71			return '';
72		}
73	}
74}
75
76function refresh_cart_totals()
77{
78
79	getAjax('index.php?route=checkout/cart/get_totals&_=' + new Date().getTime(), function(success, ajaxResponse){
80		if(success)
81		{
82			const response = JSON.parse(ajaxResponse);
83			let totals_html = '';
84			for(const total_index in response.totals){
85				const total = response.totals[total_index];
86				totals_html += '<tr>';
87				totals_html += 	'<td>'+total.title+'</td>';
88				totals_html += 	'<td>'+total.text+'</td>';
89				totals_html += '</tr>';
90			}
91			document.getElementById('cart_summary_totals').innerHTML = totals_html;
92		}
93		else
94		{
95			alert('There was an error with checking cart totals. Please refresh the page.');
96		}
97	});
98}
99
100function getAjax(url, callback) {
101	var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
102	request.open('GET', url);
103	request.onreadystatechange = function() {
104		if (request.readyState>3 && request.status==200){
105			callback(1, request.responseText);
106		}
107	};
108	request.onerror = function() {
109		callback(0, request.responseText);
110	};
111	request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
112	request.send();
113	return request;
114}
115
116function postAjax(url, data, callback) {
117	var params = typeof data == 'string' ? data : Object.keys(data).map(
118		function(k){ return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]) }
119	).join('&');
120
121	var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
122	request.open('POST', url);
123	request.onreadystatechange = function() {
124		if (request.readyState>3 && request.status==200) {
125			callback(1, request.responseText);
126		}
127	};
128	request.onerror = function() {
129		callback(0, request.responseText);
130	};
131	request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
132	request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
133	request.send(params);
134	return request;
135}
136
137function check_listing(){
138	if (localStorage.getItem('display') == 'list') {
139		console.log('list');
140		// $('#list-view').trigger('click');
141		var list_view = document.getElementById('list-view');
142		list_view.classList.add('active');
143		list_view.classList.add('in');
144		// $('#list-view').addClass('active');
145		// $('#list-view').addClass('in');
146		$('#grid-view').removeClass('active');
147		$('#grid-view').removeClass('in');
148		$('.view__mode .list-view').addClass('active');
149		$('.view__mode .grid-view').removeClass('active');
150	} else {
151		console.log('grid');
152		// $('#grid-view').trigger('click');
153		$('#grid-view').addClass('active');
154		$('#grid-view').addClass('in');
155		$('#list-view').removeClass('active');
156		$('#list-view').removeClass('in');
157		$('.view__mode .grid-view').addClass('active');
158		$('.view__mode .list-view').removeClass('active');
159	}
160}
161
162function show_options(button){
163	var product_container = button.closest('.flex-product');
164
165	button.toggleClass('show_close');
166	product_container.find('.product_inner_addtocart').toggleClass('active');
167
168	product_container.find('.product_inner_addtowishlist').removeClass('active');
169	product_container.find('.product_grid-wishlist_button').removeClass('active').removeClass('show_close');
170}
171
172function show_wishlist_options(button){
173	var product_container = button.closest('.flex-product');
174
175	button.toggleClass('show_close');
176	product_container.find('.product_inner_addtowishlist').toggleClass('active');
177
178	product_container.find('.product_inner_addtocart').removeClass('active');
179	product_container.find('.category-add-to-cart').removeClass('active').removeClass('show_close');
180}
181
182function login_customer(email, password, button){
183	$.ajax({
184		url: 'index.php?route=account/login/ajax_login',
185		type: 'post',
186		data: {
187			email: email,
188			password: password,
189		},
190		dataType: 'json',
191		beforeSend: function() {
192			button.parent().find('.text-danger').remove();
193			button.button('loading');
194		},
195		complete: function() {
196			button.button('reset');
197		},
198		success: function(json) {
199			if (json['success'])
200			{
201				if (getURLVar('route') == 'account/logout'){
202					location = json['account_link'];
203				}else{
204					location.reload();
205				}
206			}
207			if (json['warning']) {
208				button.after('<p class="text-danger small mb-10">'+json['warning']+'</p>');
209			}
210		},
211		error: function(xhr, ajaxOptions, thrownError) {
212			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
213		}
214	});
215}
216$(document).ready(function() {
217
218	$('.flex-product label').click(function(){
219		$('.flex-product label').removeClass('active');
220		$('[for="'+$(this).attr('for')+'"]').addClass('active');
221	});
222	/*/
223	if(document.getElementById("countdown-breadcrumbs")){
224		// Set the date we're counting down to
225		var countDownDate = new Date("Nov 26, 2018 23:59:59").getTime();
226
227		// Update the count down every 1 second
228		var x = setInterval(function() {
229
230			// Get todays date and time
231			var now = new Date().getTime();
232
233			// Find the distance between now and the count down date
234			var distance = countDownDate - now;
235
236			// Time calculations for days, hours, minutes and seconds
237			var days = Math.floor(distance / (1000 * 60 * 60 * 24));
238			var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
239			var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
240			var seconds = Math.floor((distance % (1000 * 60)) / 1000);
241
242			// Output the result in an element with id="demo"
243			if(days < 10){
244				days = '0' + days;
245			}
246			if(hours < 10){
247				hours = '0' + hours;
248			}
249			if(minutes < 10){
250				minutes = '0' + minutes;
251			}
252			if(seconds < 10){
253				seconds = '0' + seconds;
254			}
255			document.getElementById("countdown-breadcrumbs").innerHTML =  days+":"+hours + ":" + minutes + ":" + seconds;
256
257			// If the count down is over, write some text
258			if (distance < 0) {
259				clearInterval(x);
260				document.getElementById("countdown-breadcrumbs").innerHTML = "";
261				$('#countdown-breadcrumbs').remove();
262			}
263		}, 1000);
264	}
265	//*/
266	// Highlight any found errors
267	$('.text-danger').each(function() {
268		var element = $(this).parent().parent();
269
270		if (element.hasClass('form-group')) {
271			element.addClass('has-error');
272		}
273	});
274
275	$('.footer-list-title').click(function(){
276		$(this).parent().find('.footer-list').toggleClass('active');
277	});
278
279
280	if($('.mobile-filters-main').length){
281		var stickyFilterTop = $('.mobile-filters-main').offset().top;
282		var stickyFilter = function(){
283			var scrollTop = $(window).scrollTop();
284
285			if (scrollTop > stickyFilterTop) {
286			    $('.mobile-filters-main').addClass('sticky');
287			} else {
288			    $('.mobile-filters-main').removeClass('sticky');
289			}
290		};
291	 
292		stickyFilter();
293	 
294		$(window).scroll(function() {
295		  	stickyFilter();
296		});
297	}
298
299	// Currency
300	$('#form-currency .currency-select').on('click', function(e) {
301		e.preventDefault();
302
303		$('#form-currency input[name=\'code\']').val($(this).attr('name'));
304
305		$('#form-currency').submit();
306	});
307
308	// Language
309	$('#form_language .language-select').on('click', function(e) {
310		e.preventDefault();
311
312		$('#form_language input[name=\'code\']').val($(this).attr('name'));
313
314		$('#form_language').submit();
315	});
316
317	/* Search */
318	$('#search-curtain-input').parent().find('button').on('click', function() {
319		var url = $('base').attr('href') + 'index.php?route=product/search';
320
321		var value = $('#search-curtain-input').val();
322
323		if (value) {
324			url += '&search=' + encodeURIComponent(value);
325		}
326
327		location = url;
328	});
329
330	$('#search-curtain-input').on('keydown', function(e) {
331		if (e.keyCode == 13) {
332			$('#search-curtain-input').parent().find('button').trigger('click');
333		}
334	});
335
336	// Menu
337	$('#menu .dropdown-menu').each(function() {
338		var menu = $('#menu').offset();
339		var dropdown = $(this).parent().offset();
340
341		var i = (dropdown.left + $(this).outerWidth()) - (menu.left + $('#menu').outerWidth());
342
343		if (i > 0) {
344			$(this).css('margin-left', '-' + (i + 10) + 'px');
345		}
346	});
347
348	// Product List
349	$('#list-view').click(function() {
350		$('#content .product-grid > .clearfix').remove();
351
352		$('#content .row > .product-grid').attr('class', 'product-layout product-list col-xs-12');
353		$('#grid-view').removeClass('active');
354		$('#list-view').addClass('active');
355
356		localStorage.setItem('display', 'list');
357	});
358
359	// Product Grid
360	$('#grid-view').click(function() {
361		// What a shame bootstrap does not take into account dynamically loaded columns
362		var cols = $('#column-right, #column-left').length;
363
364		if (cols == 2) {
365			$('#content .product-list').attr('class', 'product-layout product-grid col-lg-6 col-md-6 col-sm-12 col-xs-12');
366		} else if (cols == 1) {
367			$('#content .product-list').attr('class', 'product-layout product-grid col-lg-4 col-md-4 col-sm-6 col-xs-12');
368		} else {
369			$('#content .product-list').attr('class', 'product-layout product-grid col-lg-3 col-md-3 col-sm-6 col-xs-12');
370		}
371
372		$('#list-view').removeClass('active');
373		$('#grid-view').addClass('active');
374
375		localStorage.setItem('display', 'grid');
376	});
377
378
379
380	// Checkout
381	$(document).on('keydown', '#collapse-checkout-option input[name=\'email\'], #collapse-checkout-option input[name=\'password\']', function(e) {
382		if (e.keyCode == 13) {
383			$('#collapse-checkout-option #button-login').trigger('click');
384		}
385	});
386
387	// tooltips on hover
388	$('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
389
390	// Makes tooltips work on ajax generated content
391	$(document).ajaxStop(function() {
392		$('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
393	});
394});
395
396// Cart add remove functions
397var cart = {
398	'add': function(product_id, quantity) {
399
400		$.ajax({
401			url: 'index.php?route=checkout/cart/add',
402			type: 'post',
403			data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
404			dataType: 'json',
405			beforeSend: function() {
406				$('#cart > button').button('loading');
407			},
408			complete: function() {
409				$('#cart > button').button('reset');
410			},
411			success: function(json) {
412				$('.alert-dismissible, .text-danger').remove();
413
414				if (json['redirect_link']) {
415					location = json['redirect_link'];
416				}
417
418				if (json['success']) {
419					//*/
420					$('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
421
422					// Need to set timeout otherwise it wont update the total
423					setTimeout(function () {
424						$('#ajax_cart_quantity').addClass("active");
425						$('#ajax_cart_quantity').html(json['quantity']);
426						$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
427					}, 100);
428
429					$('html, body').animate({ scrollTop: 0 }, 'slow');
430
431					$('#cart > ul > li > .cart_content').load('index.php?route=common/cart/info ul li .shopping__cart', function() {
432						$('#cart-notification').html('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
433						$('#cart > ul > li > .shopping__cart').addClass('shopping__cart__on');
434						$('.body__overlay').addClass('is-visible');
435						$('body, html').addClass('show_curtain');
436					});
437
438					gtag_add_to_cart(product_id, json['name'], 'view_item', json['manufacturer'], json['main_category_name'], 1, json['quantity_added'], json['unformatted_price']);
439					glami('track', 'AddToCart', {
440						item_ids: [json['glami_product_id']], // product ID currently added to a cart. Use the same ID as you use in the feed (ITEM_ID).
441						value: json['unformatted_price'], // product price
442						currency: 'EUR' // product price currency
443					});
444					_tfa.push({notify: 'event', name: 'add_to_cart', id: 1383170});
445					//*/
446				}
447			},
448			error: function(xhr, ajaxOptions, thrownError) {
449				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
450			}
451		});
452	},
453	// 'add_grid': function(product_id, custom_redirect = '',list = '', position = 1) {
454	'add_grid': function(product_id, custom_redirect,list, position) {
455		$.ajax({
456			url: 'index.php?route=checkout/cart/add',
457			type: 'post',
458			data: $('#product-container-'+product_id+' input[type=\'text\'], #product-container-'+product_id+' input[type=\'hidden\'], #product-container-'+product_id+' input[type=\'radio\']:checked, #product-container-'+product_id+' input[type=\'checkbox\']:checked, #product-container-'+product_id+' select, #product-container-'+product_id+' textarea'),
459			dataType: 'json',
460			beforeSend: function() {
461				$('#cart > button').button('loading');
462			},
463			complete: function() {
464				$('#cart > button').button('reset');
465			},
466			success: function(json) {
467				$('.alert-dismissible, .text-danger').remove();
468
469				if (json['redirect']) {
470
471					$('#product-container-'+product_id+' .ht__size__list').addClass("active");
472					$('#product-container-'+product_id+' .ht__size__list').after('<div id="select-size-text-'+ product_id +'" class="ht__size__text">' + json['redirect'] + '</div>');
473				}
474				if(custom_redirect){
475					location = custom_redirect;
476				}
477
478				if (json['success']) {
479					$('#products-content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
480
481					// Need to set timeout otherwise it wont update the total
482					setTimeout(function () {
483						$('#ajax_cart_quantity').addClass("active");
484						$('#ajax_cart_quantity_sticky').addClass("active");
485						$('#ajax_cart_quantity').html(json['quantity']);
486						$('#ajax_cart_quantity_sticky').html(json['quantity']);
487						$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
488						$('#product-container-'+product_id+' .ht__size__list').removeClass("active");
489						$('#select-size-text-'+ product_id +'').remove();
490					}, 100);
491
492					// $('html, body').animate({ scrollTop: 0 }, 'slow');
493
494					$('#cart > ul > li.cart_content').load('index.php?route=common/cart/info ul li .shopping__cart', function() {
495						$('#cart-notification').html('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
496						$('#cart > ul > li > .shopping__cart').addClass('shopping__cart__on');
497						$('.body__overlay').addClass('is-visible');
498						$('body, html').addClass('show_curtain');
499					});
500					gtag_add_to_cart(product_id, json['name'], list, json['manufacturer'], json['main_category_name'], position, 1, json['unformatted_price']);
501					fbq('track', 'AddToCart',{
502						value: json['unformatted_price'],
503						currency: 'EUR',
504						content_name: json['name'],
505						content_type: 'product',
506						content_ids: product_id
507					});
508					glami('track', 'AddToCart', {
509						item_ids: [json['glami_product_id']],
510						product_names: [json['name']],
511						value: json['unformatted_price'],
512						currency: 'EUR'
513					});
514				}
515			},
516			error: function(xhr, ajaxOptions, thrownError) {
517				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
518			}
519		});
520	},
521	// 'add_grid': function(product_id, custom_redirect = '',list = '', position = 1) {
522	'add_grid_02': function(button_elem, input_container, custom_redirect = '', list = '', position = 1) {
523		var icon = button_elem.find('.icons');
524		$.ajax({
525			url: 'index.php?route=checkout/cart/add',
526			type: 'post',
527			data: input_container.serializeArray(),
528			dataType: 'json',
529			beforeSend: function() {
530				icon.attr('class', 'fa fa-refresh fa-spin');
531				input_container.find('.ht__size__text').remove()
532			},
533			complete: function() {
534				icon.attr('class', 'icon-handbag icons');
535			},
536			success: function(json) {
537				$('.alert-dismissible, .text-danger').remove();
538
539				if (json['redirect']) {
540					input_container.append('<div class="ht__size__text">' + json['redirect'] + '</div>');
541				}
542				if(custom_redirect){
543					location = custom_redirect;
544				}
545
546				if (json['success']) {
547					if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') {
548						location = 'index.php?route=checkout/cart';
549					}
550					$('#products-content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
551
552					// Need to set timeout otherwise it wont update the total
553					setTimeout(function () {
554						$('#ajax_cart_quantity').addClass("active");
555						$('#ajax_cart_quantity_sticky').addClass("active");
556						$('#ajax_cart_quantity').html(json['quantity']);
557						$('#ajax_cart_quantity_sticky').html(json['quantity']);
558						$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
559						// $('#product-container-'+product_id+' .ht__size__list').removeClass("active");
560						input_container.find('.ht__size__text').remove();
561					}, 100);
562
563					$('#cart > ul > li.cart_content').load('index.php?route=common/cart/info ul li .shopping__cart', function() {
564						$('#cart-notification').html('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
565						$('#cart > ul > li > .shopping__cart').addClass('shopping__cart__on');
566						$('.body__overlay').addClass('is-visible');
567						$('body, html').addClass('show_curtain');
568					});
569					gtag_add_to_cart(product_id, json['name'], list, json['manufacturer'], json['main_category_name'], position, 1, json['unformatted_price']);
570					fbq('track', 'AddToCart',{
571						value: json['unformatted_price'],
572						currency: 'EUR',
573						content_name: json['name'],
574						content_type: 'product',
575						content_ids: product_id
576					});
577					glami('track', 'AddToCart', {
578						item_ids: [json['glami_product_id']],
579						product_names: [json['name']],
580						value: json['unformatted_price'],
581						currency: 'EUR'
582					});
583				}
584			},
585			error: function(xhr, ajaxOptions, thrownError) {
586				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
587			}
588		});
589	},
590	'add_wishlist': function(product_id, position, button) {
591		$.ajax({
592			url: 'index.php?route=checkout/cart/add_wishlist',
593			type: 'post',
594			data: $('#wishlist-product-'+position+' input[type=\'text\'], #wishlist-product-'+position+' input[type=\'hidden\'], #wishlist-product-'+position+' input[type=\'radio\']:checked, #wishlist-product-'+position+' input[type=\'checkbox\']:checked, #wishlist-product-'+position+' select, #wishlist-product-'+position+' textarea'),
595			dataType: 'json',
596			beforeSend: function() {
597				button.button('loading');
598			},
599			complete: function() {
600				button.button('reset');
601			},
602			success: function(json) {
603				$('#select-size-text-'+ product_id).remove();
604				$('.alert-dismissible, .text-danger').remove();
605
606
607				if (json['error']) {
608					if (json['error']['option']) {
609						console.log(json['error']['option']);
610						for(var product_option_id in json['error']['option']){
611							console.log(product_option_id);
612							console.log(json['error']['option'][product_option_id]);
613							$('#product-option-container-'+ product_option_id +'-'+ position ).append('<div class="text-danger">' + json['error']['option'][product_option_id] + '</div>');
614						}
615					}else if (json['redirect']) {
616						$('#wishlist-product-'+position+' .product-options').append('<div id="select-size-text-'+ product_id +'" class="ht__size__text">' + json['redirect'] + '</div>');
617					}
618				}else if (json['redirect']) {
619					$('#wishlist-product-'+position+' .product-options').append('<div id="select-size-text-'+ product_id +'" class="ht__size__text">' + json['redirect'] + '</div>');
620				}
621
622				if (json['success']) {
623
624					// Need to set timeout otherwise it wont update the total
625					setTimeout(function () {
626						$('#ajax_cart_quantity').addClass("active");
627						$('#ajax_cart_quantity_sticky').addClass("active");
628						$('#ajax_cart_quantity').html(json['quantity']);
629						$('#ajax_cart_quantity_sticky').html(json['quantity']);
630						$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
631						$('#select-size-text-'+ product_id +'').remove();
632					}, 100);
633
634					// $('html, body').animate({ scrollTop: 0 }, 'slow');
635
636					$('#cart > ul > li > .shopping__cart').load('index.php?route=common/cart/info ul li .shopping__cart .shopping__cart__inner', function() {
637					  $('#cart-notification').html('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
638					});
639					$('#cart > ul > li > .shopping__cart').addClass('shopping__cart__on');
640					$('.body__overlay').addClass('is-visible');
641					gtag_add_to_cart(product_id, json['name'], 'wishlist', json['manufacturer'], json['main_category_name'], position, 1, json['unformatted_price']);
642					fbq('track', 'AddToCart',{
643						value: json['unformatted_price'],
644						currency: 'EUR',
645						content_name: json['name'],
646						content_type: 'product',
647						content_ids: product_id
648					});
649					glami('track', 'AddToCart', {
650						item_ids: [json['glami_product_id']],
651						product_names: [json['name']],
652						value: json['unformatted_price'],
653						currency: 'EUR'
654					});
655				}
656
657			},
658			error: function(xhr, ajaxOptions, thrownError) {
659				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
660			}
661		});
662	},
663	// 'add_list': function(product_id, custom_redirect = '',list = '', position = 1) {
664	'add_list': function(product_id, custom_redirect,list, position ) {
665		console.log(product_id);
666		console.log(custom_redirect);
667		console.log(list);
668		console.log(position);
669		console.log($('#list-product-container-'+product_id+' input[type=\'text\'], #list-product-container-'+product_id+' input[type=\'hidden\'], #list-product-container-'+product_id+' input[type=\'radio\']:checked, #list-product-container-'+product_id+' input[type=\'checkbox\']:checked, #list-product-container-'+product_id+' select, #list-product-container-'+product_id+' textarea'));
670		$.ajax({
671			url: 'index.php?route=checkout/cart/add',
672			type: 'post',
673			data: $('#list-product-container-'+product_id+' input[type=\'text\'], #list-product-container-'+product_id+' input[type=\'hidden\'], #list-product-container-'+product_id+' input[type=\'radio\']:checked, #list-product-container-'+product_id+' input[type=\'checkbox\']:checked, #list-product-container-'+product_id+' select, #list-product-container-'+product_id+' textarea'),
674			dataType: 'json',
675			beforeSend: function() {
676				$('#cart > button').button('loading');
677			},
678			complete: function() {
679				$('#cart > button').button('reset');
680			},
681			success: function(json) {
682				console.log(json);
683				$('.alert-dismissible, .text-danger').remove();
684
685				if (json['redirect']) {
686
687					$('#list-product-container-'+product_id+' .ht__size__list').addClass("active");
688					$('#list-product-container-'+product_id+' .ht__size__list').after('<div id="select-size-text-'+ product_id +'" class="ht__size__text">' + json['redirect'] + '</div>');
689				}
690				if(custom_redirect){
691					location = custom_redirect;
692				}
693
694				if (json['success']) {
695					$('#products-content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
696
697					// Need to set timeout otherwise it wont update the total
698					setTimeout(function () {
699						$('#ajax_cart_quantity').addClass("active");
700						$('#ajax_cart_quantity_sticky').addClass("active");
701						$('#ajax_cart_quantity').html(json['quantity']);
702						$('#ajax_cart_quantity_sticky').html(json['quantity']);
703						$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
704						$('#list-product-container-'+product_id+' .ht__size__list').removeClass("active");
705						$('#select-size-text-'+ product_id +'').remove();
706					}, 100);
707
708					$('html, body').animate({ scrollTop: 0 }, 'slow');
709
710					$('#cart > ul > li.cart_content').load('index.php?route=common/cart/info ul li .shopping__cart', function() {
711						$('#cart-notification').html('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
712						$('#cart > ul > li > .shopping__cart').addClass('shopping__cart__on');
713						$('.body__overlay').addClass('is-visible');
714						$('body, html').addClass('show_curtain');
715					});
716					gtag_add_to_cart(product_id, json['name'], list, json['manufacturer'], json['main_category_name'], position, 1, json['unformatted_price']);
717					fbq('track', 'AddToCart',{
718						value: json['unformatted_price'],
719						currency: 'EUR',
720						content_name: json['name'],
721						content_type: 'product',
722						content_ids: product_id
723					});
724					glami('track', 'AddToCart', {
725						item_ids: [json['glami_product_id']],
726						product_names: [json['name']],
727						value: json['unformatted_price'],
728						currency: 'EUR'
729					});
730				}
731			},
732			error: function(xhr, ajaxOptions, thrownError) {
733				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
734			}
735		});
736	},
737	'update': function(key, quantity) {
738		$.ajax({
739			url: 'index.php?route=checkout/cart/edit',
740			type: 'post',
741			data: 'key=' + key + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
742			dataType: 'json',
743			beforeSend: function() {
744				$('#cart > button').button('loading');
745			},
746			complete: function() {
747				$('#cart > button').button('reset');
748			},
749			success: function(json) {
750				// Need to set timeout otherwise it wont update the total
751				setTimeout(function () {
752					$("#ajax_cart_quantity").addClass("active");
753						$('#ajax_cart_quantity').html(json['quantity']);
754					$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
755				}, 100);
756
757				if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') {
758					location = 'index.php?route=checkout/cart';
759				} else {
760					$('#cart > ul').load('index.php?route=common/cart/info');
761				}
762			},
763			error: function(xhr, ajaxOptions, thrownError) {
764				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
765			}
766		});
767	},
768	'remove': function(key) {
769		$.ajax({
770			url: 'index.php?route=checkout/cart/remove',
771			type: 'post',
772			data: 'key=' + key,
773			dataType: 'json',
774			beforeSend: function() {
775				$('#cart > button').button('loading');
776			},
777			complete: function() {
778				$('#cart > button').button('reset');
779			},
780			success: function(json) {
781				// Need to set timeout otherwise it wont update the total
782				setTimeout(function () {
783
784					if (json['quantity'] == '0'){
785						$("#ajax_cart_quantity").removeClass("active");
786					}
787					$('#ajax_cart_quantity').html(json['quantity']);
788					$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
789				}, 100);
790
791				if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') {
792					location = 'index.php?route=checkout/cart';
793				} else {
794					$('#cart > ul > li.cart_content').load('index.php?route=common/cart/info ul li .shopping__cart', function() {
795						$('#cart-notification').html('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
796						$('#cart > ul > li > .shopping__cart').addClass('shopping__cart__on');
797						$('.body__overlay').addClass('is-visible');
798						$('body, html').addClass('show_curtain');
799					});
800				}
801
802				gtag_remove_from_cart(json['product_id'], json['name'], json['manufacturer'], json['main_category_name'], json['quantity_removed'], json['unformatted_price']);
803			},
804			error: function(xhr, ajaxOptions, thrownError) {
805				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
806			}
807		});
808	}
809}
810
811// Cart add remove functions
812var shipping = {
813	'check': function() {
814		$.ajax({
815			url: 'index.php?route=checkout/checkout/update',
816			type: 'post',
817			dataType: 'json',
818			beforeSend: function() {
819				$('#cart > button').button('loading');
820			},
821			complete: function() {
822				$('#cart > button').button('reset');
823			},
824			success: function(json) {
825				$('.alert-dismissible, .text-danger').remove();
826
827
828				if (json['success']) {
829					// Need to set timeout otherwise it wont update the total
830					setTimeout(function () {
831					}, 100);
832
833
834					$('#cart > ul > li > .shopping__cart').load('index.php?route=common/cart/info ul li .shopping__cart .shopping__cart__inner');
835				}
836			},
837			error: function(xhr, ajaxOptions, thrownError) {
838				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
839			}
840		});
841	},
842}
843
844var voucher = {
845	'add': function() {
846
847	},
848	'remove': function(key) {
849		$.ajax({
850			url: 'index.php?route=checkout/cart/remove',
851			type: 'post',
852			data: 'key=' + key,
853			dataType: 'json',
854			beforeSend: function() {
855				$('#cart > button').button('loading');
856			},
857			complete: function() {
858				$('#cart > button').button('reset');
859			},
860			success: function(json) {
861				// Need to set timeout otherwise it wont update the total
862				setTimeout(function () {
863
864					if (json['quantity'] == '0'){
865						$("#ajax_cart_quantity").removeClass("active");
866					}
867					$('#ajax_cart_quantity').html(json['quantity']);
868					$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
869				}, 100);
870
871				if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') {
872					location = 'index.php?route=checkout/cart';
873				} else {
874					$('#cart > ul > li > .shopping__cart').load('index.php?route=common/cart/info ul li .shopping__cart .shopping__cart__inner');
875				}
876			},
877			error: function(xhr, ajaxOptions, thrownError) {
878				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
879			}
880		});
881	}
882}
883
884var wishlist = {
885	'add': function(product_id, button) {
886		$.ajax({
887			url: 'index.php?route=account/wishlist/add_with_option',
888			type: 'post',
889			data:$('#product-product input[type=\'text\'], #product-product input[type=\'hidden\'], #product-product input[type=\'radio\']:checked, #product-product input[type=\'checkbox\']:checked, #product-product select, #product-product textarea'),
890			dataType: 'json',
891			beforeSend: function() {
892				button.button('loading');
893				$('.alert-dismissible, .text-danger').remove();
894			},
895			complete: function() {
896				button.button('reset');
897			},
898			success: function(json) {
899
900				if (json['error']) {
901					$('.product-options-container').after('<div class="text-danger">' + json['error'] + '</div>');
902				}
903				if (json['success']) {
904					$('body').append('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
905				}
906			},
907			error: function(xhr, ajaxOptions, thrownError) {
908				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
909			}
910		});
911	},
912	'add_grid': function(product_id, button) {
913		var product_container = button.closest('.flex-product');
914
915		$.ajax({
916			url: 'index.php?route=account/wishlist/add_with_option',
917			type: 'post',
918			data: product_container.find('input[type=\'text\'], input[type=\'hidden\'], input[type=\'radio\']:checked, input[type=\'checkbox\']:checked, select, textarea'),
919			dataType: 'json',
920			beforeSend: function() {
921				button.button('loading');
922			},
923			complete: function() {
924				button.button('reset');
925			},
926			success: function(json) {
927				$('#select-size-text-'+ product_id).remove();
928				$('.alert-dismissible, .text-danger').remove();
929
930				if (json['error']) {
931					button.before('<div id="select-size-text-'+ product_id +'" class="ht__size__text">' + json['error'] + '</div>');
932				}
933				if (json['success']) {
934					$('#products-content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
935				}
936			},
937			error: function(xhr, ajaxOptions, thrownError) {
938				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
939			}
940		});
941		//*/
942	},
943	'remove': function() {
944
945	}
946}
947
948var compare = {
949	'add': function(product_id) {
950		$.ajax({
951			url: 'index.php?route=product/compare/add',
952			type: 'post',
953			data: 'product_id=' + product_id,
954			dataType: 'json',
955			success: function(json) {
956				$('.alert-dismissible').remove();
957
958				if (json['success']) {
959					$('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
960
961					$('#compare-total').html(json['total']);
962
963					$('html, body').animate({ scrollTop: 0 }, 'slow');
964				}
965			},
966			error: function(xhr, ajaxOptions, thrownError) {
967				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
968			}
969		});
970	},
971	'remove': function() {
972
973	}
974}
975
976/* Agree to Terms */
977$(document).delegate('.agree', 'click', function(e) {
978	e.preventDefault();
979
980	$('#modal-agree').remove();
981
982	var element = this;
983	var target = $(this).parent().attr('for');
984	$.ajax({
985		url: $(element).attr('href'),
986		type: 'get',
987		dataType: 'html',
988		success: function(data) {
989			html  = '<div id="modal-agree" class="modal">';
990			html += '  <div class="modal-dialog modal-lg">';
991			html += '    <div class="modal-content">';
992			html += '      <div class="modal-header">';
993			html += '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
994			html += '        <h4 class="modal-title">' + $(element).text() + '</h4>';
995			html += '      </div>';
996			html += '      <div class="modal-body">' + data + '</div>';
997			html += '      <div class="modal-footer">';
998			html += '			<button type="button" class="btn btn-secondary btn-lg text-uppercase mb-0" data-dismiss="modal" aria-hidden="true">';
999			html += '				<span class="show-en">Close</span>';
1000			html += '				<span class="show-el">Κλείσιμο</span>';
1001			html += '			</button>';
1002			html += '			<button type="button" class="btn btn-red" onclick="$(\'#modal-agree\').modal(\'hide\');$(\'#'+target+'\').prop(\'checked\',true);" aria-hidden="true">';
1003			html += '				<span class="show-en">Accept</span>';
1004			html += '				<span class="show-el">Αποδοχή</span>';
1005			html += '			</button>';
1006			html += '		</div>';
1007			html += '    </div>';
1008			html += '  </div>';
1009			html += '</div>';
1010
1011			$('body').append(html);
1012
1013			$('#modal-agree').modal('show');
1014		}
1015	});
1016});
1017
1018// Autocomplete */
1019(function($) {
1020	$.fn.autocomplete = function(option) {
1021		return this.each(function() {
1022			this.timer = null;
1023			this.items = new Array();
1024
1025			$.extend(this, option);
1026
1027			$(this).attr('autocomplete', 'off');
1028
1029			// Focus
1030			$(this).on('focus', function() {
1031				this.request();
1032			});
1033
1034			// Blur
1035			$(this).on('blur', function() {
1036				setTimeout(function(object) {
1037					object.hide();
1038				}, 200, this);
1039			});
1040
1041			// Keydown
1042			$(this).on('keydown', function(event) {
1043				switch(event.keyCode) {
1044					case 27: // escape
1045						this.hide();
1046						break;
1047					default:
1048						this.request();
1049						break;
1050				}
1051			});
1052
1053			// Click
1054			this.click = function(event) {
1055				event.preventDefault();
1056
1057				value = $(event.target).parent().attr('data-value');
1058
1059				if (value && this.items[value]) {
1060					this.select(this.items[value]);
1061				}
1062			}
1063
1064			// Show
1065			this.show = function() {
1066				var pos = $(this).position();
1067
1068				$(this).siblings('ul.dropdown-menu').css({
1069					top: pos.top + $(this).outerHeight(),
1070					left: pos.left
1071				});
1072
1073				$(this).siblings('ul.dropdown-menu').show();
1074			}
1075
1076			// Hide
1077			this.hide = function() {
1078				$(this).siblings('ul.dropdown-menu').hide();
1079			}
1080
1081			// Request
1082			this.request = function() {
1083				clearTimeout(this.timer);
1084
1085				this.timer = setTimeout(function(object) {
1086					object.source($(object).val(), $.proxy(object.response, object));
1087				}, 200, this);
1088			}
1089
1090			// Response
1091			this.response = function(json) {
1092				html = '';
1093
1094				if (json.length) {
1095					for (i = 0; i < json.length; i++) {
1096						this.items[json[i]['value']] = json[i];
1097					}
1098
1099					for (i = 0; i < json.length; i++) {
1100						if (!json[i]['category']) {
1101							html += '<li data-value="' + json[i]['value'] + '"><a href="#">' + json[i]['label'] + '</a></li>';
1102						}
1103					}
1104
1105					// Get all the ones with a categories
1106					var category = new Array();
1107
1108					for (i = 0; i < json.length; i++) {
1109						if (json[i]['category']) {
1110							if (!category[json[i]['category']]) {
1111								category[json[i]['category']] = new Array();
1112								category[json[i]['category']]['name'] = json[i]['category'];
1113								category[json[i]['category']]['item'] = new Array();
1114							}
1115
1116							category[json[i]['category']]['item'].push(json[i]);
1117						}
1118					}
1119
1120					for (i in category) {
1121						html += '<li class="dropdown-header">' + category[i]['name'] + '</li>';
1122
1123						for (j = 0; j < category[i]['item'].length; j++) {
1124							html += '<li data-value="' + category[i]['item'][j]['value'] + '"><a href="#">&nbsp;&nbsp;&nbsp;' + category[i]['item'][j]['label'] + '</a></li>';
1125						}
1126					}
1127				}
1128
1129				if (html) {
1130					this.show();
1131				} else {
1132					this.hide();
1133				}
1134
1135				$(this).siblings('ul.dropdown-menu').html(html);
1136			}
1137
1138			$(this).after('<ul class="dropdown-menu"></ul>');
1139			$(this).siblings('ul.dropdown-menu').delegate('a', 'click', $.proxy(this.click, this));
1140
1141		});
1142	}
1143})(window.jQuery);

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.