PageSourceSearch

https://www.yodeyma.com/ireland/en/themes/yodeyma/js/global.js

js yodeyma.com collected 2026-09-26 17:31:33 UTC 14,626 bytes, 406 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//global variables
26var responsiveflag = false;
27
28$(document).ready(function(){
29	highdpiInit();
30	responsiveResize();
31	$(window).resize(responsiveResize);
32	if (navigator.userAgent.match(/Android/i))
33	{
34		var viewport = document.querySelector('meta[name="viewport"]');
35		viewport.setAttribute('content', 'initial-scale=1.0,maximum-scale=1.0,user-scalable=0,width=device-width,height=device-height');
36		window.scrollTo(0, 1);
37	}
38	blockHover();
39	if (typeof quickView !== 'undefined' && quickView)
40		quick_view();
41	dropDown();
42
43	if (typeof page_name != 'undefined' && !in_array(page_name, ['index', 'product']))
44	{
45		bindGrid();
46
47 		$(document).on('change', '.selectProductSort', function(e){
48			if (typeof request != 'undefined' && request)
49				var requestSortProducts = request;
50 			var splitData = $(this).val().split(':');
51			if (typeof requestSortProducts != 'undefined' && requestSortProducts)
52				document.location.href = requestSortProducts + ((requestSortProducts.indexOf('?') < 0) ? '?' : '&') + 'orderby=' + splitData[0] + '&orderway=' + splitData[1];
53    	});
54
55		$(document).on('change', 'select[name="n"]', function(){
56			$(this.form).submit();
57		});
58
59		$(document).on('change', 'select[name="manufacturer_list"], select[name="supplier_list"]', function() {
60			if (this.value != '')
61				location.href = this.value;
62		});
63
64		$(document).on('change', 'select[name="currency_payement"]', function(){
65			setCurrency($(this).val());
66		});
67	}
68
69	$(document).on('click', '.back', function(e){
70		e.preventDefault();
71		history.back();
72	});
73	
74	jQuery.curCSS = jQuery.css;
75	if (!!$.prototype.cluetip)
76		$('a.cluetip').cluetip({
77			local:true,
78			cursor: 'pointer',
79			dropShadow: false,
80			dropShadowSteps: 0,
81			showTitle: false,
82			tracking: true,
83			sticky: false,
84			mouseOutClose: true,
85			fx: {             
86		    	open:       'fadeIn',
87		    	openSpeed:  'fast'
88			}
89		}).css('opacity', 0.8);
90
91	if (!!$.prototype.fancybox)
92		$.extend($.fancybox.defaults.tpl, {
93			closeBtn : '<a title="' + FancyboxI18nClose + '" class="fancybox-item fancybox-close" href="javascript:;"></a>',
94			next     : '<a title="' + FancyboxI18nNext + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
95			prev     : '<a title="' + FancyboxI18nPrev + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
96		});
97
98	// Mostrar / Ocultar contraseña
99	$(".toggle-password").click(function() {
100
101		$(this).toggleClass("fa-eye fa-eye-slash");
102		var input = $($(this).attr("toggle"));
103		if (input.attr("type") == "password") {
104		input.attr("type", "text");
105		} else {
106		input.attr("type", "password");
107		}
108	});
109
110	const urlParams = new URLSearchParams(window.location.search);
111
112	if (urlParams.get('multishopmodal')) {
113		document.querySelector('.multishoplink-modal').click();
114	}
115});
116
117function highdpiInit()
118{
119	if($('.replace-2x').css('font-size') == "1px")
120	{		
121		var els = $("img.replace-2x").get();
122		for(var i = 0; i < els.length; i++)
123		{
124			src = els[i].src;
125			extension = src.substr( (src.lastIndexOf('.') +1) );
126			src = src.replace("." + extension, "2x." + extension);
127			
128			var img = new Image();
129			img.src = src;
130			img.height != 0 ? els[i].src = src : els[i].src = els[i].src;
131		}
132	}
133}
134
135function responsiveResize()
136{
137	if ($(document).width() <= 767 && responsiveflag == false)
138	{
139		accordion('enable');
140	    accordionFooter('enable');
141		responsiveflag = true;	
142	}
143	else if ($(document).width() >= 768)
144	{
145		accordion('disable');
146		accordionFooter('disable');
147	    responsiveflag = false;
148	}
149	if (typeof page_name != 'undefined' && in_array(page_name, ['category']))
150		resizeCatimg();
151}
152
153function blockHover(status)
154{
155	$(document).off('mouseenter').on('mouseenter', '.product-container', function(e){
156
157			$(this).addClass("hovered");
158			$(this).find(".img_1").stop().fadeIn("fast");
159			$(this).find(".availability-slidein").stop().slideUp("fast");
160			$(this).find(".functional-buttons-grid").stop().slideDown("fast");
161			
162			
163	});
164
165	$(document).off('mouseleave').on('mouseleave', '.product-container', function(e){
166			$(this).removeClass("hovered");
167			$(this).find(".img_1").stop().fadeOut("fast");
168			$(this).find(".functional-buttons-grid").stop().slideUp("fast");
169			$(this).find(".availability-slidein").stop().slideDown("fast");
170	});
171}
172
173function is_touch_device() {
174	if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
175		return true;
176	} else {
177		return false; }
178};
179
180
181function quick_view()
182{
183	$(document).on('click', '.quick-view:visible, .quick-view-mobile:visible', function(e) 
184	{
185		e.preventDefault();
186		var url = this.rel;
187		if (url.indexOf('?') != -1)
188			url += '&';
189		else
190			url += '?';
191
192		if (!!$.prototype.fancybox)
193			$.fancybox({
194				'padding':  0,
195				'width':    1087,
196				'height':   610,
197				'type':     'iframe',
198				'href':     url + 'content_only=1'
199			});
200	});
201}
202
203function bindGrid()
204{
205
206	var view = $.totalStorage('display');
207	
208	if (!view && (typeof displayList != 'undefined') && displayList)
209		view = 'list';
210
211	if (view && view != 'grid')
212		display(view);
213	else
214		$('.display').find('li#grid').addClass('selected');
215	
216	$(document).on('click', '#grid', function(e){
217		e.preventDefault();
218		$('ul.product_list').animate({ opacity: 0 }, 400);
219		setTimeout(function() { display('grid'); }, 400)
220		$('ul.product_list').animate({ opacity: 1 }, 400);
221	});
222
223	$(document).on('click', '#list', function(e){
224		e.preventDefault();
225		$('ul.product_list').animate({ opacity: 0 }, 400)
226		setTimeout(function() {display('list');  }, 400)
227		$('ul.product_list').animate({ opacity: 1 }, 400);
228	});
229}
230
231function display(view)
232{
233	if (view == 'list')
234	{
235		$('ul.product_list').removeClass('grid').addClass('list row');
236		$('.product_list > li').removeClass('col-xs-12 col-ms-'+grid_size_ms2+' col-sm-'+grid_size_sm2+' col-md-'+grid_size_md2+' col-lg-'+grid_size_lg2).addClass('col-xs-12');
237		$('.product_list > li').each(function(index, element) {
238			html = '';
239			html = '<div class="product-container"><div class="row">';
240				html += '<div class="left-block col-xs-5 col-md-3"><div class="product-image-container">' + $(element).find('.left-block .product_img_link')[0].outerHTML + '</div></div>';
241				html += '<div class="center-block col-xs-7 col-md-6">';
242					html += '<h5 itemprop="name">'+ $(element).find('h5').html() + '</h5>';
243					html += '<span class="product-reference">'+ $(element).find('.product-reference').html() + '</span>';
244					var rating = $(element).find('.comments_note').html(); // check : rating
245					if (rating != null) { 
246						html += '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" class="comments_note">'+ rating + '</div>';
247					}
248					html += '<div class="product-flags">'+ $(element).find('.product-flags').html() + '</div>';
249					html += '<p class="product-desc">'+ $(element).find('.product-desc').html() + '</p>';
250					var colorList = $(element).find('.color-list-container').html();
251					if (colorList != null) {
252						html += '<div class="color-list-container">'+ colorList +'</div>';
253					}
254					var availability = $(element).find('.availability').html();	// check : catalog mode is enabled
255					if (availability != null) {
256						html += '<span class="availability">'+ availability +'</span>';
257					}
258				html += '</div>';	
259				html += '<div class="right-block col-xs-12 col-md-3"><div class="right-block-content"><div class="row">';
260					var price = $(element).find('.content_price').html();       // check : catalog mode is enabled
261					if (price != null) { 
262						html += '<div class="content_price col-xs-6 col-md-12">'+ price + '</div>';
263					}
264					html += '<div class="button-container col-xs-6 col-md-12">'+ $(element).find('.button-container').html() +'</div>';
265					html += '<div class="functional-buttons functional-buttons-list  col-xs-12 col-md-12 clearfix">' + $(element).find('.functional-buttons').html() + '</div>';
266				html += '</div></div>';
267			html += '</div></div>';
268		$(element).html(html);
269		});		
270		$('.display').find('li#list').addClass('selected');
271		$('.display').find('li#grid').removeAttr('class');
272		$.totalStorage('display', 'list');
273	}
274	else 
275	{
276		$('ul.product_list').removeClass('list').addClass('grid row');
277		$('.product_list > li').removeClass('col-xs-12').addClass('col-xs-12 col-ms-'+grid_size_ms2+' col-sm-'+grid_size_sm2+' col-md-'+grid_size_md2+' col-lg-'+grid_size_lg2);
278		$('.product_list > li').each(function(index, element) {
279		html = '';
280		html += '<div class="product-container">';
281			var availability = $(element).find('.availability').html(); // check : catalog mode is enabled
282			var avatext =''
283				if (availability != null) {
284					avatext += '<span class="availability availability-slidein">'+ availability +'</span>';
285				}
286			html += '<div class="left-block"><div class="product-image-container">' + $(element).find('.left-block .product_img_link')[0].outerHTML + '<div class="product-flags">'+ $(element).find('.product-flags').html() + '</div>' +  '<div class="functional-buttons functional-buttons-grid clearfix">' + $(element).find('.functional-buttons').html() + '</div>' + avatext + '</div></div>';
287			html += '<div class="right-block">';
288				html += '<h5 itemprop="name" class="product-name-container">'+ $(element).find('h5').html() + '</h5>';
289				html += '<span class="product-reference">'+ $(element).find('.product-reference').html() + '</span>';
290				var price = $(element).find('.content_price').html(); // check : catalog mode is enabled
291					if (price != null) { 
292						html += '<div class="content_price">'+ price + '</div>';
293					}	
294				var rating = $(element).find('.comments_note').html(); // check : rating
295					if (rating != null) { 
296						html += '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" class="comments_note">'+ rating + '</div>';
297					}
298				html += '<p itemprop="description" class="product-desc">'+ $(element).find('.product-desc').html() + '</p>';
299				html += '<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="button-container">'+ $(element).find('.button-container').html() +'</div>';
300				var colorList = $(element).find('.color-list-container').html();
301				if (colorList != null) {
302					html += '<div class="color-list-container">'+ colorList +'</div>';
303				}
304				
305			html += '</div>';
306		html += '</div>';		
307		$(element).html(html);
308		});
309		$('.display').find('li#grid').addClass('selected');
310		$('.display').find('li#list').removeAttr('class');
311		$.totalStorage('display', 'grid');
312	}	
313}
314
315function dropDown() 
316{
317	elementClick = '#header .current, #center-layered-nav .layered_subtitle_heading';
318	elementSlide =  'ul.toogle_content';       
319	activeClass = 'active';	
320
321	$(document).on('click', elementClick, function(e){
322		e.stopPropagation();
323		var subUl = $(this).next(elementSlide);
324		if(subUl.is(':hidden'))
325		{
326			subUl.show();
327			$(this).addClass(activeClass);	
328		}
329		else
330		{
331			subUl.hide();
332			$(this).removeClass(activeClass);
333		}
334		$(elementClick).not(this).next(elementSlide).hide();
335		$(elementClick).not(this).removeClass(activeClass);
336		e.preventDefault();	
337	});
338
339	$(document).on('click', elementSlide, function(e){
340		e.stopPropagation();
341	});
342
343	$(document).on('click', function(e){
344		e.stopPropagation();
345		var elementHide = $(elementClick).next(elementSlide);
346		$(elementHide).hide();
347		$(elementClick).removeClass('active');
348	});
349}
350
351function accordionFooter(status)
352{
353	if(status == 'enable')
354	{
355		$('#footer .footer-block h4').on('click', function(){
356			$(this).toggleClass('active').parent().find('.toggle-footer').stop().slideToggle('medium');
357		})
358		$('#footer').addClass('accordion').find('.toggle-footer').slideUp('fast');
359	}
360	else
361	{
362		$('.footer-block h4').removeClass('active').off().parent().find('.toggle-footer').removeAttr('style').slideDown('fast');
363		$('#footer').removeClass('accordion');
364	}
365}
366
367function resizeCatimg()
368{
369	var div = $('.cat_desc').parent('div');
370	var image = new Image;
371	$(image).load(function(){
372	    var width  = image.width;
373	    var height = image.height;
374		var ratio = parseFloat(height / width);
375		var calc = Math.round(ratio * parseInt(div.outerWidth(false)));
376		div.css('min-height', calc);
377	});
378	if (div.length)
379		image.src = div.css('background-image').replace(/url\("?|"?\)$/ig, '');
380}
381
382function accordion(status)
383{
384	leftColumnBlocks = $('#left_column');
385	if(status == 'enable')
386	{
387		$('#right_column .block .title_block, #left_column .block .title_block, #left_column #newsletter_block_left h4').on('click', function(){
388			$(this).toggleClass('active').parent().find('.block_content').stop().slideToggle('medium');
389		})
390		$('#right_column, #left_column').addClass('accordion').find('.block .block_content').slideUp('fast');
391	}
392	else
393	{
394		$('#right_column .block .title_block, #left_column .block .title_block, #left_column #newsletter_block_left h4').removeClass('active').off().parent().find('.block_content').removeAttr('style').slideDown('fast');
395		$('#left_column, #right_column').removeClass('accordion');
396	}
397}
398
399function resetCod() {
400	$('#postcode').val('');
401	$('#city').val('');
402	document.getElementById('test2').value = '';
403	document.getElementById('test2').click();
404	$('#uniform-test2 span:first-child').text('');
405	$('#postcode').parent().removeClass('form-ok form-error');
406}

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.