PageSourceSearch

https://geary.ru/catalog/view/theme/unishop2/js/quick-order.js?v=20260915-3

js geary.ru collected 2026-09-28 08:44:11 UTC 4,148 bytes, 118 lines download raw bytes

1function quick_order(id, flag) {
2	uniAddCss('catalog/view/theme/unishop2/stylesheet/quick_order.css');
3	uniAddJs('catalog/view/theme/unishop2/js/jquery.maskedinput.min.js');
4	
5	$.ajax({
6		url:'index.php?route=extension/module/uni_quick_order',
7		type:'post',
8		data:{'id':id, 'flag': (typeof(flag) != 'undefined' ? 1 : 0)},
9		dataType:'html',
10		success:function(data) {
11			$('html body').append(data);
12			$('#modal-quick-order').addClass(uniJsVars.popup_effect_in).modal('show');
13		}
14	});
15}
16
17function uniQuickOrderAdd() {
18	var form = '#modal-quick-order';
19    var formElement = document.querySelector(form);
20    if (!formElement || formElement.dataset.trackingPending === '1') return;
21    formElement.dataset.trackingPending = '1';
22    return Promise.resolve().then(function () {
23        return window.dpTracking && typeof window.dpTracking.getSnapshotAsync === 'function' ? window.dpTracking.getSnapshotAsync(2000) : null;
24    }).catch(function () {}).then(function () {
25    if (!formElement.isConnected) { delete formElement.dataset.trackingPending; return; }
26	var serialized = $(form+' input, '+form+' textarea, '+form+' select').serialize();
27	let data = serialized;
28    try { if (window.dpTracking) data = window.dpTracking.withSerializedForm(serialized); } catch (_) {}
29	
30	$.ajax({
31		url: 'index.php?route=extension/module/uni_quick_order/add',
32		type: 'post',
33		data: data,
34		dataType: 'json',
35		beforeSend: function() {
36			$(form+' .add_to_cart').button('loading');
37		},
38		complete: function() {
39            delete formElement.dataset.trackingPending;
40			$(form+' .add_to_cart').button('reset');
41		},
42		success: function(json) {
43			$('.text-danger').remove();
44				
45			$('.form-group').removeClass('has-error');
46			
47			if (json['error']) {
48				if (json['error']['option']) {
49					for (i in json['error']['option']) {							
50						
51						var element = $('#quick_order #input-option' + i.replace('_', '-'));
52						
53						if (element.parent().hasClass('input-group')) {
54							element.parent().after('<div class="text-danger">'+json['error']['option'][i]+'</div>');
55						} else {
56							element.after('<div class="text-danger">'+json['error']['option'][i]+'</div>');
57						}
58						
59						json['error'][i] = json['error']['option'][i];
60					}
61					
62					delete json['error']['option'];
63				}
64				
65				for (i in json['error']) {
66					form_error(form, i, json['error'][i]);
67				}
68				
69				uniFlyAlert('danger', json['error']);
70			}
71		
72			if (json['success']) {			
73				dataLayer.push({
74					'ecommerce':{
75						'currencyCode': uniJsVars.currency.code,
76						'purchase':{
77							'actionField':{
78								'id': json['success']['order_id'],
79								'goal_id': uniJsVars.quick_order.metric_taget_id
80							},
81							'products': json['success']['products']
82						}
83					}
84				});
85				
86				if (typeof(gtag) === 'function') {
87					gtag('event', 'purchase', {'transaction_id': json['success']['order_id'], 'currency': uniJsVars.currency.code,	'items': json['success']['products']});
88				}
89				
90				if(uniJsVars.quick_order.metric_id && uniJsVars.quick_order.metric_target) {
91					if (typeof(ym) === 'function') {
92						ym(uniJsVars.quick_order.metric_id, 'reachGoal', uniJsVars.quick_order.metric_target);
93					} else {
94						new Function('yaCounter'+uniJsVars.quick_order.metric_id+'.reachGoal(\''+uniJsVars.quick_order.metric_target+'\')')();
95					}
96				}
97				
98				if(uniJsVars.quick_order.analytic_category && uniJsVars.quick_order.analytic_action) {
99					if (typeof(gtag) === 'function') {
100						gtag('event', uniJsVars.quick_order.analytic_action, {'event_category': uniJsVars.quick_order.analytic_category});
101					} else if (typeof(ga) === 'function') {
102						ga('send', 'event', uniJsVars.quick_order.analytic_category, uniJsVars.quick_order.analytic_action);
103					}
104				}
105				
106				$('#quick_order').html('<div class="row"><div class="col-xs-12">'+json['success']['text']+'</div></div>');
107				
108				setTimeout(() => {			
109					$('#modal-quick-order').modal('hide');
110				}, 5000);
111			}
112		},
113		error: function(xhr, ajaxOptions, thrownError) {
114            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
115        }
116	});
117    });
118}

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.