PageSourceSearch

https://vicensvives.com/themes/vicens/assets/js/custom.js

js vicensvives.com collected 2026-10-02 05:44:54 UTC 7,391 bytes, 263 lines download raw bytes

1window.onload = function () {
2
3	$('.www').on('click', function () {
4		swal({
5			customClass : "sa",
6			title: "<img src='/themes/vicens/assets/images/logo_overlay.png'>",
7			text: "<span style='color: #fff;font-size: 50px;font-weight: 700;'>Selecciona tu país de origen</span><ul class='wrap'><li style='    border-bottom: 2px solid #E9E9E9;padding-bottom: 3px;'><a href='javascript:swal.close();'>España</a></li><ul><li><a href='https://www.vicensvives.com.co/'>Colombia</a></li><li><a href='https://www.vicensvives.cl/'>Chile</a></li><li><a href='https://www.vicensvives.com.mx/'>México</a></li><li><a href='https://www.vicensvives.com.pe/'>Perú</a></li></ul></ul>",
8			html: true
9		  });
10    });
11
12$(".hcat1").click(function(){
13    $(".hide1").toggle('slow');
14});
15
16$(".hcat2").click(function(){
17    $(".hide2").toggle('slow');
18});
19
20$(".hcat3").click(function(){
21    $(".hide3").toggle('slow');
22});
23$(".hcat4").click(function(){
24    $(".hide4").toggle('slow');
25});
26$(".hcat5").click(function(){
27    $(".hide5").toggle('slow');
28});
29$(".hcat6").click(function(){
30    $(".hide6").toggle('slow');
31});
32
33
34$(".show_more_desc").click(function(){
35    if ($(".show_more_desc").hasClass("open")){
36        $(".hide_dots").show();
37        $(".show_desc").hide('slow');
38        $(".show_more_desc").removeClass("open");
39        $(".show_more_desc").text("Ver más");
40    }else{
41        $(".hide_dots").hide();
42        $(".show_desc").show('slow');
43        $(".show_more_desc").addClass("open");
44        $(".show_more_desc").text("Ver menos");
45    }
46   
47});
48$(".recursos_ca li a").each(function() {
49    var text = $(this).text();
50    text = text.replace("del libro", "del llibre");
51    $(this).text(text);
52});
53};
54
55//var elementPosition = $('#js-checkout-summary').offset();
56
57/*$(window).scroll(function(){
58        if($(window).scrollTop() > elementPosition.top-50){
59              $('#js-checkout-summary').css('position','fixed');
60              $('#js-checkout-summary').css('top','50px');
61              
62        } else {
63            $('#js-checkout-summary').css('position','relative');
64            $('#js-checkout-summary').css('top','0');
65        }    
66});
67*/
68
69$('[data-action="show-password"]').click(function(){
70    if ($(this).hasClass("show")){
71        $(this).css("background-image", "url(/themes/vicens/assets/images/akar-icons_eye.png)");
72        $(this).css("background-size", "37px");
73        $(this).removeClass("show");
74    }else{
75        $(this).css("background-image", "url(/themes/vicens/assets/images/akar-icons_eye_visible.png)");
76        $(this).css("background-position", "0px");
77        $(this).css("background-size", "35px");
78        $(this).addClass("show");
79    }
80
81});
82
83
84
85
86
87$(document).on('click', '.product-thumbnail', function(e){
88	getGtm($(this).attr("data-id"));
89    //console.log($(this).attr("data-id"));
90});
91function getGtm(productId)
92{
93	var ids = 0;
94	if (typeof(ids[1]) !== 'undefined')
95		productAttributeId = parseInt(ids[1]);
96	if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom')
97		customizationId = parseInt(ids[2]);
98	if (typeof(ids[3]) !== 'undefined')
99		id_address_delivery = parseInt(ids[3]);
100	$.ajax({
101		type: 'POST',
102		headers: { "cache-control": "no-cache" },
103		url: prestashop.urls.base_url + '?rand=' + new Date().getTime(),
104		async: true,
105		cache: false,
106		dataType: 'json',
107		data: 'controller=cart'
108			+ '&ajax=true&gtm=true&summary=true'
109			+ '&id_product='+productId
110			+ '&allow_refresh=1',
111		success: function(jsonData2)
112		{
113			sendGTM2(jsonData2, 1);
114		}
115	});
116}
117
118$(".js-product-miniature").click(function(e){
119	sendGTM2("items:[{"+$(this).attr("data-gtm")+"}]",1);
120})
121
122function sendGTM2(gtm, type){
123	switch (type) {
124		case 1:
125			dataLayer.push({ ecommerce: null });  // hack: clean previous data
126			dataLayer.push({
127				event : 'add_to_cart', 
128				ecommerce: {
129					currency: 'EUR',
130					items:gtm
131				}
132			});
133			dataLayer.push({ event : 'gtm.datalayer' });
134			break;
135		default:
136			break;
137	}
138}
139
140
141// CHECKOUT
142$(document).ready(function() {
143	if(prestashop.page.page_name == "checkout"){
144		// Estilos payment option
145		$(document).on('click', "input[name='payment-option']", function(event) {
146			$(".payment-option").removeClass("selected");
147			$(event.target).closest(".payment-option").addClass("selected");
148		});
149
150		// Funcionamiento botón realizar pago
151		$(document).on('click', "a.fake-continue", function(event) {
152			event.preventDefault();
153			reserva_as400();
154		});
155	}
156
157
158});
159
160function reserva_as400(){
161	//AS400 - fReservarPedido
162	var url = "/auxiliar/askToVV.php";
163	var code2 = $("#id_carrito").val();
164	$("a.fake-continue").addClass("disabled");
165	$("a.fake-continue").hide();
166	$("#fake-continue-loading").show();
167	$.ajax({
168		type: "POST",
169		url: url,
170		data: { code: code2 },
171		success: function(data)
172		{
173			if(data=="1") {
174				reserva_aceptada();
175			}else{
176				reserva_falla();
177				return false;
178			}
179		},
180		error: function(data)
181		{
182			console.log("error en petición reserva as400");
183			reserva_falla();
184		}
185	});
186}
187
188function reserva_aceptada(){
189	$('.center-block').css("pointer-events", "auto");
190	$('.center-block').css("opacity", "1");
191	$(".warning_vicens").remove();
192	$("#continuar_original").click();
193	// $("#payment-confirmation .ps-shown-by-js").removeClass("hidden");
194}
195function reserva_falla(){
196	console.log("no se puede");
197	$('.center-block').css("pointer-events", "none");
198	$('.center-block').css("opacity", "0.5");
199	$(".warning_vicens").remove();
200	$("#payment-confirmation").append("<div class='warning_vicens'><label class='alert_vicens2 warning'>Hay problemas con el stock de los productos, revise su cesta por favor.</label></div>");
201	$("a.fake-continue").removeClass("disabled");
202	$("a.fake-continue").show();
203	$("#fake-continue-loading").hide();
204	// $("#payment-confirmation .ps-shown-by-js").addClass("hidden");
205}
206
207
208/* DESPLEGABLE lateral carrito y customer */
209// $(document).on('click', '.blockcart.cart-preview', function(e) {
210// 	e.preventDefault();
211// 	$('#_desktop_user_info .user-popup').removeClass('open');
212// 	$(this).parent().find('.lateral-popup').toggleClass('open');
213// 	$('body').toggleClass('openLateralPopup');
214// });
215// $(document).on('click', '#header .lateral-popup .close-popup', function() {
216// 	$(this).closest('.lateral-popup').removeClass('open');
217// 	$('body').removeClass('openLateralPopup');
218// });
219//
220// $(document).on('click', '.user-info', function(e) {
221// 	e.preventDefault();
222// 	$('#_desktop_user_info').next().toggleClass('open');
223// 	$('body').toggleClass('openLateralPopup');
224// });
225/* end DESPLEGABLE lateral carrito y customer */
226
227/* abrir búsqueda */
228	$(document).on('click', '#search_button', function(e) {
229		e.preventDefault();
230		$('#_desktop_search').toggleClass('open');
231	});
232/* abrir busqueda end */
233
234$(document).ready(function() {
235	var header = $("#header");
236	var headerOffset = header.offset().top;
237	var headerHeight = header.outerHeight();
238	var distance = headerOffset + headerHeight;
239
240	header.css("height", headerHeight);
241
242	var lastScrollTop = 0;
243
244	$(window).scroll(function() {
245		if ($(window).scrollTop() > distance) {
246			header.addClass("fixed-header");
247		} else {
248			header.removeClass("fixed-header");
249		}
250
251		var scrollTop = $(this).scrollTop();
252		if (scrollTop < lastScrollTop ) {
253			if (!header.hasClass("scrollup-header"))
254				header.addClass("scrollup-header");
255		}
256		else{
257			header.removeClass("scrollup-header");
258		}
259
260		lastScrollTop = scrollTop;
261	});
262
263});

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.