1document.addEventListener('scroll', function () { 2 var header = document.querySelector('.header'); 3 var main = document.querySelector('main'); 4 var headerHeight = header.offsetHeight; 5 if (window.scrollY > 0) { 6 header.classList.add('scrolled'); 7 if (main) main.style.paddingTop = headerHeight + 'px'; 8 } else { 9 header.classList.remove('scrolled'); 10 if (main) main.style.paddingTop = 0; 11 } 12}); 13 14const burgerBtn = document.querySelector('.burger-btn'); 15const headerMenu = document.querySelector('header .menu'); 16 17burgerBtn.addEventListener('click', function () { 18 document.body.style.overflow = burgerBtn.classList.contains('active') ? null : 'hidden'; 19 20 burgerBtn.classList.toggle('active'); 21 headerMenu.classList.toggle('active'); 22}) 23 24const placeholder = document.querySelector('.menu__placeholder'); 25if(placeholder){ 26 placeholder.addEventListener('click', function(){ 27 burgerBtn.classList.remove('active'); 28 headerMenu.classList.remove('active'); 29 document.body.style.overflow = null; 30 }) 31} 32 33 34 35const closeBtn = document.querySelector('.modal .modal-close-btn'); 36const modal = document.querySelector('.modal'); 37 38closeBtn.addEventListener('click', function () { 39 modal.classList.remove('active'); 40 document.body.style.overflow = null; 41}) 42 43const requestLinks = document.querySelectorAll('.request__link'); 44 45if (requestLinks.length && modal) { 46 requestLinks.forEach(link => { 47 link.addEventListener('click', function (e) { 48 e.preventDefault(); 49 modal.classList.add('active'); 50 }); 51 }); 52} 53 54const footerRequestLink = document.querySelector('.footer .footer__link-request'); 55if (footerRequestLink) { 56 footerRequestLink.addEventListener('click', function (e) { 57 e.preventDefault(); 58 modal.classList.add('active'); 59 }); 60} 61 62const show_form_contact = document.querySelectorAll('.show-form-contact'); 63if(show_form_contact){ 64 show_form_contact.forEach(btn => { 65 btn.addEventListener('click', function(e){ 66 e.preventDefault(); 67 modal.classList.add('active'); 68 }) 69 70 }) 71} 72 73 74Fancybox.bind("[data-fancybox]", { 75 // Your custom options 76 }); 77 78// const video = document.querySelector('#main-video') 79// document.addEventListener('DOMContentLoaded', function(){ 80 81// if(video){ 82// video.play(); 83// } 84// }); 85 86// document.addEventListener('touchstart', () => { 87// if(video){ 88// video.play(); 89// } 90// }) 91 92 93document.addEventListener('DOMContentLoaded', () => { 94 // News modals 95 (function () { 96 97 const newsModal = document.querySelector('.news-modal'); 98 if (!newsModal) return; 99 100 const newsModalTitle = newsModal.querySelector('.news-modal__title'); 101 const newsModalImage = newsModal.querySelector('.news-modal__image'); 102 const newsModalDate = newsModal.querySelector('.news-modal__date'); 103 const newsModalContent = newsModal.querySelector('.news-modal__text-content'); 104 105 const background = newsModal.querySelector('.news-modal__background'); 106 const close = newsModal.querySelector('.news-modal__close'); 107
108 document.querySelectorAll('.post-view-link').forEach(link => { 109 link.onclick = () => { 110 newsModalTitle.textContent = link.dataset.title; 111 newsModalDate.textContent = link.dataset.date; 112 newsModalImage.src = link.dataset.img; 113 newsModalContent.innerHTML = link.querySelector('.news-data-content').innerHTML; 114 115 newsModal.style.display = null; 116 document.body.style.overflow = 'hidden'; 117 } 118 }); 119 120 close.onclick = background.onclick = () => { 121 newsModal.style.display = 'none'; 122 document.body.style.overflow = null; 123 location.hash = ''; 124 } 125 126 if (location.hash.indexOf('#post-view-') === 0) { 127 const link = document.querySelector('a[href="' + location.hash + '"]'); 128 link.click(); 129 } 130 })(); 131 132 (function () { 133 function toConicProjection(lon, lat) { 134 let lon0 = 97; // ЦенÑÑалÑнÑй меÑидиан 135 let lat0 = 60; // ÐпоÑÐ½Ð°Ñ ÑиÑоÑа 136 let phi1 = 40; // ÐеÑÐ²Ð°Ñ ÑÑандаÑÑÐ½Ð°Ñ Ð¿Ð°ÑÐ°Ð»Ð»ÐµÐ»Ñ 137 let phi2 = 70; // ÐÑоÑÐ°Ñ ÑÑандаÑÑÐ½Ð°Ñ Ð¿Ð°ÑÐ°Ð»Ð»ÐµÐ»Ñ 138 139 lon = lon * Math.PI / 180; 140 lat = lat * Math.PI / 180; 141 lon0 = lon0 * Math.PI / 180; 142 lat0 = lat0 * Math.PI / 180; 143 phi1 = phi1 * Math.PI / 180; 144 phi2 = phi2 * Math.PI / 180; 145 146 const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); 147 const C = Math.cos(phi1) ** 2 + 2 * n * Math.sin(phi1); 148 const rho0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; 149 150 const rho = Math.sqrt(C - 2 * n * Math.sin(lat)) / n; 151 const theta = n * (lon - lon0); 152 153 const x = rho * Math.sin(theta); 154 const y = rho0 - rho * Math.cos(theta); 155 156 return [x, y]; 157 } 158 159 function toPixelCoordinates(lon, lat, width, height) { 160 const [x, y] = toConicProjection(lon, lat); 161 162 const pixelX = (x + 0.68) / 2 * width; 163 const pixelY = (0.42 - y) / 2 * height; 164 165 return [pixelX, pixelY]; 166 } 167 168 const map = document.querySelector('.interactive-map'); 169 170 if (map) { 171 const cities = JSON.parse(document.querySelector('#cities-on-map').textContent); 172 const objects = JSON.parse(document.querySelector('#objects-on-map').textContent); 173 174 let currentCity; 175 let currentObject; 176 177 function showData (cityId, i) { 178 const img = objects[cityId][i].img; 179 const link = objects[cityId][i].link; 180 const linkElement = document.querySelector('#map-modal .map-modal__link'); 181 182 document.querySelector('#map-modal .map-modal__image').setAttribute('src', img ? img : '/wp-content/themes/iceformula/assets/images/about-us-achivements-bg.jpg'); 183 document.querySelector('#map-modal .map-modal__title').innerHTML = objects[cityId][i].name; 184 document.querySelector('#map-modal .map-modal__location').innerHTML = objects[cityId][i].city; 185 document.querySelector('#map-modal .map-modal__date').innerHTML = objects[cityId][i].date; 186 document.querySelector('#map-modal .map-modal__description').innerHTML = objects[cityId][i].type; 187 188 if (cities[cityId].count > 1) { 189 document.querySelectorAll('#map-modal .map-modal__arrow')[0].classList.add('map-modal__arrow_disabled'); 190 document.querySelectorAll('#map-modal .map-modal__arrow')[1].classList.remove('map-modal__arrow_disabled'); 191 192 document.querySelector('#map-modal .map-modal__counter').textContent = (i + 1) + ' / ' + cities[cityId].count; 193 document.querySelector('#map-modal .map-modal__controll').style.display = null; 194 } 195 else document.querySelector('#map-modal .map-modal__controll').style.display = 'none'; 196 197 if (link && link !== '#') { 198 linkElement.setAttribute('href', link); 199 linkElement.style.display = null; 200 } 201 else { 202 linkElement.style.display = 'none'; 203 } 204 } 205 206 document.querySelector('#map-modal .map-modal__close').onclick = () => { 207 document.querySelector('#map-modal').style.display = 'none'; 208 } 209
210 Object.keys(cities).forEach(cityId => { 211 const city = cities[cityId]; 212 let newMarker; 213 214 const cords = toPixelCoordinates(city.x, city.y, 1200 * 1.53, 624 * 2.95); 215 216 const x = cords[0]; 217 const y = cords[1]; 218 219 newMarker = document.createElementNS('http://www.w3.org/2000/svg', 'image'); 220 newMarker.setAttribute('href', '//' + location.host + '/wp-content/themes/iceformula/assets/images/map-marker.svg'); 221 newMarker.setAttribute('x', x); 222 newMarker.setAttribute('y', y); 223 newMarker.setAttribute('width', 36); 224 newMarker.setAttribute('height', 54); 225 newMarker.classList.add('map-marker'); 226 227 if (city.important) { 228 newMarker.setAttribute('href', '//' + location.host + '/wp-content/themes/iceformula/assets/images/map-marker-active.svg'); 229 newMarker.classList.add('map-marker__important'); 230 } 231 232 newMarker.setAttribute('title', city.name); 233 234 newMarker.setAttribute('data-city', cityId); 235 236 newMarker.onclick = () => { 237 currentCity = newMarker.dataset.city; 238 currentObject = 0; 239 240 showData(newMarker.dataset.city, 0); 241 document.querySelector('#map-modal').style.display = null; 242 } 243 244 newMarker.onmouseenter = () => { 245 if (!newMarker.classList.contains('map-marker__important')) { 246 newMarker.setAttribute('href', '//' + location.host + '/wp-content/themes/iceformula/assets/images/map-marker-active.svg'); 247 } 248 } 249 250 newMarker.onmouseleave = () => { 251 if (!newMarker.classList.contains('map-marker__important')) { 252 newMarker.setAttribute('href', '//' + location.host + '/wp-content/themes/iceformula/assets/images/map-marker.svg'); 253 } 254 } 255 256 map.querySelector('svg').appendChild(newMarker); 257 }); 258 259 let mapZoom = 1; 260 261 document.querySelectorAll('.map-mobile-controls__button').forEach(mapButton => { 262 if (mapButton.textContent === '+') { 263 mapButton.onclick = () => { 264 if (mapZoom < 2) { 265 mapZoom *= 2; 266 } 267 268 if (mapZoom === 2) mapButton.classList.add('map-mobile-controls__button_disabled'); 269 mapButton.parentNode.querySelectorAll('button')[1].classList.remove('map-mobile-controls__button_disabled'); 270 271 map.classList.remove('interactive-map__x2'); 272 map.classList.remove('interactive-map__x4'); 273 map.classList.add('interactive-map__x' + mapZoom); 274 } 275 } 276 else if (mapButton.textContent === '-') { 277 278 mapButton.onclick = () => { 279 if (mapZoom > 1) { 280 mapZoom /= 2; 281 } 282 283 if (mapZoom === 1) mapButton.classList.add('map-mobile-controls__button_disabled'); 284 mapButton.parentNode.querySelectorAll('button')[0].classList.remove('map-mobile-controls__button_disabled'); 285 286 map.classList.remove('interactive-map__x2'); 287 map.classList.remove('interactive-map__x4'); 288 map.classList.add('interactive-map__x' + mapZoom); 289 } 290 } 291 }); 292 293 document.querySelectorAll('.map-modal__arrow').forEach(objectButton => { 294 if (objectButton.dataset.direction === 'prev') { 295 objectButton.onclick = () => { 296 if (currentObject > 0) { 297 currentObject--; 298 showData(currentCity, currentObject); 299 300 objectButton.parentNode.querySelectorAll('img')[1].classList.remove('map-modal__arrow_disabled'); 301 if (currentObject === 0) objectButton.classList.add('map-modal__arrow_disabled'); 302 } 303 } 304 } 305 else if (objectButton.dataset.direction === 'next') { 306 objectButton.onclick = () => { 307 if (currentObject < cities[currentCity].count - 1) { 308 currentObject++; 309 showData(currentCity, currentObject); 310 311 objectButton.parentNode.querySelectorAll('img')[0].classList.remove('map-modal__arrow_disabled'); 312 if (currentObject === cities[currentCity].count - 1) objectButton.classList.add('map-modal__arrow_disabled'); 313 } 314 } 315 } 316 }); 317 318 if (window.innerWidth < 525) { 319 map.scrollTo({ 320 top: map.scrollHeight / 5 321 }); 322 } 323 else { 324 map.scrollTo({ 325 top: map.scrollHeight / 4.5 326 }); 327 } 328 // Moving map by cursor 329 let startX = 0, startY = 0, mapMove = false;
330 331 map.onmousedown = e => { 332 if ( 333 !map.classList.contains('interactive-map__x2') && 334 !map.classList.contains('interactive-map__x4') 335 ) return; 336 337 mapMove = true; 338 startX = e.offsetX; 339 startY = e.offsetY; 340 } 341 342 map.onmousemove = e => { 343 if ( 344 !map.classList.contains('interactive-map__x2') && 345 !map.classList.contains('interactive-map__x4') 346 ) return; 347 348 if (mapMove) { 349 map.scrollTo({ 350 left: map.scrollLeft + (startX - e.offsetX) * mapZoom, 351 top: map.scrollTop + (startY - e.offsetY) * mapZoom, 352 behavior: 'instant' 353 }); 354 } 355 } 356 357 map.onmouseup = map.onmouseleave = () => { 358 mapMove = false; 359 } 360 } 361 })(); 362}); 363
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.