1;(function(){ 2 var $win = $(window), 3 $doc = $(document), 4 $html = $(document.documentElement), 5 $body = $(document.body); 6 7 window.lp_template = {}; 8 9 lp_template.hasSlick = false; 10 11 lp_template.mapList = []; 12 13 lp_template.initMaps = function(list) { 14 15 var yMapsList = list.filter(function(item) { 16 return item.type === 'yandex'; 17 }); 18 19 var gMapsList = list.filter(function(item) { 20 return item.type === 'google'; 21 }); 22 23 if (yMapsList.length) { 24 try { 25 yMapsList.forEach(fnMaps); 26 } catch(e) { 27 $.getScript('https://api-maps.yandex.ru/2.1/?lang=ru_RU', function() { 28 yMapsList.forEach(fnMaps); 29 }); 30 } 31 } 32 33 if (gMapsList.length) { 34 if (typeof google == undefined) { 35 $.getScript('https://maps.googleapis.com/maps/api/js?v=3', function() { 36 gMapsList.forEach(fnMaps); 37 }); 38 } else { 39 gMapsList.forEach(fnMaps); 40 } 41 } 42 43 function fnMaps(options) { 44 45 if (typeof options.center == 'string') { 46 options.center = options.center.split(','); 47 } 48 49 $.each(options.data, function(key, item) { 50 if (typeof item.coords == 'string') { 51 item.coords = item.coords.split(','); 52 } 53 }); 54 55 console.log(options.data); 56 57 if (options.type == 'google') { 58 initGoogle(options); 59 } else { 60 initYandex(options); 61 } 62 } 63 64 function initYandex (options) { 65 ymaps.ready(function() { 66 67 var map = new ymaps.Map(options.id, { 68 center: options.center, 69 zoom: options.zoom, 70 behaviors: ['drag', 'rightMouseButtonMagnifier'], 71 }); 72 73 map.controls.add( 74 new ymaps.control.ZoomControl() 75 ); 76 77 var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass( 78 '<div class="baloon-content">' + 79 '<h3>$[properties.name]</h3>' + 80 '$[properties.desc]' + 81 '</div>' 82 ); 83 84 var myCollection = new ymaps.GeoObjectCollection(); 85 86 $.each(options.data, function(key, item) { 87 myCollection.add(new ymaps.Placemark( 88 item.coords, 89 item, 90 {balloonContentLayout: MyBalloonContentLayoutClass} 91 )); 92 }); 93 94 map.geoObjects.add(myCollection); 95 }); 96 } 97 98 function initGoogle (options) { 99 var map = new google.maps.Map(document.getElementById(options.id), { 100 zoom: parseInt(options.zoom), 101 center: new google.maps.LatLng(options.center[0], options.center[1]), 102 scrollwheel: false 103 }); 104 105 $.each(options.data, function(key, item) { 106 107 var marker = new google.maps.Marker({ 108 position: new google.maps.LatLng(item.coords[0], item.coords[1]), 109 map: map, 110 title: item.name 111 }); 112 113 var infowindow = new google.maps.InfoWindow({ 114 content: '<div class="baloon-content">' + 115 '<h3>' + item.name + '</h3>' + 116 item.desc + 117 '</div>' 118 }); 119 120 google.maps.event.addListener(marker, 'click', function() { 121 infowindow.open(map, marker); 122 }); 123 124 }); 125 } 126 } 127 128 lp_template.addMapToList = function(obj) { 129 return lp_template.mapList.push(obj); 130 } 131 132 lp_template.tabs = { 133 tabs1: function($self) { 134 var $tabs = $self.find('.js-tabs'); 135 136 if ($tabs.length) { 137 $tabs.responsiveTabs({ 138 startCollapsed: 'accordion', 139 setHash: false, 140 animation: 'slide' 141 }); 142 } 143 } 144 } 145 146 147 148 lp_template.slickSliders = { 149 slider1: function($self) { 150 var $slider = $self.find('.js-slider-1'); 151 if ($slider.length) { 152 153 $slider.each(function() { 154 var $this = $(this), 155 autoplay = $this.data('autoplay') || false, 156 $thisParent = $this.closest('[data-block-layout]'), 157 $thisPrev = $thisParent.find('.slider_prev'), 158 $thisNext = $thisParent.find('.slider_next'), 159 $thisDots = $thisParent.find('.slider_dotts'); 160 161 $this.slick({ 162 infinite: true, 163 adaptiveHeight: true, 164 dots: true, 165 arrows: true, 166 speed: 800, 167 appendDots: $thisDots, 168 prevArrow: $thisPrev, 169 nextArrow: $thisNext, 170 autoplay: autoplay, 171 slidesToShow: 1 172 }); 173 }); 174 } 175 }, 176 reviews: function($self) { 177 var $slider = $self.find('.js-slick-reviews'); 178 if ($slider.length) { 179 $slider.each(function() { 180 var $this = $(this), 181 $thisParent = $this.closest('[data-block-layout]'), 182 $thisPrev = $thisParent.find('.sliderRevPrev'), 183 $thisNext = $thisParent.find('.sliderRevNext'), 184 $thisDots = $thisParent.find('.slide_comm_dots'); 185 186 $this.slick({ 187 infinite: true, 188 adaptiveHeight: true, 189 dots: true, 190 arrows: true,
191 speed: 800, 192 appendDots: $thisDots, 193 prevArrow: $thisPrev, 194 nextArrow: $thisNext, 195 autoplay: false, 196 fade: false, 197 autoplay: true, 198 slidesToShow: 2, 199 responsive: [ 200 { 201 breakpoint: 769, 202 settings: { 203 slidesToShow: 1, 204 } 205 } 206 ] 207 }); 208 }); 209 } 210 }, 211 productsSlider1: function($self) { 212 var $slider = $self.find('.js-slider-2'); 213 214 console.log($slider.length); 215 216 if ($slider.length) { 217 $slider.each(function() { 218 var $this = $(this), 219 $thisParent = $this.closest('[data-block-layout]'), 220 $thisPrev = $thisParent.find('.salebox_slider_prev'), 221 $thisNext = $thisParent.find('.salebox_slider_next'), 222 $thisDots = $thisParent.find('.salebox_slider_dotts'); 223 224 $this.slick({ 225 infinite: true, 226 adaptiveHeight: true, 227 dots: true, 228 arrows: true, 229 speed: 800, 230 appendDots: $thisDots, 231 prevArrow: $thisPrev, 232 nextArrow: $thisNext, 233 autoplay: true, 234 slidesToShow: $thisParent.width() >=699 ? 2 : 3, 235 responsive: [ 236 { 237 breakpoint: 769, 238 settings: { 239 slidesToShow: 2, 240 } 241 }, 242 { 243 breakpoint: 541, 244 settings: { 245 slidesToShow: 1, 246 } 247 } 248 ] 249 }); 250 }); 251 } 252 } 253 } 254 255 lp_template.timers = { 256 timer: function($self) { 257 var seoTimerBlocks = $self.find('.js-timer'), 258 $htmlLang = $html.attr('lang'), 259 timerDays, timerHours, timerMinutes, timerSeconds; 260 261 if ($htmlLang=='de' || $htmlLang=='en') { 262 timerDays = 'd'; 263 timerHours = 'h'; 264 timerMinutes = 'm'; 265 timerSeconds = 's'; 266 } else { 267 timerDays = 'д'; 268 timerHours = 'Ñ'; 269 timerMinutes = 'м'; 270 timerSeconds = 'Ñ' 271 } 272 273 if (seoTimerBlocks.length) { 274 seoTimerBlocks.lpTimer({ 275 format_out : '<span class="time_dy_wr"><ins class="time_dy_in"><span class="time_dy_dig">%d</span></ins><div class="time_dy_tit">' + timerDays + '</div></span><span class="time_dy_wr time_hr"><ins class="time_dy_in time_hr_in"><span class="time_dy_dig time_hr_dig">%h</span></ins><div class="time_dy_tit time_hr_tit">' + timerHours + '</div></span><span class="colon">:</span><span class="time_dy_wr time_min"><ins class="time_dy_in time_min_in"><span class="time_dy_dig time_min_dig">%m</span></ins><div class="time_dy_tit time_min_tit">' + timerMinutes + '</div></span><span class="colon">:</span><span class="time_dy_wr time_sec"><ins class="time_dy_in time_sec_in"><span class="time_dy_dig time_sec_dig">%s</span></ins><div class="time_dy_tit time_sec_tit">' + timerSeconds + '</div></span>', 276 language: $htmlLang, 277 update_time: 1000, 278 onEnd: function() { 279 $(this).hide(); 280 } 281 }); 282 } 283 }, 284 } 285 286 lp_template.popupForm = function($block) { 287 $block.on('click', '[data-popup-form]', function(e) { 288 var $this = $(this); 289 290 if (myo.show) { 291 myo.show({ 292 json: $this.data('api-url'), 293 onContentLoad: function(w) { 294 s3LP.initForms($(this.bodyDiv)); 295 } 296 }); 297 } else if (myo.open) { 298 myo.open({ 299 json: $this.data('api-url'), 300 onLoad: function(w) { 301 s3LP.initForms($(this.bodyDiv)); 302 } 303 }); 304 } 305 306 e.preventDefault(); 307 }); 308 } 309 310 lp_template.queue = { 311 312 313 314 initSlickSlider: function($block) { 315 if (lp_template.hasSlick) { 316 if (typeof $.fn.slick == 'undefined') { 317 $.getScript("/g/libs/jquery-slick/1.9.0/slick.min.js", function( data, textStatus, jqxhr ) { 318 $(document).find('head').append('<link rel="stylesheet" href="/g/libs/jquery-slick/1.9.0/slick.css">'); 319 queue(lp_template.slickSliders, $block); 320 }); 321 } else { 322 queue(lp_template.slickSliders, $block); 323 } 324 } 325 }, 326 327 initTabs: function($block) { 328 if ($block.find('[data-init-tabs]').length) { 329 if (typeof $.fn.responsiveTabs == 'undefined') { 330 $.getScript("/g/templates/shop2/2.71.2/js/jquery.responsiveTabs.min.js", function() { 331 queue(lp_template.tabs, $block); 332 }); 333 } else { 334 queue(lp_template.tabs, $block); 335 } 336 } 337 }, 338 339 340 initTimers: function($block) { 341 if (typeof $.fn.lpTimer == 'undefined') { 342 $.getScript("/g/s3/lp/lp_content/js/timer.js", function( data, textStatus, jqxhr ) { 343 queue(lp_template.timers, $block); 344 }); 345 } else { 346 queue(lp_template.timers, $block); 347 } 348 }, 349 350 stepsAccordeon: function($block) { 351 var $buttons = $block.find('.js_keyMoment_tit_init'); 352 353 $buttons.on('click', function(e) { 354 e.preventDefault(); 355 356 if ($win.width() > 767) return; 357 358 var $this = $(this), 359 $thisParent = $this.closest('.saleseopage_keyMoment_listBlok'), 360 $thisText = $thisParent.find('.saleseopage_keyMoment_listBlok_bottomPart'); 361 362 $thisParent.toggleClass('active'); 363 $thisText.slideToggle(); 364 365 }); 366 }, 367 368 productAccordeon: function($block) { 369 var $buttons = $block.find('.del_name_init'); 370 371 $buttons.on('click', function(e) { 372 e.preventDefault(); 373 374 if ($win.width() > 640) return; 375 376 var $this = $(this), 377 $thisParent = $this.closest('.salepage_formprod_del_name_text'), 378 $thisText = $thisParent.find('.salepage_formprod_del_text'); 379 380 $thisParent.toggleClass('active'); 381 $thisText.slideToggle(); 382 383 }); 384 }, 385 386 popupForm: function($block) { 387 if ($block.find('[data-popup-form]').length) { 388 if (typeof myo == 'function') { 389 lp_template.popupForm($block); 390 } else {
391 $.getScript('/g/libs/jquery-popover/0.0.3/jquery.popover.min.js', function() { 392 $(document).find('head').append('<link rel="stylesheet" href="/g/libs/jquery-popover/0.0.3/jquery.popover.css">'); 393 lp_template.popupForm($block); 394 }); 395 } 396 } 397 }, 398 399 initLightGallery: function($block) { 400 var $blocks = $block.find('.js-lightgallery'); 401 402 if (typeof $.fn.lightGallery === 'undefined') { 403 $.getScript("/g/libs/lightgallery/v1.2.19/lightgallery.js", function( data, textStatus, jqxhr ) { 404 $(document).find('head').append('<link rel="stylesheet" href="/g/templates/shop2/2.70.2/css/lightgallery.css">'); 405 lgInit() 406 }); 407 } else { 408 lgInit() 409 } 410 411 function lgInit () { 412 $blocks.lightGallery({ 413 selector: 'a', 414 thumbnail: false, 415 download: false 416 }); 417 } 418 } 419 } 420 421 lp_template.init = function($block) { 422 queue(lp_template.queue, $block); 423 } 424 425 window.lp_init = function(block_wrapper) { 426 427 var $wrapper = block_wrapper.find('.decor-wrap'); 428 wrapperWidth = $wrapper.width(); 429 430 $win.on('resize', function(){ 431 var $wrap = $body.find('.decor-wrap') 432 $wrap.find('.js-slider-2, .js-slick-reviews, .js-slider-1').width($wrap.width()); 433 }).trigger('resize'); 434 435 if ($wrapper.length && wrapperWidth >= 1100) { 436 $wrapper.addClass('fullWidth'); 437 } else if ($wrapper.length && wrapperWidth < 700) { 438 $wrapper.addClass('miniWidth'); 439 } else if ($wrapper.length && wrapperWidth < 900) { 440 $wrapper.addClass('middelWidth'); 441 } 442 443 if (!lp_template.hasSlick && block_wrapper.find("[data-init-slick]").length) { 444 lp_template.hasSlick = true; 445 } 446 447 lp_template.init(block_wrapper); 448 449 if (lp_template.mapList.length) { 450 451 lp_template.initMaps(lp_template.mapList); 452 453 lp_template.mapList = []; 454 } 455 456 if (document.location.hash.length > 1 && $(document.location.hash).length) { 457 setTimeout(function() { 458 $('html, body').scrollTop($(document.location.hash).offset().top); 459 }, 200); 460 } 461 } 462 463 function queue(obj, $block) { 464 Object.keys(obj).forEach(function(item){ 465 var func = obj[item]; 466 467 if (typeof func == 'function') { 468 func($block); 469 } 470 }); 471 } 472 473 $(document).on('click', '.datepickerFrom', function(e) { 474 var $this = $(this), 475 thisCalendarInited = $this.data('calendarInited'); 476 477 if (!thisCalendarInited) { 478 $this.datepicker(); 479 thisCalendarInited = $this.data('calendarInited', true); 480 481 setTimeout(function() { 482 $this.trigger('focus'); 483 $this.trigger('click'); 484 }, 0); 485 486 e.stopImmediatePropagation(); 487 e.preventDefault(); 488 } 489 }); 490 491 $(document).on('click', '.datepickerTo', function() { 492 var $this = $(this), 493 thisCalendarInited = $this.data('calendarInited'); 494 495 if (!thisCalendarInited) { 496 $this.datepicker({ 497 range: true 498 }); 499 thisCalendarInited = $this.data('calendarInited', true); 500 } 501 }); 502 503})();
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.