PageSourceSearch

https://nuovavita.ru/catalog/view/theme/unishop2/js/user-request.js

js nuovavita.ru collected 2026-10-09 22:43:02 UTC 3,035 bytes, 101 lines download raw bytes

1$(function() {	
2	if(uniJsVars.notify.status) {
3		let notify = () => {
4			$('main').find('.add_to_cart.disabled').each(function() {
5				let pid = $(this).data('pid');
6				
7				if(typeof($(this).data('pid')) == 'undefined') pid = Number($(this).attr('class').replace(/\D+/g,''));
8			
9				const params = '[{"reason":"'+uniJsVars.notify.text+'", "p_id":'+pid+'}]';
10				
11				$(this).removeAttr('disabled').unbind().attr('onclick', 'uniRequestOpen('+params+')').css('cursor', 'pointer');
12			});
13		};
14	
15		notify();
16		
17		$(document).ajaxStop(() => {
18			setTimeout(() => { 
19				notify();
20			}, 300);
21		});
22	}
23});
24
25function uniRequestOpen(params) {
26	//params format - [{'reason':'text', 'p_id':number}, 'phone', 'mail', 'comment']
27	//'phone', 'mail', 'comment' - names of the fields to display
28	
29	uniAddCss('catalog/view/theme/unishop2/stylesheet/request.css');
30	uniAddJs('catalog/view/theme/unishop2/js/jquery.maskedinput.min.js');
31	
32	let data = '';
33	
34	for (i in params) {
35		if(typeof(params[i]) == 'object') {
36			for (k in params[i]) {
37				data += '&'+k+'='+encodeURIComponent(params[i][k]);
38			}
39		} else {
40			data += '&'+params[i]+'=';
41		}
42	}
43	
44	$.ajax({
45		url:'index.php?route=extension/module/uni_request'+data,
46		type:'get',
47		dataType:'html',
48		success: function(data) {			
49			$('html body').append(data);
50			$('#modal-request-form').addClass(uniJsVars.popup_effect_in).modal('show');
51		}
52	});
53}
54
55function uniRequestSend() {
56	const form = '#modal-request-form';
57	
58	$.ajax({
59		url: 'index.php?route=extension/module/uni_request/mail',
60		type: 'post',
61		data: $(form+' input, '+form+' textarea').serialize()+'&location='+encodeURIComponent(window.location.href),
62		dataType: 'json',
63		beforeSend: function() {
64			$('.callback_button').button('loading');
65		},
66		complete: function() {
67			$('.callback_button').button('reset');
68		},
69		success: function(json) {			
70			$(form+' .text-danger').remove();
71
72			if (json['error']) {
73				for (i in json['error']) {
74					form_error(form, i);
75				}
76				
77				uniFlyAlert('danger', json['error']);
78			}
79			
80			if (json['success']) {
81				if(uniJsVars.callback.metric_id && uniJsVars.callback.metric_target) {
82					if (typeof(ym) === "function") {
83						ym(uniJsVars.callback.metric_id, 'reachGoal', uniJsVars.callback.metric_target);
84					} else {
85						new Function('yaCounter'+uniJsVars.callback.metric_id+'.reachGoal(\''+uniJsVars.callback.metric_target+'\')')();
86					}
87				}
88			
89				if(uniJsVars.callback.analytic_category && uniJsVars.callback.analytic_action) {
90					if (typeof(gtag) === 'function') {
91						gtag('event', uniJsVars.callback.analytic_action, {'event_category': uniJsVars.callback.analytic_category});
92					} else if (typeof(ga) === 'function') {
93						ga('send', 'event', uniJsVars.callback.analytic_category, uniJsVars.callback.analytic_action);
94					}
95				}
96				
97				$('.modal-request').html($('<div class="callback_success">'+json['success']+'</div>').fadeIn());
98			}
99		}
100	});
101}

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.