PageSourceSearch

https://shina-standart.ru/g/templates/shop2/2.41.2/js/forms.js

js shina-standart.ru collected 2026-10-09 21:37:08 UTC 2,697 bytes, 85 lines download raw bytes

1$(function() {
2	var s3From = {
3		init: function() {
4			this.initForms();
5		},
6		initForms: function(parent) {
7			var self = this;
8			if (!parent) parent = document;
9			if ($(parent)[0] == document || !$(parent).is('[data-api-url][data-api-type=form]')) {
10				parent = $(parent).find('[data-api-url][data-api-type=form]');
11			}
12	
13			$(parent).each(function() {
14				var obj = $(this);
15				var form = obj.is("form") ? obj : obj.find("form");
16				form.submit(function() {
17					$.post(obj.data('api-url'), form.serialize(), function(response) {
18						if (response.result.html) {
19							var uploaders_inits = '';
20							var scripts = response.result.html.match(/<script[^>]*>[^<]*newSWFU[^<]*<\/script>/gm);
21							if (scripts) {
22								for (var i = 0; i < scripts.length; i++) {
23									uploaders_inits += scripts[i].replace(/<script[^>]*>([^<]+)<\/script>/, "$1");
24								}
25							}
26							var replacement = $(response.result.html.replace(/[\r\n]/g, '').replace(/<script[^>]*>.*?<\/script>/g, ''));
27							if (!$(replacement).is('[data-api-url][data-api-type=form]')) {
28								replacement = $(replacement).find('[data-api-url][data-api-type=form]');
29							}
30							obj.replaceWith(replacement);
31	
32	
33							// Init form calendars
34							obj.find('.init-calendar').each(function(i){
35								new tcal({
36									'controlname':this.id,
37									'place':this.parentNode,
38									'lang':'ru'
39								});
40	
41							});
42	
43							// Init form calendar intervals
44							obj.find('.init-calendar-interval').each(function(i){
45								for(var j=0; j<2; ++j){
46									var e = f_getElement(this.id + '['+j+']');
47									new tcal({
48										'controlname':e.id,
49										'place':e.parentNode,
50										'lang':'ru',
51										'intervalpair':[
52											this.id + '[0]',
53											this.id + '[1]'
54										],
55										'intervalupdatecont' : this.id
56									});
57								}
58							});
59	
60							self.initForms(replacement);
61							if (uploaders_inits) {
62								eval(uploaders_inits);
63							}
64						}
65					});
66					return false;
67				});
68				if (form.find('.upload-button').size()) {
69					$('.tpl-anketa form').find('script:contains("newSWFU")').each(function() {
70						var scr = $(this).text();
71						var matches = scr.match(/newSWFU\((\s*\d+\s*),/);
72						if (matches.length == 2) {
73							var field = matches[1];
74							form.find('#fsUploadProgress' + field).attr('id', 'fsUploadProgress_' + field);
75							form.find('#spanButtonPlaceHolder' + field).attr('id', 'spanButtonPlaceHolder_' + field);
76							form.find('#hidUploadField' + field).attr('id', 'hidUploadField_' + field);
77							eval(scr.replace(/newSWFU\((\s*\d+\s*),/, 'newSWFU("_$1",'));
78						}
79					});
80				};
81			})
82		}
83	};
84	s3From.init();
85});

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.