PageSourceSearch

http://www.adrionik.ru/_inc/js/jquery.dev.js

js adrionik.ru collected 2026-10-02 20:56:49 UTC 4,449 bytes, 214 lines download raw bytes

1$(function(){
2
3
4	$('.cityhelp').val('').advansedSearch()
5	$('.get_city').advansedSearch({
6			setHref :false
7		})
8
9	$('.checkform').bind('submit',function(){
10
11	/*	if($('.area select',this).val() == 0) {
12			return false;
13		}
14		else {
15			return true;
16		}*/
17	})
18
19});
20
21function removeOptions(obj, name)
22{
23	while(obj.options.length > 0) {
24		obj.options[obj.options.length - 1] = null;
25	}
26	obj.options[obj.options.length] = new Option(name, 0);
27	obj.selectedIndex = 0;
28	obj.disabled = true;
29}
30
31function changeAreas( obj )
32{
33	var areaID = parseInt(obj.value, 10);
34	
35//	var el_regions = document.getElementById('region');
36	var el_regions = $('.region:first select',$(obj).parents('form'))[0];
37	removeOptions(el_regions, 'Все');
38
39
40	
41//	var el_cities = document.getElementById('city');
42	var el_cities = $('.city:first select',$(obj).parents('form'))[0];
43
44	if(el_cities){
45		removeOptions(el_cities, 'Все');	
46	}
47	
48	if(areaID > 0) {
49		var data = 'json=1&area=' + areaID;
50	
51		var url = $(obj).parents('form')[0].action;
52
53		$.getJSON(url, data, function(json_data){
54			if(typeof json_data != "undefined") {
55				if(json_data.length > 0) {
56//					console.log(json_data);
57					for(key in json_data) {
58						el_regions.options[el_regions.options.length] = new Option(json_data[key]["name"],json_data[key]["id"]);
59					}
60				}
61			}
62		});
63		el_regions.disabled = false;
64	}	
65}
66
67function changeRegions( obj )
68{
69	var regionID = parseInt(obj.value, 10);
70		
71//	var el_cities = document.getElementById('city');
72	var el_cities = $('.city:first select',$(obj).parents('form'))[0];
73	removeOptions(el_cities, 'Все');	
74
75	if(regionID > 0) {
76		var data = 'json=1&' + 'region=' + regionID;
77		$.getJSON('/guide/search/', data, function(json_data){
78			if(typeof json_data != "undefined") {
79				if(json_data.length > 0) {
80//					console.log(json_data);
81					for(key in json_data) {
82						el_cities.options[el_cities.options.length] = new Option(json_data[key]["ename"],json_data[key]["id"]);
83					}
84				}
85			}
86		});
87		el_cities.disabled = false;
88	}	
89}
90
91function checkForm()
92{
93	
94	var area = document.getElementById('area'); 	
95	if(area.value == 0) {
96		return false;
97	}
98	else {
99		return true;
100	}
101}
102
103
104$.fn.advansedSearch = function(options) {
105	  var settings = {
106			searchHtml :'<div id="advansed_search" style="display:none">\
107				<div class="rc_2 round rc rc_subsearch fleft">\
108					<ul class="vert searck_body c"></ul>\
109					<i class="t tl"></i><i class="t tr"></i><i class="b bl"></i><i class="b br"></i>\
110				</div>\
111			</div>',
112			dataParam :'json=1&cname',
113			dataUrl :'/guide/search/',
114			outClick : '#outwrap',
115			spezBlock : '.rc_form',
116			setHref :true
117		};
118	   settings = $.extend(settings, options);
119
120	var obj = this;	
121
122
123	var SearchBox = $(settings.searchHtml);	
124	var searchBox = SearchBox[0];	
125	
126	searchBox.vis = false;
127	
128	$('body').append(searchBox)
129	$(this).bind('keyup',keyUp);
130
131	if(settings.outClick){
132		$(settings.outClick).bind('click',hideBox)
133	}
134
135	function keyUp(){
136		var oB = this;
137		var name = this.value;
138		if(name.length >= 1) {
139			var data = settings.dataParam + '=' + name;
140			$.getJSON(settings.dataUrl, data, function(json_data){
141
142				if($(json_data).size() > 0){
143
144					searchBox.curO = oB;
145
146					showBox(json_data)
147
148					if(!settings.setHref){
149						setBox(oB)
150					}
151
152				
153				}else if(searchBox.vis){
154					hideBox()
155				}
156			});		
157		}else{
158			hideBox()
159		}
160	}
161
162	$(window).bind('resize',function(){
163			if(searchBox.vis){
164				setSearchSize(searchBox.curO)
165			}
166	})
167
168	function setBox(o){
169
170		$('a',SearchBox).bind('click',function(){
171			o.value = this.innerHTML;
172			hideBox()
173			return false;
174		})
175	}
176
177	function showBox(data){
178	
179		searchBox.vis = true;
180		var tmp = ''
181		
182		for (ii in data){
183			tmp += '<li><a href="' + data[ii].path + '" + title="">' + data[ii].name + '</a></li>';
184		}
185		$('.searck_body',SearchBox).empty().html(tmp)
186		
187		setSearchSize(searchBox.curO)
188		SearchBox.show();
189	}
190
191	function hideBox(){
192		searchBox.vis = false;
193		SearchBox.hide()
194		$('.rc_subsearch',SearchBox).addClass('fleft')
195	}
196
197	function setSearchSize(o){
198
199		var minWidth = $(o).width();
200
201		if(settings.spezBlock){
202		//	minWidth = $(settings.spezBlock).size() > 0 ? minWidth*.5 : minWidth
203			minWidth =  minWidth*.5
204		}
205
206		
207		SearchBox.width(SearchBox.width() > minWidth ? SearchBox.width() : minWidth);
208		SearchBox.css({
209			top : $(o).offset().top + $(o).height() + 'px',
210			left : $(o).offset().left + 'px'
211		})	
212		$('.rc_subsearch',SearchBox).removeClass('fleft')
213	}
214}

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.