1/*-------------------------------------------------------------------------------------------------------------------------------*/ 2/*This is main JS file that contains custom style rules used in this template*/ 3/*-------------------------------------------------------------------------------------------------------------------------------*/ 4/* Template Name: Site Title*/ 5/* Version: 1.0 Initial Release*/ 6/* Build Date: 22-04-2015*/ 7/* Author: Unbranded*/ 8/* Website: http://moonart.net.ua/site/ 9/* Copyright: (C) 2015 */ 10/*-------------------------------------------------------------------------------------------------------------------------------*/ 11 12/*--------------------------------------------------------*/ 13/* TABLE OF CONTENTS: */ 14/*--------------------------------------------------------*/ 15/* 01 - VARIABLES */ 16/*-------------------------------------------------------------------------------------------------------------------------------*/ 17 18jQuery(function($) { 19 20 "use strict"; 21 22 /*================*/ 23 /* 01 - VARIABLES */ 24 /*================*/ 25 var swipers = [], 26 winW, winH, winScr, _isresponsive, smPoint = 768, 27 mdPoint = 992, 28 lgPoint = 1200, 29 addPoint = 1600, 30 _ismobile = navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i); 31 32 /*========================*/ 33 /* 02 - page calculations */ 34 /*========================*/ 35 function pageCalculations() { 36 winW = $(window).width(); 37 winH = $(window).height(); 38 if ($('.menu-button').is(':visible')) _isresponsive = true; 39 else _isresponsive = false; 40 } 41 42 /*=================================*/ 43 /* 03 - function on document ready */ 44 /*=================================*/ 45 pageCalculations(); 46 47 /*============================*/ 48 /* 04 - function on page load */ 49 /*============================*/ 50 $(window).load(function() { 51 $('#loader-wrapper').fadeOut(); 52 initSwiper(); 53 matchHeight(); 54 //console.log('called'); 55 }); 56 57 $(document).ready(function() { 58 matchHeight(); 59 progressBar(); 60 stickyVideo(); 61 }); 62 63 /*==============================*/ 64 /* 05 - function on page scroll */ 65 /*==============================*/ 66 $(window).on("scroll", function() { 67 winScr = $(window).scrollTop(); 68 stickHeader(); 69 }); 70 71 /*==============================*/ 72 /* 05 - function on page resize */ 73 /*==============================*/ 74 function resizeCall() { 75 pageCalculations(); 76 77 $('.swiper-container.initialized[data-slides-per-view="responsive"]').each(function() { 78 var thisSwiper = swipers['swiper-' + $(this).attr('id')], 79 $t = $(this), 80 slidesPerViewVar = updateSlidesPerView($t); 81 thisSwiper.params.slidesPerView = slidesPerViewVar; 82 thisSwiper.reInit(); 83 var paginationSpan = $t.find('.pagination span'); 84 var paginationSlice = paginationSpan.hide().slice(0, (paginationSpan.length + 1 - slidesPerViewVar)); 85 if (paginationSlice.length <= 1 || slidesPerViewVar >= $t.find('.swiper-slide').length) $t.addClass('pagination-hidden'); 86 else $t.removeClass('pagination-hidden'); 87 paginationSlice.show(); 88 }); 89 } 90 if (!_ismobile) { 91 $(window).resize(function() { 92 resizeCall(); 93 }); 94 } else { 95 window.addEventListener("orientationchange", function() { 96 resizeCall(); 97 }, false); 98 } 99 100 function stickyVideo() { 101 var video = '.tt-fluid-inner .tt-iframe'; 102 var button = '#lp-pom-button-16'; 103 var showHeight = 645; 104 105 var targetClass = 'smallVid'; 106 var adjustClass = 'vidAdjust'; 107 var classSelect = '.smallVid'; 108 var noClose = true; 109 var initWidth = $(video).width(); 110 var initHeight = $(video).height(); 111 $(window).scroll(function() { 112 if ($(this).scrollTop() > showHeight && noClose) { 113 $(video).addClass(targetClass + ' ' + adjustClass); 114 $(video).removeClass('tt-fluid-inner-iframe'); 115 $(button).addClass(targetClass); 116 } else {
117 $(video).removeClass(targetClass, adjustClass); 118 $(video).addClass('tt-fluid-inner-iframe'); 119 $(button).removeClass(targetClass); 120 } 121 }); 122 $(button).click(function() { 123 $(video).removeClass('smallVid vidAdjust'); 124 $(button).removeClass('smallVid'); 125 targetClass - null; 126 adjustClass - null; 127 noClose = false; 128 }); 129 } 130 131 function matchHeight() { 132 var blogPostGrid = $('.post-grid-view'); 133 134 blogPostGrid.imagesLoaded(function() { 135 blogPostGrid.find('.post-handy-picked').not('.slick-slide').matchHeight(); 136 }); 137 } 138 139 /*=====================*/ 140 /* 07 - swiper sliders */ 141 /*=====================*/ 142 function initSwiper() { 143 var initIterator = 0; 144 $('.swiper-container').each(function() { 145 var $t = $(this); 146 //console.log(initIterator + 'sdfsfsfs'); 147 var index = 'swiper-unique-id-' + initIterator; 148 149 $t.addClass('swiper-' + index + ' initialized').attr('id', index); 150 $t.find('.pagination').addClass('pagination-' + index); 151 152 var autoPlayVar = parseInt($t.attr('data-autoplay'), 10); 153 var centerVar = parseInt($t.attr('data-center'), 10); 154 var simVar = ($t.closest('.circle-description-slide-box').length) ? false : true; 155 156 var slidesPerViewVar = $t.attr('data-slides-per-view'); 157 if (slidesPerViewVar == 'responsive') { 158 slidesPerViewVar = updateSlidesPerView($t); 159 } else if (slidesPerViewVar != 'auto') slidesPerViewVar = parseInt(slidesPerViewVar, 10); 160 161 var loopVar = parseInt($t.attr('data-loop'), 10); 162 var speedVar = parseInt($t.attr('data-speed'), 10); 163 164 swipers['swiper-' + index] = new Swiper('.swiper-' + index, { 165 speed: speedVar, 166 pagination: '.pagination-' + index, 167 loop: loopVar, 168 paginationClickable: true, 169 autoplay: autoPlayVar, 170 slidesPerView: slidesPerViewVar, 171 keyboardControl: true, 172 calculateHeight: true, 173 simulateTouch: simVar, 174 centeredSlides: centerVar, 175 roundLengths: true, 176 onSlideChangeEnd: function(swiper) { 177 var activeIndex = (loopVar === true) ? swiper.activeIndex : swiper.activeLoopIndex; 178 var qVal = $t.find('.swiper-slide-active').attr('data-val'); 179 $t.find('.swiper-slide[data-val="' + qVal + '"]').addClass('active'); 180 }, 181 onSlideChangeStart: function(swiper) { 182 $t.find('.swiper-slide.active').removeClass('active'); 183 }, 184 onSlideClick: function(swiper) { 185 186 } 187 }); 188 //swipers['swiper-'+index].reInit(); 189 if ($t.attr('data-slides-per-view') == 'responsive') { 190 var paginationSpan = $t.find('.pagination span'); 191 var paginationSlice = paginationSpan.hide().slice(0, (paginationSpan.length + 1 - slidesPerViewVar)); 192 if (paginationSlice.length <= 1 || slidesPerViewVar >= $t.find('.swiper-slide').length) $t.addClass('pagination-hidden'); 193 else $t.removeClass('pagination-hidden'); 194 paginationSlice.show(); 195 } 196 initIterator++; 197 }); 198 199 } 200 201 function updateSlidesPerView(swiperContainer) { 202 if (winW >= addPoint) return parseInt(swiperContainer.attr('data-add-slides'), 10); 203 else if (winW >= lgPoint) return parseInt(swiperContainer.attr('data-lg-slides'), 10); 204 else if (winW >= mdPoint) return parseInt(swiperContainer.attr('data-md-slides'), 10); 205 else if (winW >= smPoint) return parseInt(swiperContainer.attr('data-sm-slides'), 10); 206 else return parseInt(swiperContainer.attr('data-xs-slides'), 10); 207 } 208 209 //swiper arrows 210 $('.swiper-arrow-left').on('click', function() { 211 swipers['swiper-' + $(this).parent().attr('id')].swipePrev(); 212 }); 213 214 $('.swiper-arrow-right').on('click', function() { 215 swipers['swiper-' + $(this).parent().attr('id')].swipeNext(); 216 }); 217 218 //swiper arrows 219 $('.custom-arrow-left').on('click', function() { 220 swipers['swiper-' + $(this).closest('.tt-custom-arrows').find('.swiper-container').attr('id')].swipePrev(); 221 }); 222 $('.custom-arrow-right').on('click', function() { 223 swipers['swiper-' + $(this).closest('.tt-custom-arrows').find('.swiper-container').attr('id')].swipeNext(); 224 }); 225 226 /*==============================*/ 227 /* 08 - buttons, clicks, hovers */ 228 /*==============================*/ 229 230 function stickHeader() { 231 if (winScr > 0) { 232 $(".tt-header").addClass("stick"); 233 } else { 234 $(".tt-header").removeClass("stick"); 235 } 236 if ($(".tt-header-banner").length) { 237 var bannerH = $(".tt-header-banner").height(); 238 if (winScr > bannerH) { 239 $(".tt-header").addClass("move"); 240 } else { 241 $(".tt-header").removeClass("move"); 242 } 243 } 244 } 245 246 /*mobile menu*/ 247 $('.cmn-mobile-switch,.tt-mobile-close,.tt-mobile-overlay').on('click', function(e) { 248 $('.tt-mobile-overlay').toggleClass('active'); 249 $('#content-wrapper').toggleClass('active'); 250 $('.tt-mobile-block').toggleClass('active'); 251 e.preventDefault(); 252 }); 253 $('.tt-mobile-nav .menu-toggle').on('click', function(e) { 254 $(this).closest('li').addClass('select').siblings('.select').removeClass('select'); 255 $(this).closest('li').siblings('.parent').find('ul').slideUp(); 256 $(this).parent().siblings('ul').slideToggle(); 257 e.preventDefault(); 258 }); 259 260 /*search popup*/ 261 $('.tt-s-popup-btn').on('click', function(e) { 262 $('.tt-s-popup').addClass('open'); 263 e.preventDefault(); 264 }); 265 $('.tt-s-popup-close, .tt-s-popup-layer').on('click', function(e) { 266 $('.tt-s-popup').removeClass('open'); 267 e.preventDefault(); 268 }); 269 270 /*tt-thumb*/ 271 $('.tt-thumb').on('click', function(e) { 272 var img = $(this).attr('href'); 273 $('.tt-thumb-popup-img').attr('src', img); 274 $('.tt-thumb-popup').addClass('active'); 275 e.preventDefault(); 276 }); 277 $('.tt-thumb-popup-close, .tt-thumb-popup-layer').on('click', function(e) { 278 $('.tt-thumb-popup').removeClass('active'); 279 e.preventDefault(); 280 }); 281 282 /*tt-video*/ 283 $(document).on('click', '.tt-video-open', function(e) { 284 e.preventDefault(); 285 var video = $(this).attr('href'); 286 $('.tt-video-popup-container iframe').attr('src', video); 287 $('.tt-video-popup').addClass('active'); 288 289 }); 290 $('.tt-video-popup-close, .tt-video-popup-layer').on('click', function(e) { 291 $('.tt-video-popup').removeClass('active'); 292 $('.tt-video-popup-container iframe').attr('src', 'about:blank') 293 e.preventDefault(); 294 }); 295 296 297 /*==================================================*/ 298 /* 09 - form elements - checkboxes and radiobuttons */ 299 /*==================================================*/ 300 301 //Tabs 302 var tabFinish = 0; 303 $('.tt-nav-tab-item').on('click', function(e) { 304 var $t = $(this); 305 if (tabFinish || $t.hasClass('active')) e.preventDefault(); 306 tabFinish = 1; 307 $t.closest('.tt-nav-tab').find('.tt-nav-tab-item').removeClass('active'); 308 $t.addClass('active'); 309 var index = $t.parent().parent().find('.tt-nav-tab-item').index(this); 310 $t.closest('.tt-tab-wrapper').find('.tt-tab-info:visible').fadeOut(500, function() { 311 $t.closest('.tt-tab-wrapper').find('.tt-tab-info').eq(index).fadeIn(500, function() { 312 tabFinish = 0; 313 }); 314 });
315 }); 316 317 //Tabs 318 var megaFinish = 0; 319 $(".tt-mega-list li").on({ 320 mouseenter: function() { 321 var $t = $(this); 322 if (megaFinish || $t.hasClass('active')) e.preventDefault(); 323 megaFinish = 1; 324 $t.siblings('.active').removeClass('active'); 325 $t.addClass('active'); 326 var index = $t.parent().parent().find('.tt-mega-list li').index(this); 327 $t.closest('.tt-mega-wrapper').find('.tt-mega-entry.active').fadeOut(200, function() { 328 $(this).removeClass('active'); 329 $t.closest('.tt-mega-wrapper').find('.tt-mega-entry').eq(index).fadeIn(200, function() { 330 megaFinish = 0; 331 $(this).addClass('active'); 332 }); 333 }); 334 }, 335 mouseleave: function() {} 336 }); 337 338 function progressBar() { 339 var progressBar = $('.progress-bar'); 340 progressBar.each(function(indx) { 341 $(this).appear(function() { 342 $(this).css('width', $(this).attr('aria-valuenow') + '%'); 343 }); 344 }); 345 346 } 347 348});
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.