1var $document = $(document), 2 $window = $(window); 3 4$(function(){ 5 'use strict'; 6 7 $('.body-animate').addClass('body-animate_animated'); 8 9 SmoothScroll({ 10 animationTime : 1000, // [ms] 11 stepSize : 200 // [px] 12 }); 13 14 $('.js-materialInput').each(function(){ 15 updateInputMaterial($(this)); 16 }); 17 18 $document.on('keyup change', '.js-materialInput', function(){ 19 updateInputMaterial($(this)); 20 }); 21 22 selectInit($('.js-selectBase')); 23 24 $document.on('keyup','.js-phoneMask',function(e){ 25 var t = $(this).val().replace(/\D/g, ''); 26 t = t.replace(/\s/g, '').trim(); 27 var customOptions = { 28 translation: { 29 'r': { 30 pattern: /[0-6,9]/, 31 fallback: ''}, 32 '9': { 33 pattern: /[0-9]/} 34 } 35 }; 36 $('.js-phoneMask').mask('+7 (r99) 999-99-99', customOptions); 37 if(t.length==1){ 38 var THIS = $(this), thisVal = THIS.val(); 39 THIS.val('').focus().val(thisVal); 40 } 41 if($(this).val().length<16){ 42 $(this).addClass('wrong'); 43 } else { 44 $(this).removeClass('wrong'); 45 } 46 }); 47 48 $document.on('click', '.js-openDialogAjax', function(){ 49 var $this = $(this), 50 title = $this.data('title'), 51 cssClass = $this.data('cssclass'), 52 hrefID = $this.attr('href').split('#'), 53 url = '/ajax/popup/'+hrefID[1]+'/'; 54 //url = '/html/templates/popup/'+hrefID[1]+'.tpl.php'; 55 $.ajax({
56 url: url, 57 success: function(data){ 58 MyCMSDialog.closeAll(); 59 MyCMSDialog.open({ 60 'title': title, 61 'cssClass': cssClass, 62 'content': data, 63 'open': function(){ 64 65 } 66 }); 67 } 68 }); 69 return false; 70 }); 71 72 $document.on('click', '.js-openBrand', function(){ 73 var url = '/ajax/popup/brand/?id=' + $(this).data('id'); 74 $('[data-toggle-block="brand"]').remove(); 75 $.ajax({ 76 url: url, 77 success: function(data){ 78 $('body').append(data); 79 openBrandInit(); 80 } 81 }); 82 return false; 83 }); 84 85 $('a[href="#more_next_newslist"]').click(function () { 86 pagerAjax('#newsList', '#newsPages', '#newsMoreBtn'); 87 return false; 88 }); 89 90 $document.on('submit', 'form.ajaxForm',function(){ 91 var $this = $(this), 92 action = $('input[name="action"]',this).val(); 93 $('button[type="submit"]', $this).prop('disabled', true); 94 95 96 $.post('/ajax/'+action+'/',$(this).serialize(),function(res){ 97 if(res.status=="ok"){ 98 MyCMSDialog.closeAll(); 99 MyCMSDialog.open({ 100 'cssClass': 'ok-popup', 101 'title': res.title, 102 'content': res.msg 103 }); 104 $this[0].reset(); 105 $('.js-materialInput', $this).each(function(){ 106 updateInputMaterial($(this)); 107 }); 108 $('.js-selectBase').fSelect('reload'); 109 }else{ 110 MyCMSDialog.open({ 111 'cssClass': 'error-popup', 112 'title': 'ÐÑибка!', 113 'content': res.msg 114 }); 115 } 116 $('button[type="submit"]', $this).prop('disabled', false); 117 },'json'); 118 119 return false; 120 }); 121 122 $document.on('click', '.js-closeDialog', function(){ 123 MyCMSDialog.closeAll(); 124 return false; 125 }); 126 127 $document.lightGallery({ 128 selector: '.lightbox', 129 thumbnail: false, 130 download: false 131 }); 132 133 let partnersSlider = new Swiper('.js-partnersSlider', { 134 loop: true, 135 slidesPerView: 1, 136 spaceBetween: 0, 137 navigation: { 138 nextEl: '.js-partnersSliderNext', 139 prevEl: '.js-partnersSliderPrev' 140 } 141 }); 142 143 onScrollInit( $('.os-animation') ); 144 145 $document.on('click', '.js-navTggl', function(){ 146 let $this = $(this), 147 id = $this.attr('href').replace('#', ''); 148 $('.popup-hint').removeClass('is-open'); 149 if ($this.hasClass('is-open')) { 150 $('.js-navTggl[href="#' + id + '"]').removeClass('is-open'); 151 $('[data-toggle-block="'+id+'"]').removeClass('is-open'); 152 $('body').removeClass('menu-is-open'); 153 if ($window.width()<992) { 154 if (id == 'menu' ) { 155 $('[data-toggle-block="catalog"]').removeClass('is-open'); 156 } 157 } 158 } else { 159 $('.js-navTggl:not([href="#' + id + '"])').removeClass('is-open'); 160 $('[data-toggle-block]:not([data-toggle-block="' + id + '"])').removeClass('is-open'); 161 $('.js-navTggl[href="#' + id + '"]').addClass('is-open'); 162 $('[data-toggle-block="'+id+'"]').addClass('is-open'); 163 if (id == 'catalog' ) { 164 $('body').addClass('menu-is-open'); 165 } else { 166 $('body').removeClass('menu-is-open'); 167 } 168 if ($window.width()<992) { 169 if (id == 'catalog' ) { 170 $('.js-navTggl[href="#menu"]').addClass('is-open'); 171 } 172 } 173 } 174 175 return false; 176 }); 177 $document.on('click', '.js-navClose', function(){ 178 let $this = $(this), 179 id = $this.closest('[data-toggle-block]').data('toggle-block'); 180 $this.closest('[data-toggle-block]').removeClass('is-open'); 181 $('.js-navTggl[href="#' + id + '"]').removeClass('is-open'); 182 return false; 183 });
184 185 $document.on('click', '.js-menuListTggl', function(){ 186 if ($window.width()<768) { 187 $(this).toggleClass('is-open').next('.menu__list-sub').slideToggle(); 188 return false; 189 } 190 }); 191 192 $('[data-mobile_clone]').each(function(){ 193 var id = $(this).data('mobile_clone'); 194 $(this).clone().appendTo('[data-mobile_clone_paste="'+id+'"]'); 195 }); 196 197 $('[data-popup-hover]').hover(function (){ 198 let id = $(this).data('popup-hover'); 199 $('.popup-hint[data-popup="'+id+'"]').addClass('is-open'); 200 console.log(id) 201 }); 202 203 $document.on('click', '.popup-hint__close', function (){ 204 $(this).closest('.popup-hint').removeClass('is-open'); 205 return false; 206 }); 207 208 scrollTgglClass($('body'), 0, 'is-header-fixed'); 209 210}); 211 212$window.on('scroll', function () { 213 scrollTgglClass($('body'), 0, 'is-header-fixed'); 214 $('.popup-hint').removeClass('is-open'); 215}); 216 217function scrollTgglClass(obj, space, className) { 218 if($window.scrollTop() > space) { 219 obj.addClass(className); 220 } else { 221 obj.removeClass(className); 222 } 223} 224 225function selectInit(obj) { 226 obj.each(function(){ 227 var showSearch = $(this).data('search') ? true : false, 228 placeholder = $(this).data('placeholder') ? $(this).data('placeholder') : 'ÐÑбÑаÑÑ'; 229 $(this).fSelect({ 230 placeholder: placeholder, 231 numDisplayed: 2, 232 overflowText: 'ÐÑбÑано ({n})', 233 noResultsText: 'ÐÐµÑ ÑезÑлÑÑаÑов', 234 searchText: 'ÐоиÑк', 235 showSearch: showSearch 236 }); 237 }); 238} 239 240function updateInputMaterial($input){ 241 let val = $input.val(), 242 $inputMaterial = $input.closest('.field-base'); 243 244 if(val != '') { 245 if ($input.hasClass('js-phoneMask') && (val.indexOf('_') + 1)) { 246 $inputMaterial.removeClass('no-empty is-filled'); 247 } else if ($input.hasClass('js-emailMask')) { 248 let pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); 249 if (pattern.test(val)) { 250 $inputMaterial.addClass('no-empty is-filled'); 251 } else{ 252 $inputMaterial.addClass('no-empty').removeClass('is-filled'); 253 } 254 } else { 255 $inputMaterial.addClass('no-empty is-filled'); 256 } 257 } else { 258 $inputMaterial.removeClass('no-empty is-filled'); 259 } 260} 261 262function onScrollInit(items, trigger) { 263 items.each( function() { 264 var osElement = $(this), 265 osAnimationOffset = osElement.attr('data-os-animation-offset') ? osElement.attr('data-os-animation-offset') : '95%', 266 osAnimationClass = osElement.attr('data-os-animation') ? osElement.attr('data-os-animation') : 'fadeIn', 267 osAnimationDelay = osElement.attr('data-os-animation-delay'), 268 osAnimationDuration = osElement.attr('data-os-animation-duration') ? osElement.attr('data-os-animation-duration') : '1s'; 269 270 osElement.css({ 271 'animation-duration': osAnimationDuration 272 }); 273 if (osAnimationDelay) { 274 osElement.css({ 275 'animation-delay': osAnimationDelay 276 }); 277 } 278 279 var osTrigger = ( trigger ) ? trigger : osElement; 280 281 osTrigger.waypoint(function() { 282 osElement.addClass('animated').addClass(osAnimationClass); 283 },{ 284 triggerOnce: true, 285 offset: osAnimationOffset 286 }); 287 }); 288} 289 290function openBrandInit() { 291 let gallerySlider = new Swiper('.js-gallerySlider', { 292 loop: false, 293 slidesPerView: 2, 294 spaceBetween: 0, 295 mousewheel: true, 296 observer: true, 297 observeParents: true, 298 pagination: { 299 el: '.swiper-pagination', 300 clickable: true 301 }, 302 breakpoints: { 303 480: { 304 slidesPerView: 3, 305 }, 306 991: { 307 slidesPerView: 4, 308 } 309 } 310 });
311 $('.lightbox-album').lightGallery({ 312 selector: '[data-lightbox]', 313 thumbnail: false, 314 download: false 315 }); 316} 317 318function pagerAjax(idList, idPages, idMore) { 319 $(idMore).css('opacity', 0.5); 320 $.get($(idMore).data('href'), {}, function (res) { 321 $(idMore).css('opacity', 1); 322 $(idList).append(res.rows); 323 $(idPages).html(res.pages); 324 if (res.more_btn_href != '') { 325 $(idMore).data('href', res.more_btn_href); 326 } else { 327 $(idMore).remove(); 328 } 329 }, 'json'); 330}
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.