PageSourceSearch

https://nashaplaneta.net/js/geo_v24_topspeed.js

js nashaplaneta.net collected 2026-10-02 07:37:21 UTC 17,886 bytes, 278 lines download raw bytes

1//new-tabs
2document.addEventListener('DOMContentLoaded', function() {
3    const tabButtons = document.querySelectorAll('.tab-button');
4    const tabPanels = document.querySelectorAll('.tab-panel');
5    
6    tabButtons.forEach(button => {
7        button.addEventListener('click', () => {
8            const targetPanelId = button.getAttribute('aria-controls');
9            
10            // Снимаем активное состояние со всех
11            tabButtons.forEach(btn => {
12                btn.classList.remove('active');
13                btn.setAttribute('aria-selected', 'false');
14            });
15            tabPanels.forEach(panel => {
16                panel.classList.remove('active');
17            });
18            
19            // Активируем текущую
20            button.classList.add('active');
21            button.setAttribute('aria-selected', 'true');
22            document.getElementById(targetPanelId).classList.add('active');
23        });
24    });
25});
26
27lat="";
28long="";
29//MAPS SCRIPTS
30function toggle_hotel(a){//вкл/выкл отели
31	if (a.checked) {
32		showMarkers(markers_hotel);
33		if (window.markers_room) showMarkers(markers_room);
34		}
35		else {
36			hideMarkers(markers_hotel);
37		if (window.markers_room) hideMarkers(markers_room);
38		}
39	
40	}
41function Create_control_mypos(a,b){a.style.padding="5px",strdiv='<div style="background-color:white;cursor:pointer;font-size:14px;padding: 4px 10px" onclick="gomypos()" title="Перейти к вашему положению на карте">&#x1F4CD; Где я на карте?</div>',a.innerHTML=strdiv}
42function my_attachEvent(marker,command){command='window.open("'+command+'");',google.maps.event.addListener(marker,"dblclick",function(){eval(command)})}
43function showMarkers(a){if(a)for(var i=0;i<a.length;i++)a[i].setMap(map)}
44function hideMarkers(a){if(a)for(var i=0;i<a.length;i++)a[i].setMap(null)}
45function switch_markers(a,b,c){div_obj=document.getElementById("legenda"+c),a.checked?(showMarkers(b),div_obj.style.display="block"):(hideMarkers(b),div_obj.style.display="none")}
46function show_infowindow(){
47	link_to="";
48	lat=this.position.lat();
49	lng=this.position.lng();
50	if (mobile==1) mobile_link = "<div><a href='yandexmaps://maps.yandex.ru/?pt=" + lng + "," + lat + "&z=15&l=map'>Отрыть точку в приложении Яндекс.Карты &#x1F4CD;</a></div>";
51	else mobile_link = '';
52	this.elink>""&&(link_to="<a href='"+this.elink+"' target='_blank'>Подробнее »</a><br>"),content="<div style='width:100%;max-width:500px'><h3>"+this.title+"</h3>"+link_to+"<br>Точные координаты: "+lat.toFixed(6)+","+lng.toFixed(6)+mobile_link + "</div>",marker_infowindow.setPosition(this.position),marker_infowindow.setContent(content),marker_infowindow.open(map),hotel_infowindow.close(),room_infowindow.close()}function goto(a,b,c,d){if("district"!=a&&"districts"!=a||(arr=window.districts),"station"!=a&&"stations"!=a||(arr=window.stations),"sight"!=a&&"sights"!=a||(arr=window.sights),"others"!=a&&"others"!=a||(arr=window.others),c){for(var e=0;e<arr.length;e++)if(arr[e][5]==c){b=e,document.getElementById("pos").innerHTML=arr[e][0],document.title=document.title+": "+arr[e][0]+" на карте";var f=new google.maps.LatLng(arr[e][1],arr[e][2]);map.setCenter(f)}}else{document.getElementById("pos").innerHTML=arr[b][0];var f=new google.maps.LatLng(arr[b][1],arr[b][2]);map.setCenter(f)}if(window.stations_markers)for(var e=0;e<window.stations_markers.length;e++)stations_markers[e].setAnimation(null);if(window.sights_markers)for(var e=0;e<window.sights_markers.length;e++)sights_markers[e].setAnimation(null);if(window.districts_markers)for(var e=0;e<window.districts_markers.length;e++)districts_markers[e].setAnimation(null);"district"!=a&&"districts"!=a||districts_markers[b].setAnimation(google.maps.Animation.BOUNCE),"station"!=a&&"stations"!=a||stations_markers[b].setAnimation(google.maps.Animation.BOUNCE),"others"!=a&&"others"!=a||others_markers[b].setAnimation(google.maps.Animation.BOUNCE),"sight"!=a&&"sights"!=a||sights_markers[b].setAnimation(google.maps.Animation.BOUNCE),1==d?map.setZoom(16):d>0&&map.setZoom(d-0)}
53function addHotel_mrk(){
54	hotel_infowindow=new google.maps.InfoWindow({
55		pixelOffset:new google.maps.Size(0,-18)
56	});
57	for(var a=0;a<hotel_data.length;a++) {
58		if(hotel_data[a]){
59			var b=hotel_data[a],c=new google.maps.LatLng(b[3],b[2]);if(b[4]<500)var d="/images/map/hotel.png";
60		else if(b[4]<2000)var d="/images/map/hotel1.png";
61		else if(b[4]<5000)var d="/images/map/hotel2.png";
62		else var d="/images/map/hotel3.png";
63		var e=new google.maps.Marker({
64			position:c,
65			icon:d,
66			title:"Отель "+b[0]+" / звезды: "+b[1]+" / цена от: "+b[9],
67			placenow:a
68		});
69	};
70	markers_hotel.push(e),my_attachEvent(e,b[5]),google.maps.event.addListener(e,"click",show_hotel_info)
71}
72}
73function addRoom_mrk(){
74	room_infowindow=new google.maps.InfoWindow({
75		pixelOffset:new google.maps.Size(0,-18)
76	});
77	for(var a=0;a<room_data.length;a++) {
78		if(room_data[a]){
79			var b=room_data[a];
80			c=new google.maps.LatLng(b[2],b[1]);
81
82			var e=new google.maps.Marker({
83				position:c,
84				icon:"/images/map/room.png",
85				title: b[0]+" / цена от: "+b[5],
86				placenow:a
87			});
88
89		};
90	markers_room.push(e);
91	my_attachEvent(e,b[3]);
92	google.maps.event.addListener(e,"click",show_room_info)
93	}
94}
95function show_room_info() {
96place=this.placenow;
97href=room_data[place][3];
98name=room_data[place][0];
99photo_url=room_data[place][4];
100price=room_data[place][5];
101
102photo='';
103if (photo_url) photo="<div><a href='"+href+"' target='_blank'><img src='"+photo_url+"' width='150' style='border:1px solid #ddd'></a></div>";
104content="<div class='maphotelinfo'><a href='"+href+"' target='_blank' onclick='opennew();'><h3>"+name+"</h3></a>"+photo+"<div class='text'><p title='Тип жилья' style='margin:0px'><b>Категория</b>: жилье в аренду</p><p style='margin:0px'><b>Цена от</b>
104: "+price+"</p><p style='margin:0px'>";
105content=content+"<p style='margin-top:4px'><a href='"+href+"' target='_blank' class='bttn'>Проверить цену/забронировать</a></p></div></div>";
106room_infowindow.setPosition(this.position);
107room_infowindow.setContent(content);
108room_infowindow.open(map);
109hotel_infowindow.close();
110marker_infowindow.close()
111}
112
113function gomypos(){
114//переходим на текущее положение при клике по карте
115	if (navigator.geolocation) {
116		navigator.geolocation.getCurrentPosition(function(position) {
117			lat=position.coords.latitude;
118			long=position.coords.longitude;
119			settolocation();
120          },
121		function() {
122			handleLocationError();
123		});
124        } else {
125			handleLocationError();
126		}
127	}
128
129function handleLocationError() {
130	alert('К сожалению, не удалось определить вашу позицию.\nВозможно ваше оборудование или браузер не поддерживают определение положения, или вы не дали соответствующее разрешение');
131}
132function settolocation(){
133	mylocation=new google.maps.LatLng(window.lat,window.long);lasta=window.lat,lastb=window.long,
134	new google.maps.Marker({position:mylocation,map:map,icon:"/images/map/myposition.png",title:"Вот вы где"})
135	map.setCenter(mylocation);
136}
137function createkml(){let f=new FormData();f.append('name',init[2]);f.append('stations',JSON.stringify(window.stations));f.append('sights',JSON.stringify(window.sights));f.append('districts',JSON.stringify(window.districts));f.append('others',JSON.stringify(window.others));fetch('/modules/generate-kml-from-map',{method:'POST',body:f}).then(r=>r.text()).then(d=>window.open(d)).catch(e=>console.error('Ошибка:',e));}
138function AddMarkers(a,b,c,z_index=999){marker_infowindow=new google.maps.InfoWindow({pixelOffset:new google.maps.Size(0,-18)}),1==c?(showlegend="none",checked=""):(showlegend="display",checked="checked");var d=[];anchors_var="";for(var e=0;e<a.length;e++)if(a[e]){var f=a[e],g=new google.maps.LatLng(f[1],f[2]);switch(anchors_var=anchors_var+'<span class="elem" onDblClick="goto(\''+b+"',"+e+",'',1)\" onClick=\"goto('"+b+"',"+e+')"> <strong>'+(e+1)+"</strong>."+f[0]+"</span>",b){case"stations":image="/images/map/marker_transport.png";break;case"districts":image="/images/map/marker_districts.png";break;case"sights":image="/images/map/marker_sights.png"}f[4]&&(image="/images/map/"+f[4]);var h=new google.maps.Marker({position:g,icon:image,title:f[0],zIndex:z_index,placenow:e,elink:f[3]});d.push(h),f[3]>""&&my_attachEvent(h,f[3]),google.maps.event.addListener(h,"click",show_infowindow)}
139obj=document.getElementById("map_anch");var i=document.createElement("input");if(i.type="checkbox",i.checked=checked,i.id="check"+b,i.onclick=function(){switch_markers(this,d,b)},obj.appendChild(i),"stations"==b)var j='<label for="checkstations" class="hdr"><img src="/images/map/marker_transport.png" style="width:17px;" alt="Транспорт/станции">Транспорт/станции</label>';if("sights"==b)var j='<label for="checksights" class="hdr"><img src="/images/map/marker_sights.png" style="width:17px;" alt="Достопримечательности">Достопримечательности</label>';if("districts"==b)var j='<label for="checkdistricts" class="hdr"><img src="/images/map/marker_districts.png" style="width:17px;" alt="Районы">Районы</label>';var k=document.createElement("div");k.innerHTML=j,obj.appendChild(k.firstChild);var i=document.createElement("br");obj.appendChild(i);var k=document.createElement("div");return k.id="legenda"+b,k.style.lineHeight="110%",k.style.display=showlegend,k.innerHTML=anchors_var,obj.appendChild(k),d
140}
141
142function AddOthers(a){var b=[];anchors_var="";for(var c=0;c<a.length;c++)if(a[c]){var d=a[c],e=new google.maps.LatLng(d[1],d[2]),f=new google.maps.MarkerImage("/images/map/"+d[4]),g=new google.maps.Marker({position:e,icon:f,title:d[0],zIndex:9999,placenow:c,elink:d[3]});b.push(g),d[3]>""&&my_attachEvent(g,d[3]),google.maps.event.addListener(g,"click",show_infowindow)}return b}
143
144//прочие функции
145function startin(a,b = "MOW",c,delay=3000){if (a !== null) stc=a.href;else stc = null;text='qq';void 0==c&&(c="BKK");sts=setTimeout(function(){showcalendar(b,c)},delay)}function stopout(){clearTimeout(sts)}function showcalendar(from,to){window.addEventListener("keydown",function(a){27==a.keyCode&&hidecalendar(!1)},!0),calendar=!0,s=document.createElement("script"),void 0==stc?s.src="//tpscr.com/content?currency=rub&campaign_id=100&promo_id=4041&achieve=%2345AD35&light=%23FFFFFF&dark=%23000000&color_background=%23ffffff&primary=%230C73FE&range=7%2C14&period=year&only_direct=false&one_way=false&powered_by=true&locale=ru&searchUrl=www.aviasales.ru%2Fsearch&shmarker=154802.pausecalendar&trs=27692&origin="+from+"&destination="+to:(o=stc.indexOf("origin_iata"),or=stc.substr(o+14,3).toUpperCase(),d=stc.indexOf("destination_iata"),de=stc.substr(d+19,3).toUpperCase(),s.src="//tpscr.com/content?currency=rub&campaign_id=100&promo_id=4041&achieve=%2345AD35&light=%23FFFFFF&dark=%23000000&color_background=%23ffffff&primary=%230C73FE&range=7%2C14&period=year&only_direct=false&one_way=false&powered_by=true&locale=ru&searchUrl=www.aviasales.ru%2Fsearch&shmarker=154802.supercalendar&trs=27692&origin="+or+"&destination="+de),s.type="text/javascript",s.async=!0,t=document.getElementById("qq"),t.appendChild(s),setTimeout(function(){document.querySelectorAll('#fullarea, #aviacalendar').forEach(function(el){el.style.display='block';el.animate([{opacity:0}
145,{opacity:1}],{duration:350,fill:'forwards'})})},500)}function hidecalendar(setcookie=false){calendar=false;const e=document.querySelectorAll('#fullarea, #aviacalendar');e.forEach(el=>{el.animate([{opacity:1},{opacity:0}],{duration:350,fill:'forwards'}).onfinish=()=>el.style.display='none'});document.getElementById('qq').innerHTML='';if(setcookie)document.cookie="closeshadow=1; max-age="+7*24*60*60+"; path=/"}
146
147
148function offsetPosition(e) {var offsetTop=0;do {offsetTop+=e.offsetTop;}while(e=e.offsetParent);return offsetTop}
149var aside=document.querySelector('#flowblock');var aside1=document.querySelector('#flowblock1');
150if (aside!=null) {OP=offsetPosition(aside)-12;t=document.documentElement.scrollHeight-270-aside.offsetHeight}
151if (aside1!=null) {OP1=offsetPosition(aside1);t1=document.documentElement.scrollHeight-270-aside1.offsetHeight}
152
153//reviews
154function clicked() {
155    document.getElementById("hint").textContent = 'Отлично! Теперь осталось нажать кнопку «Отправить» ниже, а еще вы можете добавить небольшой отзыв';
156    document.getElementById("submit_rate").disabled = false;
157}
158function check_submit() {
159    const rv = document.querySelector("[name='review']").value.trim();
160    const rt = document.querySelector("[name='rating']:checked");
161    if (rv.length < 2 && !rt) {
162        alert("Нужно поставить оценку (звездочками) или отзыв должен быть больше 2 символов");
163        return false;
164    }
165    return true;
166}
167
168
169// генератор формы ответа
170document.querySelectorAll('.replay-to').forEach(el => {
171    el.addEventListener('click', function() {
172        const fid = 'replay_form' + this.dataset.id;
173        const fel = document.getElementById(fid);
174        
175        if (fel.innerHTML === '') {
176            document.querySelector('.rep_cont').innerHTML = '';
177            fel.innerHTML = '<form class="rpl_form" method="post" onsubmit="submit_replay(this, event, ' + this.dataset.id + ');return false;"><div class="firstline"><input id="author" name="author" type="text" value="" maxlength="25" placeholder="Имя (не обязательно)"><input id="email" name="email" type="email" value="" maxlength="100" placeholder="Email (не обязательно)"></div><textarea id="review" name="review" rows="2" maxlength="65525" placeholder="Ответ на комментарий..." spellcheck="true" required="true" style="height:160px"></textarea><span style="display:block;font-size: 90%;margin-bottom:12px">Отправляя комментарий, вы соглашаетесь с <a href="/about#privacy" target="_blank" class="sl">Политикой конфиденциальности</a></span><input type="submit" id="submit_rate" class="submit" value="Отправить ответ"><input type="hidden" name="replay_to" value="' + this.dataset.id + '"></form>';
178        } else {
179            fel.innerHTML = '';
180        }
181    });
182});
183
184// лайки и дизлайки
185document.querySelectorAll('.likeclick').forEach(el => {
186    el.onclick = function() {
187        this.onclick = null;
188        fetch("/reviews/save_likes", {
189            method: "POST",
190            headers: {'Content-Type': 'application/x-www-form-urlencoded'},
191            body: new URLSearchParams({ 
192                likes: this.dataset.likes, 
193                id: this.dataset.id 
194            })
195        })
196        .then(r => r.text())
197        .then(r => {
198            if (r.trim() === 'OK') {
199                const cel = document.getElementById('lcount' + this.dataset.id);
200                cel.textContent = parseInt(cel.textContent) + parseInt(this.dataset.likes);
201            }
202        });
203    }
204});
205
206// фокус на отзыве
207const reviewElement = document.getElementById('review');
208if (reviewElement) {
209	reviewElement.addEventListener('focus', function() {
210	this.style.height = '200px';
211	}, { once: true });
212}
213
214
215// отправка формы
216const submit_rate = document.getElementById('submit_rate');
217if (submit_rate) {
218	submit_rate.addEventListener('click', function(e) {
219    	e.preventDefault();
220    
221	    if (!check_submit()) return false;
222    
223		fetch("/reviews/save_review", {
224			method: "POST",
225			body: new FormData(document.getElementById('review_form'))
226	    })
227	    .then(r => r.text())
228	    .then(r => {
229    	    document.getElementById('review_block').insertAdjacentHTML('afterbegin', r);
230        	this.disabled = true;
231	        document.getElementById('author').value = '';
232    	    document.getElementById('email').value = '';
233        	document.getElementById('review').value = '';
234	    });
235	return false;
236	});
237}
238
239
240
241function submit_replay(obj, ev, id) {
242    ev.preventDefault();
243    
244    const formData = new FormData(obj);
245    
246    fetch("/reviews/save_replay", {
247        method: "POST",
248        body: formData
249    })
250    .then(response => response.text())
251    .then(response => {
252        // отправлено успешно
253        document.getElementById("replay_form" + id).innerHTML = response;
254    })
255    .catch(error => console.error('Ошибка:', error));
256}
257
258//вставка спецсимволов в описание
259function insertSymbol(a) {
260	insertTextAtCursor(document.getElementById('review'),a);
261}
262
263function insertTextAtCursor(el, text, offset) {
264    var val = el.value, endIndex, range, doc = el.ownerDocument;
265    if (typeof el.selectionStart == "number"
266            && typeof el.selectionEnd == "number") {
267        endIndex = el.selectionEnd;
268        el.value = val.slice(0, endIndex) + text + val.slice(endIndex);
269        el.selectionStart = el.selectionEnd = endIndex + text.length+(offset?offset:0);
270    } else if (doc.selection != "undefined" && doc.selection.createRange) {
271        el.focus();
272        range = doc.selection.createRange();
273        range.collapse(false);
274        range.text = text;
275        range.select();
276    }
277	el.focus();
278}

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.