PageSourceSearch

https://olimpiada.ru/Admin/js/user_functions.js

js olimpiada.ru collected 2026-10-01 10:27:46 UTC 5,705 bytes, 181 lines download raw bytes

1function sendForm(id)
2{
3	var form_id="#"+id;
4	console.log(form_id);
5	$(form_id).ajaxSubmit({ 
6		target: null,
7		data: {'form':id},
8		beforeSubmit: showRequestA,
9		success: showResponseA,
10		url: "/Admin/modules/form_saver.php",
11		timeout: 10000
12     });
13	return false;
14}
15
16function sendInterview(id,num_answer,template)
17{
18	$.post("/Admin/modules/interview_saver.php", {id:id, num: num_answer,template:template}, function (data){
19	$('#interview'+id).html(data);
20	});
21}
22
23jQuery.extend({
24    handleError: function( s, xhr, status, e ) {
25        // If a local callback was specified, fire it
26        showResponseA(xhr.responseText, status);
27        /*if ( s.error )
28            s.error( xhr, status, e );
29        // If we have some XML response text (e.g. from an AJAX call) then log it in the console
30        console.log('ok');
31        else if(xhr.responseText)
32		{
33			var data=xhr.responseText;
34			//alert(data);
35			$('#transparent').hide();
36			tmp=data.split(';');
37			if (tmp[0]=='f')
38			{
39				
40				
41				if (tmp[2]==1)
42				{
43					var qString = $('#form'+tmp[1]).formSerialize();
44					$.post("/Admin/modules/form_result.php", qString, function (data){$('#form'+tmp[1]).html(data);});
45				}
46				else
47					{
48						//alert('.field_name .'+data);
49						if(tmp[2]!='captcha')
50						{
51						var field_name=$('.field_name').filter('.'+tmp[2]).html();
52						field_name=field_name.replace('<span>*</span>','');
53						alert('Вы не заполнили "'+field_name+'"');
54						}
55						else
56						alert('Вы не заполнили "код с картинки"');
57					}
58			}
59			else
60			{
61				if (tmp[0]=='c')
62				{
63					//alert(tmp[1]);
64					eval(tmp[1]+'('+tmp[2]+')');
65				}
66				else
67				{
68					$('#div_user_foto').html(xhr.responseText);
69				}
70			}
71		}*/
72    }
73});
74function showRequestA(formData, jqForm, options) { 
75      var queryString = $.param(formData); 
76      console.log('Вот что мы передаем: \n\n' + queryString); 
77	  $('body').append('<div id="transparent" style="background: rgba(0,0,0,0.5);display: block;height: 100%;left: 0;position: fixed;top: 0; bottom:0; width: 100%;z-index: 5; color:#fff; text-align:center;"><img style="margin:0 auto; display:block; margin-top:100px;" src="/Admin/images/loader.gif"><span>Отправка файлов на сервер...</span></div>');
78      return true; 
79  } 
80 
81function showResponseA(responseText, statusText)  { 
82	//alert(responseText);
83	var data=$.parseJSON(responseText);
84	console.log('responseText');
85	console.log(responseText);
86	$('#transparent').remove();
87	//tmp=data.split(';');
88	if (data.type=='form')
89	{
90		if (data.error.length==0)
91		{
92			//var qString = $('#form'+tmp[1]).formSerialize();
93			var fid=data.form;
94			console.log('ok');
95			$.post("/Admin/modules/form_result.php", {id:data.item_id,form:data.id}, function (data){$('#'+fid).html(data);});
96		}
97		else
98			{
99				//alert('.field_name .'+data);
100				$('#'+data.form+' input, #'+data.form+' select, #'+data.form+' textarea').removeClass('blank-data');
101				for(var i=0;i<data.error.length;i++)
102				{
103					$('#'+data.form+' [name='+data.error[i]+']').addClass('blank-data');
104				}
105				alert('Заполнены не все обязательные поля!');
106			}
107	}
108	else
109	{
110		if (tmp[0]=='c')
111		{
112			eval(tmp[1]+'('+tmp[2]+')');
113		}
114		else
115		$('#div_user_foto').html(xhr.responseText);
116	}
117	return true;
118  }
119  
120jQuery.fn.extend({
121    insertAtCaret: function(myValue){
122        return this.each(function(i) {
123            if (document.selection) {
124                // Для браузеров типа Internet Explorer
125                this.focus();
126                var sel = document.selection.createRange();
127                sel.text = myValue;
128                this.focus();
129            }
130            else if (this.selectionStart || this.selectionStart == '0') {
131                // Для браузеров типа Firefox и других Webkit-ов
132                var startPos = this.selectionStart;
133                var endPos = this.selectionEnd;
134                var scrollTop = this.scrollTop;
135                this.value = this.value.substring(0, startPos)+myValue+this.value.substring(endPos,this.value.length);
136                this.focus();
137                this.selectionStart = startPos + myValue.length;
138                this.selectionEnd = startPos + myValue.length;
139                this.scrollTop = scrollTop;
140            } else {
141                this.value += myValue;
142                this.focus();
143            }
144        })
145    }
146});
147
148function insertHtmlAtCursor(html) {
149    var sel, range;
150	console.log(window.getSelection);
151    if (window.getSelection) {
152        // IE9 and non-IE
153        sel = window.getSelection();
154        if (sel.getRangeAt && sel.rangeCount) {
155            range = sel.getRangeAt(0);
156            range.deleteContents();
157
158            // Range.createContextualFragment() would be useful here but is
159            // non-standard and not supported in all browsers (IE9, for one)
160            var el = document.createElement("div");
161            el.innerHTML = html;
162            var frag = document.createDocumentFragment(), node, lastNode;
163            while ( (node = el.firstChild) ) {
164                lastNode = frag.appendChild(node);
165            }
166            range.insertNode(frag);
167
168            // Preserve the selection
169            if (lastNode) {
170                range = range.cloneRange();
171                range.setStartAfter(lastNode);
172                range.collapse(true);
173                sel.removeAllRanges();
174                sel.addRange(range);
175            }
176        }
177    } else if (document.selection && document.selection.type != "Control") {
178        // IE < 9
179        document.selection.createRange().pasteHTML(html);
180    }
181}

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.