PageSourceSearch

https://tekstovoi.ru/js/login.js

js tekstovoi.ru collected 2026-10-02 16:49:57 UTC 15,285 bytes, 319 lines download raw bytes

1//window.onload = function(){
2	var com_add = false;
3	function getXmlHttp(){
4	  var xmlhttp;
5	  try {
6		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
7	  } catch (e) {
8		try {
9		  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
10		} catch (E) {
11		  xmlhttp = false;
12		}
13	  }
14	  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
15		xmlhttp = new XMLHttpRequest();
16	  }
17	  return xmlhttp;
18	}
19	function login_form(){
20		document.getElementById('login-popup').style.display='block';
21		document.getElementById('front').style.display='block';
22		document.getElementById('captchaimg').src='/engine/modules/captcha.php';
23		return false;
24	}
25	var req = getXmlHttp();
26	var login = document.getElementById('a_login')
27	if(login)login.onclick=function(){login_form();return false;
28	}
29	var registration = document.getElementById('a_registration')
30	if(registration)registration.onclick=function(){login_form();return false;
31	}
32	var logout = document.getElementById('a_logout')
33	if(logout)logout.onclick=function(){
34		req.onreadystatechange = function() {
35			if (req.readyState == 4) {
36				if(req.status == 200) {
37					document.getElementById('login-popup').style.display='block';
38					document.getElementById('front').style.display='block';
39					setTimeout(function() { window.location = window.location; }, 2000);
40					
41				}
42			}
43		}
44		req.open('GET', '/engine/modules/logout_ajax.php', true);
45		req.send(null);
46		return false;
47	}
48	var div = document.getElementById('login-popup');
49	var el = div.getElementsByTagName('*');
50	var act = '';
51
52	for(var i=0; i<el.length; i++){
53		act = el[i].getAttribute('data-action');
54		if(act == 'auth:tekstovoi'){
55			el[i].onclick=function(){	
56				document.getElementById('login-by-social').style.display='none';
57				document.getElementById('login-by-email').style.display='block';
58				document.getElementById('login-form-forget-password').style.display='none';
59			}
60		}
61		if(act == 'auth:close-popup'){
62			el[i].onclick=function(){	
63				document.getElementById('login-popup').style.display='none';
64				document.getElementById('front').style.display='none';
65				com_add = false;
66				return false;
67			}
68		}
69		if(act == 'auth:restorepassword-form'){
70			el[i].onclick=function(){	
71				document.getElementById('login-by-social').style.display='none';
72				document.getElementById('login-by-email').style.display='none';
73				document.getElementById('login-form-forget-password').style.display='block';
74			}
75		}
76		if(act == 'auth:sociallogin'){
77			el[i].onclick=function(){	
78				document.getElementById('login-by-social').style.display='block';
79				document.getElementById('login-by-email').style.display='none';
80				document.getElementById('login-form-forget-password').style.display='none';
81			}
82		}
83		if(act == 'auth:regbyemail'){
84			el[i].onclick=function(){	
85				var co = 0;
86				var post = '';
87				/*var name = document.getElementById('login-regbyemail-firstname').value;
88				var regexp = /^[a-z]([0-9a-z_])+$/i
89				var err = document.getElementById('login-regbyemail-firstname-err');
90				if ( name.length > 16 || name.length < 3 ){
91					err.innerHTML = 'От 3 до 16 символов!';
92				}else if(!(regexp.test(name))){
93					err.innerHTML = 'Имя может включать латинские буквы, цифр, подчёркивание и начинается с буквы!';
94				}else{
95					err.innerHTML = '';
96					post += 'name='+encodeURIComponent(name);
97					co++;
98				}*/
99				
100				var name = document.getElementById('login-regbyemail-email').value;
101				var regexp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i
102				var err = document.getElementById('login-regbyemail-email-err');
103				if ( name.length > 80 || name.length < 4 ){
104					err.innerHTML = 'От 4 до 80 символов!';
105				}else if(!(regexp.test(name))){
106					err.innerHTML = 'Некорректный Email!';
107				}else{
108					err.innerHTML = '';
109					post += 'email='+encodeURIComponent(name);
110					co++;
111				}
112				
113				name = document.getElementById('login-regbyemail-password').value;
114				regexp = /^([0-9a-zA-Z])+$/
115				err = document.getElementById('login-regbyemail-password-err');
116				if ( name.length > 16 || name.length < 5 ){
117					err.innerHTML = 'От 5 до 16 символов!';
118				}else if(!(regexp.test(name))){
119					err.innerHTML = 'Пароль может состоять только из латинских букв и цифр!';
120				}else{
121					err.innerHTML = '';
122					post += '&pass='+encodeURIComponent(name);
123					co++;
124				}
125				
126				name = document.getElementById('login-regbyemail-captcha').value;
127				regexp = /^[0-9]{10}$/i
128				err = document.getElementById('login-regbyemail-captcha-err');
129				if(!(regexp.test(name))){
130					err.innerHTML = 'Ровно 10 цифр!';
131				}else{
132					err.innerHTML = '';
133					post += '&captcha='+encodeURIComponent(name);
134					co++;
135				}
136				if(co == 3){
137					document.getElementById('login-popup-warning-box').style.display = 'none';
138					document.getElementById('login-popup-warning-box').innerHTML = '';
139					req.onreadystatechange = function() {
140						if (req.readyState == 4) {
141							if(req.status == 200) {
142								var res = eval('(' + req.responseText + ')');
143								if(res.status == 'false'){
144									document.getElementById('login-popup-warning-box').style.display = 'block';
145									document.getElementById('login-popup-warning-box').innerHTML = res.text;
146								}else if(res.status == 'true'){
147									document.getElementById('login-staff-block').innerHTML = '<h2>Благодарим Вас за успешную регистрацию!</h2>';
148									if(com_add && document.getElementById("form_com"))document.getElementById("form_com").submit();
149									else setTimeout(function() { window.location = window.location; }, 2000);
150								}
151							}
152						}
153					}
154					req.open('POST', '/engine/modules/reg_ajax.php', true);
155					req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
156					req.send(post);
157				}
158			}
159		}
160		
161		if(act == 'auth:loginbyemail'){		
162			el[i].onclick=function(){	
163				var co = 0;
164				var post = '';
165				var name = document.getElementById('login-by-email-email').value;
166				var regexp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i
167				var err = document.getElementById('login-by-email-email-err');
168				if ( name.length > 80 || name.length < 4 ){
169					err.innerHTML = 'От 4 до 80 символов!';
170				}else if(!(regexp.test(name))){
171					err.innerHTML = 'Некорректный Email!';
172				}else{
173					err.innerHTML = '';
174					post += 'email='+encodeURIComponent(name);
175					co++;
176				}
177				
178				name = document.getElementById('login-by-email-password').value;
179				regexp = /^([0-9a-zA-Z])+$/
180				err = document.getElementById('login-by-email-password-err');
181				if ( name.length > 16 || name.length < 5 ){
182					err.innerHTML = 'От 5 до 16 символов!';
183				}else if(!(regexp.test(name))){
184					err.innerHTML = 'Пароль может состоять только из латинских букв и цифр!';
185				}else{
186					err.innerHTML = '';
187					post += '&pass='+encodeURIComponent(name);
188					co++;
189				}
190				if(co == 2){
191					document.getElementById('login-popup-warning-box').style.display = 'none';
192					document.getElementById('login-popup-warning-box').innerHTML = '';
193					req.onreadystatechange = function() {
194						if (req.readyState == 4) {
195							if(req.status == 200) {
196								var res = eval('(' + req.responseText + ')');
197								if(res.status == 'false'){
198									document.getElementById('login-popup-warning-box').style.display = 'block';
199									document.getElementById('login-popup-warning-box').innerHTML = res.text;
200								}else if(res.status == 'true'){
201									document.getElementById('login-staff-block').innerHTML = '<h2>Успешная авторизация!</h2>';
202									if(com_add && document.getElementById("form_com"))document.getElementById("form_com").submit();
203									else setTimeout(function() { window.location = window.location; }, 2000);
204								}
205							}
206						}
207					}
208					req.open('POST', '/engine/modules/login_ajax.php', true);
209					req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
210					req.send(post);
211				}
212			}
213		}
214		
215		if(act == 'auth:restorepassword'){		
216			el[i].onclick=function(){	
217				var co = 0;
218				var post = '';
219				var name = document.getElementById('login-forget-email').value;
220				var regexp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i
221				var err = document.getElementById('login-forget-email-err');
222				if ( name.length > 80 || name.length < 4 ){
223					err.innerHTML = 'От 4 до 80 символов!';
224				}else if(!(regexp.test(name))){
225					err.innerHTML = 'Некорректный Email!';
226				}else{
227					err.innerHTML = '';
228					post += 'email='+encodeURIComponent(name);
229					
230					document.getElementById('login-popup-warning-box').style.display = 'none';
231					document.getElementById('login-popup-warning-box').innerHTML = '';
232					req.onreadystatechange = function() {
233						if (req.readyState == 4) {
234							if(req.status == 200) {
235								var res = eval('(' + req.responseText + ')');
236								if(res.status == 'false'){
237									document.getElementById('login-popup-warning-box').style.display = 'block';
238									document.getElementById('login-popup-warning-box').innerHTML = res.text;
239								}else if(res.status == 'true'){
240									document.getElementById('login-staff-block').innerHTML = '<h2>На Ваш Email отправлено сообщение с новым паролем!</h2>';
241									setTimeout(function() { window.location = window.location; }, 2000);
242								}
243							}
244						}
245					}
246					req.open('POST', '/engine/modules/restore_ajax.php', true);
247					req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
248					req.send(post);
249				}
250			}
251		}
252		if(act == 'auth:vkontakte'){	
253			el[i].onclick=function(){
254
255			  function authInfo(response) {
256				  if (response.session) {
257					//console.log(response);
258					req.onreadystatechange = function() {
259						if (req.readyState == 4) {
260							if(req.status == 200) {
261								var res = eval('(' + req.responseText + ')');
262								if(res.status == 'false'){
263									document.getElementById('login-popup-warning-box').style.display = 'block';
264									document.getElementById('login-popup-warning-box').innerHTML = res.text;
265								}else if(res.status == 'true'){
266									document.getElementById('login-staff-block').innerHTML = '<h2>Успешная авторизация!</h2>';
267									if(com_add && document.getElementById("form_com"))document.getElementById("form_com").submit();
268									else setTimeout(function() { window.location = window.location; }, 2000);
269								}
270							}
271						}
272					}
273					req.open('GET', '/engine/modules/oauth_ajax.php?type=vk&name='+encodeURIComponent(response.session.user['first_name']+' '+response.session.user['last_name']), true);
274					req.send(null);
275				  } else {
276					alert('Отмена авторизации!');
277				  }
278				}				
279				VK.Auth.login(authInfo,65536+8192+2+4194304+524288+1024);
280			}
281		}
282		if(act == 'auth:odnoklassniki'){
283			el[i].onclick=function(){
284				var link = 'https://connect.ok.ru/oauth/authorize?client_id='+'1241242880'+'&scope='+'VALUABLE_ACCESS'+'&response_type='+'code'+'&redirect_uri='+encodeURIComponent('http://tekstovoi.ru/engine/modules/oauth_ajax.php?type=ok');
285				
286				var newWin = window.open(link,"","width="+screen.width/2+",height="+screen.height);
287			}
288		}
289		if(act == 'auth:facebook'){
290			el[i].onclick=function(){
291				FB.login(function(response) {
292					  if (response.status === 'connected') {
293							FB.api('/me', function(response) {	
294								req.onreadystatechange = function() {
295									if (req.readyState == 4) {
296										if(req.status == 200) {
297											var res = eval('(' + req.responseText + ')');
298											if(res.status == 'false'){
299												document.getElementById('login-popup-warning-box').style.display = 'block';
300												document.getElementById('login-popup-warning-box').innerHTML = res.text;
301											}else if(res.status == 'true'){
302												document.getElementById('login-staff-block').innerHTML = '<h2>Успешная авторизация!</h2>';
303												if(com_add && document.getElementById("form_com"))document.getElementById("form_com").submit();
304												else setTimeout(function() { window.location = window.location; }, 2000);
305											}
306										}
307									}
308								}
309								req.open('GET', '/engine/modules/oauth_ajax.php?type=fb&name='+encodeURIComponent(response['name'])+'&fbid='+response['id'], true);
310								req.send(null);
311							});
312					  }else {
313						alert('Отмена авторизации!');
314					  }
315				 }, {scope: 'public_profile,email'});
316			}
317		}
318	}
319//}

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.