PageSourceSearch

https://www.li.ru/utf/main_new.js?v=5

js li.ru collected 2026-10-03 23:09:10 UTC 5,387 bytes, 174 lines download raw bytes

1function win2unicode (str){
2    if (str == null){ return null;}
3    var result = "";
4    var o_code = "";
5    var i_code = "";
6    for (var I=0; I < str.length; I++){
7        i_code = str.charCodeAt(I);
8
9        if (i_code == 184){
10            o_code = 1105;
11        } else if (i_code == 168){
12            o_code = 1025;
13        } else if (i_code > 191 && i_code < 256){
14            o_code = i_code + 848;
15        } else {
16            o_code = i_code;
17        }
18        result = result + String.fromCharCode(o_code);
19    }
20
21    return result;
22}
23
24var Home = {
25    uId : LiCi.getCookie("bbuserid"),
26    uName : win2unicode( LiCi.getCookie("bbusername")),
27    uDomain : LiCi.getCookie("jurl")
28}
29
30Home.userbar = function () {
31	if (Home.uName) {
32		var tpl = '<a href="'+this.uDomain+'profile" class="username">'+this.uName+'</a> '+
33			'<span class="userlinks">'+
34				'<a href="'+this.uDomain+'friends">Мои друзья</a> |'+
35				'<a href="'+this.uDomain+'">Мой дневник</a> |'+
36				'<a href="/journal_post.php?journalid='+this.uId+'">Написать</a> |'+
37				'<a href="/journals.php?s=&action1=login" class="exit">Выйти</a>'+
38				'</span>';
39	} else {
40		var tpl = '<a href="/journal_register.php">Создать дневник</a> | '+
41			'<a href="/top">Рейтинг дневников</a>';
42	}
43	LiCi.$('_li-panel').innerHTML = tpl;
44}
45
46
47Home.services = {
48	clName : 'li-serv_popup'
49}
50
51Home.services.init = function() {
52	['stat', 'blog', 'mail'].forEach(function(id) {
53		LiCi.eventAdd (LiCi.$('_li-serv_'+id), "click", function () {		
54			Home.services.open(this, id);
55			this.href = 'javascript:void(0)';
56		});
57	});
58}
59Home.services.open = function(e, id) {
60	Home.services.close();
61	var wrapper = LiCi.$('_li-serv_'+id+'_pop');
62	wrapper.style.display = 'block';
63	wrapper.style.left = LiCi.offset.left(e)+'px';
64	// First field focus
65		var fields = LiCi.$(id+'_login_form');
66		var elements = fields.elements;
67		elements[0].focus();
68}
69
70Home.services.init_dom = function() {
71	Home.services.popup(
72		'stat',
73		'Вход в статистику',
74		'stat_login_form', '/stat/',
75		'http://www.liveinternet.ru/stat/?what=reminder',
76		[['input','text','url','Адрес сайта'],['input','password','password','Пароль']]
77	);
78	Home.services.popup(
79		'blog',
80		'Вход в дневники',
81		'diary_login_form', 'http://www.liveinternet.ru/member.php',
82		'http://www.liveinternet.ru/member.php?action=lostpw',
83		[['input','text','username','Имя'],['input','password','password','Пароль'],['input','hidden','action','login'],['input','hidden','charset','utf']]
84	);
85	Home.services.popup(
86		'mail',
87		'Вход в почту',
88		'mail_login_form', 'http://g.liveinternet.ru/auth/setcookie.php',
89		'http://g.liveinternet.ru/recover.php',
90		[['input','text','login','Логин'],[[['liveinternet.ru','@liveinternet.ru'],['li.ru','@li.ru']],'select','domain','Домен'],['input','password','pass','Пароль']]
91	);		
92}
93Home.services.popup = function( id, pName, fName, fAction, forgetUrl, fields ) {
94	
95	//this.close();
96	LiCi.eventAdd (LiCi.$('_li-serv_'+id), "click", function () {		
97		Home.services.open( this, id, fName );
98		this.href = 'javascript:void(0)';
99	});
100	
101	var wrapper = document.createElement('div');
102	wrapper.className = this.clName;
103	wrapper.id = '_li-serv_'+id+'_pop';
104	wrapper.style.display = 'none';
105	document.body.appendChild( wrapper );
106	
107	var tplFields = '';
108	for (i = 0; i<fields.length; i++) {
109		if (fields[i][1]=='text' || fields[i][1]=='password') {
110			tplFields += '<p>'+
111				'<b>'+fields[i][3]+'</b>'+
112				'<input type="'+fields[i][1]+'" name="'+id+'_'+fields[i][2]+'" />'+
113			'</p>';
114		} else if (fields[i][1]=='select') {
115			var tplSelect = '';
116			for (j = 0; j<fields[i][0].length; j++) {
117				tplSelect += '<option value="'+fields[i][0][j][0]+'">'+fields[i][0][j][1]+'</option>';
118			}
119			tplFields += '<p>'+
120				'<b>'+fields[i][3]+'</b>'+
121				'<select name='+fields[i][2]+'>'+
122					tplSelect+
123				'</select>'+
124			'</p>';
125		} else {
126			tplFields += '<input type="'+fields[i][1]+'" name="'+fields[i][2]+'" value="'+fields[i][3]+'" />';	
127		}
128	}	
129	
130	var tplBody = '<strong>'+pName+'</strong><em title="Закрыть" onclick="Home.services.close()">x</em>'+
131		'<form method="post" name="'+fName+'" id="'+fName+'" action="'+fAction+'">'+
132			tplFields+
133			'<span>'+
134				'<a href="'+forgetUrl+'">Напомнить пароль</a>'+
135				'<input type="submit" value="Войти">'+
136			'</span>'+
137		'</form>';
138	wrapper.innerHTML = tplBody;
139}
140Home.services.close = function() {
141	var popup = LiCi.$_(this.clName);
142	if (popup) {
143		for (i = 0; i<popup.length; i++) {
144			popup[i].style.display = 'none';
145		}
146	}
147}
148Home.services.open_dom = function( e, id, name ) {
149	Home.services.close();
150	var wrapper = LiCi.$('_li-serv_'+id+'_pop');
151	wrapper.style.display = 'block';
152	wrapper.style.left = LiCi.offset.left(e)+'px';
153	// First field focus
154		var fields = LiCi.$(name);
155		var elements = fields.elements;
156		elements[0].focus();
157	// Restore original fields names
158		LiCi.eventAdd (fields, "submit", function () {
159			for (i = 0; i<elements.length; i++) {
160				var name = LiCi.Strings.rpls( id+'_', '', elements[i].name );
161				elements[i].name = name;
162			}
163		});
164}
165
166LiCi.domReady (function(){
167	
168	Home.services.init();	
169	Home.userbar();
170	if ($('#searcharea') && $('#searcharea').length > 0) {
171		document.getElementById('searcharea').focus();
172	}
173	
174});

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.