1/** 2 * Full page 3 */ 4(function () { 5 'use strict'; 6 7 /** 8 * Full scroll main function 9 */ 10 var fullScroll = function (params) { 11 /** 12 * Main div 13 * @type {Object} 14 */ 15 var main = document.getElementById(params.mainElement); 16 17 /** 18 * Sections divclass 19 * @type {Array} 20 */ 21 22 /* let vWidth=getViewport()[0]; 23 let vHeight=getViewport()[1]; 24 let ratio = asp_ratio(vWidth, vHeight); //ÑÑиÑаем ÑооÑноÑение ÑÑоÑон 25 var mesSlider = 0; 26 27 28 console.log("$('#section-home-custom-messages').length="+$('#section-home-custom-messages').length); 29 30 if($('#section-home-custom-messages').length>0){ 31 mesSlider = $('#section-home-custom-messages').length; 32 } 33 34 if(ratio[0]>ratio[1]){ 35 var dimm = ratio[0]/ratio[1] 36 }else{ 37 var dimm = ratio[1]/ratio[0] 38 } 39 40 console.log('vWidth='+vWidth+' vHeight='+vHeight+' ratio='+ratio[0]+':'+ratio[1]+' dimm='+dimm); 41 42 console.log('mesSlider='+mesSlider); 43 44 if(mesSlider!=0){ 45 if(vHeight>860){ 46 if(vWidth<1366){ 47 console.log('vWidth<1366'); 48 if(dimm < 1.85){ 49 console.log('иÑклÑÑаем'); 50 $('.section1-mobile').css('display','none'); 51 $('.section1-desctop .section-home-custom-messages').css('bottom','auto'); 52 $('.section1-desctop .text-on-slider').css({opacity:'1', 'zIndex':'90'}); 53 $('.section1-desctop .text-on-slider').removeClass('zindex0'); 54 var sections = main.querySelectorAll('section:not(.section1-mobile)'); 55 }else{ 56 console.log('показÑваем'); 57 $('.section1-mobile').css('display','block'); 58 $('.section1-desctop .section-home-custom-messages').css('bottom','0'); 59 $('.section1-desctop .text-on-slider').css({opacity:'0', 'zIndex':'-2'}); 60 $('.section1-desctop .text-on-slider').addClass('zindex0'); 61 var sections = main.getElementsByTagName('section'); 62 } 63 }else{ 64 console.log('иÑклÑÑаем'); 65 $('.section1-mobile').css('display','none'); 66 $('.section1-desctop .section-home-custom-messages').css('bottom','auto'); 67 $('.section1-desctop .text-on-slider').css({opacity:'1', 'zIndex':'90'}); 68 $('.section1-desctop .text-on-slider').removeClass('zindex0'); 69 var sections = main.querySelectorAll('section:not(.section1-mobile)'); 70 } 71 72 73 }else{ 74 75 var sections = main.getElementsByTagName('section'); 76 77 $('.section1-mobile').css('display','block'); 78 $('.section1-desctop .section-home-custom-messages').css('bottom','0'); 79 $('.section1-desctop .text-on-slider').css('opacity','0'); 80 $('.section1-desctop .text-on-slider').addClass('zindex0'); 81 82 } 83 }else{ 84 var sections = main.getElementsByTagName('section'); 85 } */ 86 87 sections=get__double_block(); 88 console.log(sections); 89 if(!sections){ 90 var sections = main.getElementsByTagName('section'); 91 } 92 93 /** 94 * Full page scroll configurations 95 * @type {Object} 96 */ 97 var defaults = { 98 container : main, 99 sections : sections, 100 animateTime : params.animateTime || 0.7, 101 animateFunction : params.animateFunction || 'ease', 102 maxPosition: sections.length - 1, 103 currentPosition: 0, 104 displayDots: typeof params.displayDots != 'undefined' ? params.displayDots : true, 105 dotsPosition: params.dotsPosition || 'left' 106 }; 107 108 this.defaults = defaults; 109 /** 110 * Init build 111 */ 112 this.init(); 113 }; 114 115 /** 116 * Init plugin 117 */ 118 fullScroll.prototype.init = function () { 119 this.buildPublicFunctions() 120 .buildSections() 121 .buildDots() 122 .addEvents(); 123 124 var anchor = location.hash.replace('#', '').split('/')[0]; 125 location.hash = 0; 126 this.changeCurrentPosition(anchor); 127 this.registerIeTags(); 128 }; 129 130 /** 131 * Build sections 132 * @return {Object} this(fullScroll) 133 */ 134 fullScroll.prototype.buildSections = function () { 135 var sections = this.defaults.sections; 136 for (var i = 0; i < sections.length; i++) { 137 sections[i].setAttribute('data-index', i); 138 } 139 return this; 140 }; 141 142 /** 143 * Build dots navigation 144 * @return {Object} this (fullScroll) 145 */ 146 fullScroll.prototype.buildDots = function () { 147 this.ul = document.createElement('ul'); 148 149 this.ul.className = this.updateClass(1, 'dots', this.ul.className); 150 this.ul.className = this.updateClass(1, this.defaults.dotsPosition == 'right' ? 'dots-right' : 'dots-left', this.ul.className); 151 152 var _self = this; 153 var sections = this.defaults.sections; 154 155 for (var i = 0; i < sections.length; i++) { 156 var li = document.createElement('li'); 157 var a = document.createElement('a'); 158 159 a.setAttribute('href', '#' + i); 160 li.appendChild(a); 161 _self.ul.appendChild(li); 162 } 163 164 this.ul.childNodes[0].firstChild.className = this.updateClass(1, 'active', this.ul.childNodes[0].firstChild.className); 165 166 if (this.defaults.displayDots) { 167 document.body.appendChild(this.ul); 168 } 169 170 return this; 171 }; 172 173 /** 174 * Add Events 175 * @return {Object} this(fullScroll) 176 */ 177 fullScroll.prototype.addEvents = function () { 178 179 if (document.addEventListener) { 180 document.addEventListener('mousewheel', this.mouseWheelAndKey, false); 181 document.addEventListener('wheel', this.mouseWheelAndKey, false); 182 document.addEventListener('keyup', this.mouseWheelAndKey, false); 183 document.addEventListener('touchstart', this.touchStart, false); 184 document.addEventListener('touchend', this.touchEnd, false); 185 window.addEventListener("hashchange", this.hashChange, false); 186 187 /** 188 * Enable scroll if decive don't have touch support 189 */ 190 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 191 if(!('ontouchstart' in window)){ 192 document.body.style = "overflow: scroll;"; 193 document.documentElement.style = "overflow: scroll;"; 194 } 195 } 196 197 } else { 198 document.attachEvent('onmousewheel', this.mouseWheelAndKey, false); 199 document.attachEvent('onkeyup', this.mouseWheelAndKey, false); 200 } 201 202 return this; 203 }; 204 205 /** 206 * Build public functions 207 * @return {[type]} [description] 208 */ 209 fullScroll.prototype.buildPublicFunctions = function () { 210 var mTouchStart = 0; 211 var mTouchEnd = 0; 212 var _self = this; 213 214 this.mouseWheelAndKey = function (event) { 215 if (event.deltaY > 0 || event.keyCode == 40) { 216 _self.defaults.currentPosition ++; 217 _self.changeCurrentPosition(_self.defaults.currentPosition); 218 } else if (event.deltaY < 0 || event.keyCode == 38) { 219 _self.defaults.currentPosition --; 220 _self.changeCurrentPosition(_self.defaults.currentPosition); 221 } 222 _self.removeEvents(); 223 }; 224 225 this.touchStart = function (event) { 226 mTouchStart = parseInt(event.changedTouches[0].clientY); 227 mTouchEnd = 0; 228 }; 229 230 this.touchEnd = function (event) { 231 mTouchEnd = parseInt(event.changedTouches[0].clientY); 232 if (mTouchEnd - mTouchStart > 100 || mTouchStart - mTouchEnd > 100) { 233 if (mTouchEnd > mTouchStart) { 234 _self.defaults.currentPosition --; 235 } else { 236 _self.defaults.currentPosition ++; 237 } 238 _self.changeCurrentPosition(_self.defaults.currentPosition); 239 } 240 }; 241 242 this.hashChange = function (event) { 243 244 var headerFixed = document.querySelector('.flex-top-header'); 245 if (location) { 246 var anchor = location.hash.replace('#', '').split('/')[0]; 247 if (anchor !== "") { 248 if (anchor < 0) { 249 _self.changeCurrentPosition(0); 250 } else if (anchor > _self.defaults.maxPosition) { 251 _self.changeCurrentPosition(_self.defaults.maxPosition); 252 } else { 253 _self.defaults.currentPosition = anchor; 254 _self.animateScroll(); 255 } 256 257 //console.log(anchor); 258 259 if(anchor > 0) { 260 headerFixed.classList.add('change-top'); 261 removeBgHeader(); 262 headerFixed.classList.add('bg-header' + anchor); 263 } else { 264 removeBgHeader(); 265 headerFixed.classList.remove('change-top'); 266 } 267 268 if(anchor == 2 || anchor == 1) { 269 var time = 4, 270 cc = 1; 271 272 $('.js-counter').each(function() { 273 var 274 cPos = $(this).offset().top, 275 topWindow = $(window).scrollTop(); 276 277 if (cc < 2) { 278 $(".number").addClass("viz"); 279 $('span').each(function() { 280 var 281 i = 1, 282 num = $(this).data('num'), 283 step = 1000 * time / num, 284 that = $(this), 285 int = setInterval(function() { 286 if (i <= num) { 287 that.html(i); 288 } else { 289 cc = cc + 2; 290 clearInterval(int); 291 } 292 i++; 293 }, step); 294 }); 295 } 296 297 }); 298 299 } 300 } 301 } 302 }; 303 304 function removeBgHeader() { 305 306 var regClass = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']; 307 regClass.forEach(el => { 308 document.querySelector('.flex-top-header').classList.remove('bg-header' + el); 309 }); 310 $('.flex-top-header').removeClass('menu-to-back');//закÑÑваем вÑплÑваÑÐºÑ Ñ Ð»ÐµÐ½Ñой новоÑÑей и поднимаем Ñ Ð¸Ð´ÐµÑ Ð½Ð°Ð´ ней обÑаÑно 311 $('.js-collapsible-block').removeClass('block-open'); 312 } 313 314 this.removeEvents = function () { 315 if (document.addEventListener) { 316 document.removeEventListener('mousewheel', this.mouseWheelAndKey, false); 317 document.removeEventListener('wheel', this.mouseWheelAndKey, false); 318 document.removeEventListener('keyup', this.mouseWheelAndKey, false); 319 document.removeEventListener('touchstart', this.touchStart, false); 320 document.removeEventListener('touchend', this.touchEnd, false); 321 322 } else { 323 document.detachEvent('onmousewheel', this.mouseWheelAndKey, false); 324 document.detachEvent('onkeyup', this.mouseWheelAndKey, false); 325 } 326 327 setTimeout(function(){ 328 _self.addEvents(); 329 }, 600); 330 }; 331 332 this.animateScroll = function () { 333 var animateTime = this.defaults.animateTime; 334 var animateFunction = this.defaults.animateFunction; 335 var position = this.defaults.currentPosition * 100; 336 337 this.defaults.container.style.webkitTransform = 'translateY(-' + position + '%)'; 338 this.defaults.container.style.mozTransform = 'translateY(-' + position + '%)'; 339 this.defaults.container.style.msTransform = 'translateY(-' + position + '%)'; 340 this.defaults.container.style.transform = 'translateY(-' + position + '%)'; 341 this.defaults.container.style.webkitTransition = 'all ' + animateTime + 's ' + animateFunction; 342 this.defaults.container.style.mozTransition = 'all ' + animateTime + 's ' + animateFunction; 343 this.defaults.container.style.msTransition = 'all ' + animateTime + 's ' + animateFunction; 344 this.defaults.container.style.transition = 'all ' + animateTime + 's ' + animateFunction; 345 346 for (var i = 0; i < this.ul.childNodes.length; i++) { 347 this.ul.childNodes[i].firstChild.className = this.updateClass(2, 'active', this.ul.childNodes[i].firstChild.className); 348 if (i == this.defaults.currentPosition) { 349 this.ul.childNodes[i].firstChild.className = this.updateClass(1, 'active', this.ul.childNodes[i].firstChild.className); 350 } 351 } 352 }; 353 354 this.changeCurrentPosition = function (position) { 355 if (position !== "") { 356 _self.defaults.currentPosition = position; 357 location.hash = _self.defaults.currentPosition; 358 } 359 }; 360 361 this.registerIeTags = function () { 362 document.createElement('section'); 363 }; 364 365 this.updateClass = function (type, newClass, currentClass) { 366 if (type == 1) { 367 return currentClass += ' ' + newClass; 368 } else if (type == 2) { 369 return currentClass.replace(newClass, ''); 370 } 371 }; 372 373 return this; 374 }; 375 window.fullScroll = fullScroll; 376})();
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.