PageSourceSearch

https://tipro.ro/wp-content/themes/tipro/tipro.js?ver=1.0.1

js tipro.ro collected 2026-10-10 02:09:19 UTC 10,713 bytes, 346 lines download raw bytes

1jQuery(document).ready(function () {
2
3
4jQuery('html.pum-open.pum-open-overlay.pum-open-scrollable body>[aria-hidden]').on('stylechanged', function () {
5    console.log('css changed');
6});
7
8// Perform change
9
10jQuery('html.pum-open.pum-open-overlay.pum-open-scrollable body>[aria-hidden]').css('margin-right', '0px');
11
12
13    // jQuery( "" ).change(function() {
14    //   console.log('meh')
15    // });
16
17});
18
19jQuery('#cookieCheck').click(function(){
20    Cookiebot.renew();
21});
22
23
24
25// jQuery(document).on('uni_cpo_options_data_ajax_before_send', function(event, xhr, settings) {
26//     console.log('AJAX request is about to be sent');
27//     console.log('XHR Object:', xhr);
28//     console.log('AJAX Settings:', settings);
29    
30//     jQuery('.cart input').prop('disabled', true);
31//     // You can add custom actions before the AJAX request is sent
32//     // For example, show a loading spinner
33//     // jQuery('.loading-spinner').show();
34// });
35
36// // Listen for the success event
37// jQuery(document).on('uni_cpo_options_data_ajax_success', function(event, response, status, xhr) {
38//     console.log('AJAX request successful');
39//     console.log('Response:', response);
40//     console.log('Status:', status);
41//     console.log('XHR Object:', xhr);
42//     jQuery('.cart input').prop('disabled', true);
43//     // You can add custom actions after a successful AJAX response
44//     // For example, update some part of the page
45//     // jQuery('.result-container').html(response.someData);
46// });
47
48// // Listen for the complete event (optional, but often useful)
49// jQuery(document).on('uni_cpo_options_data_ajax_complete', function(event, xhr, status) {
50//     console.log('AJAX request completed');
51//     console.log('XHR Object:', xhr);
52//     console.log('Status:', status);
53//     jQuery('.cart input').prop('disabled', false);
54//     // You can add cleanup actions or hide loading spinners
55//     // jQuery('.loading-spinner').hide();
56// });
57
58
59// var notices = '.woocommerce-error, .woocommerce-info, .woocommerce-message, div.wpcf7-response-output, #yith-wcwl-popup-message, .mc4wp-alert, .dokan-store-contact .alert-success, .yith_ywraq_add_item_product_message';
60
61// jQuery('body').on('click', notices, function () {
62//     var $msg = $(this);
63//     hideMessage($msg);
64// });
65
66// var showAllMessages = function () {
67//     $notices.addClass('shown-notice');
68// };
69
70// var hideAllMessages = function () {
71//     hideMessage($notices);
72// };
73
74// var hideMessage = function ($msg) {
75//     $msg.removeClass('shown-notice').addClass('hidden-notice');
76// };
77
78// jQuery(document).on('click', '.uni_cpo_ajax_add_to_cart', function (e) {
79//     e.preventDefault();
80// });
81
82
83
84jQuery( document.body ).on( 'uni_cpo_added_to_cart', function(event){
85    //console.log(event);
86
87    if (jQuery('.cart-widget-opener').length > 0) {
88        jQuery('.cart-widget-opener').trigger('click');
89    }
90
91    timeoutNumber = setTimeout(function () {
92        jQuery('.woodmart-close-side').trigger('click');
93    }, 10000);
94
95});
96
97
98
99
100jQuery('.do-not-show-buttons > form > button').hide();
101jQuery('.do-not-show-buttons > form > .uni-cpo-urls-customer-modal').hide();
102
103
104jQuery(document).ready(function () {
105
106    if(jQuery('.single_add_to_cart_button').length){
107        if (typeof unicpo !== "undefined"){
108            stickyWindow();
109            hideBar();
110        }
111    }
112
113    
114    /*
115     * modal email append default
116     */
117    jQuery(document.body).on('click', '.uni-cpo-urls-customer-modal', function (e) {
118        e.stopPropagation();
119
120
121        jQuery('#uni-cpo-urls-customer-email').val(window.tipro.email);
122        jQuery('#uni-cpo-urls-customer-email').parsley().validate();
123        //jQuery('#uni-cpo-urls-save-configuration-form').parsley().validate();
124                   
125                    
126    });
127
128
129        function hideBar() {
130            
131            jQuery('#meniu-simplu').show();
132            jQuery('#meniu-legare').hide();
133
134
135            jQuery(".rand1").on( "click", function() {
136
137                    jQuery('#meniu-simplu').show();
138                    jQuery('#meniu-legare').hide();
139
140
141            });
142            
143            jQuery(".rand2").on( "click", function() {
144
145                    jQuery('#meniu-simplu').hide();
146                    jQuery('#meniu-legare').show();
147
148
149            });
150
151            
152
153        }
154
155
156
157
158
159function stickyWindow() {
160	jQuery('#sticky-price-holder').hide();
161
162	if (jQuery('.do-not-show-buttons').length === 0) {
163		jQuery('#sticky-price-holder').show();
164	}
165
166	var lastTotals = { net: null, brut: null };
167
168	function normalizeNumberLike(value) {
169		if (value == null) return null;
170		var str = String(value).trim();
171
172		// Înlocuiește virgula cu punct
173		str = str.replace(/\s/g, '').replace(/,/g, '.');
174
175		// Elimină toate punctele în afară de ultimul (ex: 1.234.567.89 -> 1234567.89)
176		var parts = str.split('.');
177		if (parts.length > 2) {
178			var dec = parts.pop();
179			str = parts.join('') + '.' + dec;
180		}
181
182		// Elimină orice altceva ne-numeric (simboluri de monedă etc.)
183		str = str.replace(/[^0-9.\-]/g, '');
184
185		var num = Number(str);
186		return Number.isFinite(num) ? num : null;
187	}
188
189	function toNumber(primary, fallback) {
190		var val = primary != null ? primary : fallback;
191		var num = normalizeNumberLike(val);
192		return num;
193	}
194
195	function safeUpdateSticky(total, totalTaxRev) {
196		// Dacă ambele sunt null/NaN/0, nu suprascrie valorile bune deja afișate,
197		// doar dacă butonul e activ vom încerca să setăm 0 explicit.
198		var isDisabled = jQuery('.single_add_to_cart_button').prop('disabled');
199
200		var net = toNumber(total, null);
201		var brut = toNumber(totalTaxRev, null);
202
203		// Fallback la unicpo.price_vars dacă event payload e gol
204		if (net == null && window.unicpo && unicpo.price_vars) {
205			net = toNumber(unicpo.price_vars.total, null);
206		}
207		if (brut == null && window.unicpo && unicpo.price_vars) {
208			brut = toNumber(unicpo.price_vars.total_tax_rev, null);
209		}
210
211		// Fallback din DOM dacă tot nu avem
212		if (net == null) {
213			var domTotal = jQuery('[data-cpo-total],[data-uni-cpo-total]').first().text();
214			net = toNumber(domTotal, null);
215		}
216		if (brut == null) {
217			var domTotalTax = jQuery('[data-cpo-total-tax],[data-uni-cpo-total-tax]').first().text();
218			brut = toNumber(domTotalTax, null);
219		}
220
221		// Dacă încă sunt null/NaN sau 0 în mod tranzitoriu, păstrăm ultimul non-zero
222		if (!Number.isFinite(net) || net === 0) {
223			if (Number.isFinite(lastTotals.net) && lastTotals.net > 0) net = lastTotals.net;
224		}
225		if (!Number.isFinite(brut) || brut === 0) {
226			if (Number.isFinite(lastTotals.brut) && lastTotals.brut > 0) brut = lastTotals.brut;
227		}
228
229		// Dacă butonul e dezactivat și tot am 0/NaN, nu afisez 0 (afișează mesajul tău de eroare separat)
230		if (isDisabled && (!Number.isFinite(net) || net === 0) && (!Number.isFinite(brut) || brut === 0)) {
231			return;
232		}
233
234		// Memorăm ultimele valori non-zero
235		if (Number.isFinite(net) && net > 0) lastTotals.net = net;
236		if (Number.isFinite(brut) && brut > 0) lastTotals.brut = brut;
237
238		setStickyPriceData({
239			priceNetRon: Number.isFinite(net) ? net.toFixed(2) : '0.00',
240			priceBrutRon: Number.isFinite(brut) ? brut.toFixed(2) : '0.00',
241			title: jQuery("h1.product_title").text()
242		});
243	}
244
245	// Set inițial (după load)
246	setStickyPriceData(getStickyPriceData());
247
248	// Ascultă evenimentele Uni CPO (mai larg, incl. succes AJAX)
249	jQuery(document)
250		.on('uniCpo:calc_success uniCpo:price:changed uni_cpo_total_changed uni_cpo_options_data_ajax_success', function (e, payload) {
251			var d = payload || (e && e.detail) || {};
252			safeUpdateSticky(d.total, d.total_tax_rev);
253		});
254
255	// Selectează containerul Uni CPO chiar dacă id-ul diferă
256	const targetNode =
257		document.getElementById('uni_cpo_options') ||
258		document.querySelector('[id^="uni_cpo_options"]');
259
260	if (targetNode) {
261		const config = { childList: true, subtree: true };
262
263		const callback = function (mutationsList) {
264			for (let mutation of mutationsList) {
265				if (mutation.type === 'childList') {
266					setTimeout(function () {
267						setStickyPriceData(getStickyPriceData());
268
269						if (jQuery('.single_add_to_cart_button').prop('disabled')) {
270							jQuery('#sticky-error').show();
271							jQuery('#hide-on-error').hide();
272							jQuery('#sticky-error').text('Continuă selecțiile și corectează opțiunile mar
272cate!');
273							jQuery('.uni-cpo-urls-customer-modal').hide();
274						} else {
275							jQuery('#sticky-error').hide();
276							jQuery('#hide-on-error').show();
277							jQuery('.uni-cpo-urls-customer-modal').show();
278						}
279					}, 0);
280				}
281			}
282		};
283
284		const observer = new MutationObserver(callback);
285		observer.observe(targetNode, config);
286	}
287
288	function setStickyPriceData(data) {
289		var stickyContainer = jQuery("#sticky-price-holder");
290		var netContainer = stickyContainer.find(".sticky-net");
291		var brutContainer = stickyContainer.find(".sticky-tva");
292
293		stickyContainer.find('h6').html(data.title);
294		netContainer.find('.sticky-price-ron').html(data.priceNetRon);
295		brutContainer.find('.sticky-price-ron').html(data.priceBrutRon);
296	}
297
298	function getStickyPriceData() {
299		var total = toNumber(null, (window.unicpo && unicpo.price_vars && unicpo.price_vars.total));
300		var totalTaxRev = toNumber(null, (window.unicpo && unicpo.price_vars && unicpo.price_vars.total_tax_rev));
301
302		// Fallback din DOM dacă e nevoie
303		if (total == null) {
304			var domTotal = jQuery('[data-cpo-total],[data-uni-cpo-total]').first().text();
305			total = toNumber(domTotal, null);
306		}
307		if (totalTaxRev == null) {
308			var domTotalTax = jQuery('[data-cpo-total-tax],[data-uni-cpo-total-tax]').first().text();
309			totalTaxRev = toNumber(domTotalTax, null);
310		}
311
312		// Memorăm ultimele non-zero
313		if (Number.isFinite(total) && total > 0) lastTotals.net = total;
314		if (Number.isFinite(totalTaxRev) && totalTaxRev > 0) lastTotals.brut = totalTaxRev;
315
316		return {
317			priceNetRon: Number.isFinite(total) ? total.toFixed(2) : (Number.isFinite(lastTotals.net) ? lastTotals.net.toFixed(2) : '0.00'),
318			priceBrutRon: Number.isFinite(totalTaxRev) ? totalTaxRev.toFixed(2) : (Number.isFinite(lastTotals.brut) ? lastTotals.brut.toFixed(2) : '0.00'),
319			title: jQuery("h1.product_title").text()
320		}
321	}
322}
323
324});
325
326
327
328document.addEventListener('DOMContentLoaded', function () {
329    const menu = document.querySelector('.tipro-product-menu-2026');
330
331    if (!menu) return;
332
333    const parents = menu.querySelectorAll('li.menu-item-has-children');
334
335    parents.forEach(function (item) {
336        item.addEventListener('mouseenter', function () {
337            document.body.classList.add('tipro-menu-submenu-open');
338        });
339
340        item.addEventListener('mouseleave', function () {
341            document.body.classList.remove('tipro-menu-submenu-open');
342        });
343    });
344});
345
346

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.