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 18;(function($, window, document, undefined) { 19 20 "use strict"; 21 22 /*================*/ 23 /* 01 - VARIABLES */ 24 /*================*/ 25 var swipers = [], winW, winH, winScr, _isresponsive, smPoint = 768, mdPoint = 992, lgPoint = 1200, addPoint = 1600, _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); 26 27 /*========================*/ 28 /* 02 - page calculations */ 29 /*========================*/ 30 31 $('.simple-article.post-type-link a').each(function(){ 32 if( $(this).find('img').length ) { 33 $(this).addClass('post-linked-a'); 34 } 35 }); 36 37 $('.custom-gallery a').on('click', function(){ 38 openModalPopup($(this)); 39 return false; 40 }); 41 42 $('#scroll-link').on('click', function(){ 43 var hash = $(this).attr('href'); 44 if ( hash != '' ) { 45 if ( $(hash).length ) { 46 $( 'body, html' ).stop().animate({'scrollTop' : $(hash).offset().top-200 },1000); 47 } else { 48 $( 'body, html' ).stop().animate({'scrollTop' : 0 }, 1000); 49 } 50 return false; 51 }; 52 }); 53 54 $('.main-nav > ul > li.menu-item-has-children > a').append('<span class="fa fa-angle-down"></span>'); 55 function menuArrows(){ 56 if( $(window).width() > 991 ) { 57 if( ! $('ul.sub-menu > li.menu-item-has-children > a > .fa-angle-right').length ) { 58 $('ul.sub-menu > li.menu-item-has-children > a').append('<span class="fa fa-angle-right"></span>'); 59 } 60 if( ! $('.ddm li.menu-item-has-children > a > .fa-angle-right').length ) { 61 $('.ddm .fa-angle-down').remove(); 62 $('.ddm li.menu-item-has-children > a').append('<span class="fa fa-angle-right"></span>'); 63 } 64 if( ! $('#menu-right-menu > .menu-item-has-children > a > .fa-angle-down').length ) { 65 $('#menu-right-menu > .menu-item-has-children > a').append('<span class="fa fa-angle-down"></span>'); 66 } 67 } else { 68 $('li.menu-item-has-children > a .fa-angle-right').remove(); 69 if( ! $('#menu-right-menu-1 > .menu-item-has-children > a > .fa-angle-down').length ) { 70 $('#menu-right-menu-1 > .menu-item-has-children > a').append('<span class="fa fa-angle-down"></span>'); 71 } 72 } 73 } 74 75 function footerInstagramGallery() { 76 if( $('#footer_intagram_gallery').length ) { 77 var $item = $('#footer_intagram_gallery'); 78 79 $.ajax({ 80 type: "POST", 81 url: $item.data('url'), 82 data: ({ 83 action: 'ngrblog_instagram_helper', 84 count: $item.data('count'), 85 place: 'footer-gallery' 86 }), 87 success: function(msg) { 88 $item.html(msg); 89 initSwiper(); 90 } 91 }); 92 93 } 94 if( $('.widget_intagram_gallery').length ) { 95 $('.widget_intagram_gallery').each(function(){ 96 var $widget = $(this); 97 $.ajax({
98 type: "POST", 99 url: $widget.data('url'), 100 data: ({ 101 action: 'ngrblog_instagram_helper', 102 count: $widget.data('count'), 103 place: 'widget-gallery' 104 }), 105 success: function(msg) { 106 $widget.html(msg); 107 } 108 }); 109 }); 110 } 111 } 112 113 function pageCalculations(){ 114 winW = $(window).width(); 115 winH = $(window).height(); 116 if($('.menu-button').is(':visible')) _isresponsive = true; 117 else _isresponsive = false; 118 headerSticky(); 119 if ( $("header").height() > winH ) { 120 $("header").addClass("absolute"); 121 } 122 else{$("header").removeClass("absolute")} 123 } 124 125 function headerPosition() { 126 if( $('body.admin-bar').length ) { 127 if ( $(window).width() < 601 ) { 128 if ( $(window).scrollTop() < 47 ) { 129 $('header').css({'top':46 - $(window).scrollTop()}) 130 $('#content-wrapper').css({'margin-top':46 - $(window).scrollTop()}) 131 } else { 132 $('header').css({'top': 0}) 133 $('#content-wrapper').css({'margin-top':0 - $(window).scrollTop()}) 134 } 135 } 136 } 137 } 138 139 140 /*=================================*/ 141 /* 03 - function on document ready */ 142 /*=================================*/ 143 pageCalculations(); 144 145 //center all images inside containers 146 $('.center-image').each(function(){ 147 var bgSrc = $(this).attr('src'); 148 $(this).parent().addClass('background-block').css({'background-image':'url('+bgSrc+')'}); 149 $(this).hide(); 150 }); 151 152 /*============================*/ 153 /* 04 - function on page load */ 154 /*============================*/ 155 $(window).scroll(function(){ 156 headerPosition(); 157 }); 158 159 $(window).resize(function(){ 160 menuArrows(); 161 headerPosition(); 162 videoSize(); 163 }); 164 165 $(window).load(function(){ 166 menuArrows(); 167 headerPosition(); 168 videoSize(); 169 $('#loader-wrapper').fadeOut(); 170 initSwiper(); 171 $('.isotope-grid').isotope({ 172 itemSelector: '.isotope-item', 173 percentPosition: true, 174 masonry:{gutter:0,columnWidth:'.grid-sizer'} 175 }); 176 setBG(); 177 footerInstagramGallery(); 178 }); 179 180 function setBG(){ 181 if( $(".blur-slider").length && winW > 992){ 182 changeBG(); 183 } 184 } 185 186 function videoSize() { 187 if( $('.simple-article iframe[allowfullscreen]' ) ) { 188 var $width = $('.simple-article iframe[allowfullscreen]' ).width(); 189 $('.simple-article iframe[allowfullscreen]' ).css('max-height', $width * 0.55 ); 190 } 191 } 192 193 function changeBG(){ 194 if( $(".blur-slider").length && winW > 992){ 195 $(".blur-bg").removeClass("show"); 196 var index = $(".swiper-slide-active").index(); 197 $(".blur-bg").eq(index-1).addClass("show"); 198 } 199 } 200 201 /*==============================*/ 202 /* 05 - function on page resize */ 203 /*==============================*/ 204 function resizeCall(){ 205 pageCalculations(); 206 207 $('.swiper-container.initialized[data-slides-per-view="responsive"]').each(function(){ 208 var thisSwiper = swipers['swiper-'+$(this).attr('id')], $t = $(this), slidesPerViewVar = updateSlidesPerView($t); 209 thisSwiper.params.slidesPerView = slidesPerViewVar; 210 thisSwiper.reInit(); 211 var paginationSpan = $t.find('.pagination span'); 212 var paginationSlice = paginationSpan.hide().slice(0,(paginationSpan.length+1-slidesPerViewVar)); 213 if(paginationSlice.length<=1 || slidesPerViewVar>=$t.find('.swiper-slide').length) $t.addClass('pagination-hidden'); 214 else $t.removeClass('pagination-hidden'); 215 paginationSlice.show(); 216 }); 217 } 218 if(!_ismobile){ 219 $(window).resize(function(){ 220 resizeCall(); 221 initSwiper(); 222 }); 223 } else{ 224 window.addEventListener("orientationchange", function() { 225 resizeCall(); 226 }, false); 227 } 228 229 var footerTop, WindowTop,footerHeight; 230 function headerSticky(){ 231 if( $(".header.style-1 .footer.style-2").length || $(".header.style-1 .footer.style-3").length ){ 232 if(winW > 992) { 233 footerTop = $(".footer").offset().top; 234 WindowTop = $(window).scrollTop() 235 footerHeight = $(".footer").height(); 236 if(WindowTop + winH + 96> footerTop && $("header").height() < winH){ 237 $("body").addClass("absolute-header"); 238 $(".absolute-header header").css({"bottom":$(document).height() - footerTop + 96 + "px"}); 239 } 240 else{ 241 $(".absolute-header").removeClass("absolute-header"); 242 } 243 } 244 } 245 } 246 247 248 $(window).on("scroll",function(){ 249 headerSticky(); 250 }); 251 252 /*=====================*/ 253 /* 07 - swiper sliders */ 254 /*=====================*/ 255 var initIterator = 0; 256 function initSwiper(){ 257 $('.swiper-container:not(.initialized)').each(function(){ 258 var $t = $(this); 259 260 var index = 'swiper-unique-id-'+initIterator; 261 262 $t.addClass('swiper-'+index + ' initialized').attr('id', index); 263 $t.find('.pagination').addClass('pagination-'+index); 264 265 var autoPlayVar = parseInt($t.attr('data-autoplay'),10); 266 var centerVar = parseInt($t.attr('data-center'),10);
267 var simVar = ($t.closest('.circle-description-slide-box').length)?false:true; 268 269 var slidesPerViewVar = $t.attr('data-slides-per-view'); 270 if(slidesPerViewVar == 'responsive'){ 271 slidesPerViewVar = updateSlidesPerView($t); 272 } 273 else if(slidesPerViewVar != 'auto') slidesPerViewVar = parseInt(slidesPerViewVar,10); 274 275 var loopVar = parseInt($t.attr('data-loop'),10); 276 var speedVar = parseInt($t.attr('data-speed'),10); 277 278 var slidesPerGroup = parseInt($t.attr('data-slides-per-group'),10); 279 if(!slidesPerGroup){slidesPerGroup=1;} 280 281 swipers['swiper-'+index] = new Swiper('.swiper-'+index,{ 282 speed: speedVar, 283 pagination: '.pagination-'+index, 284 loop: loopVar, 285 paginationClickable: true, 286 autoplay: autoPlayVar, 287 slidesPerView: slidesPerViewVar, 288 slidesPerGroup: slidesPerGroup, 289 keyboardControl: true, 290 calculateHeight: true, 291 simulateTouch: simVar, 292 centeredSlides: centerVar, 293 roundLengths: true, 294 onInit: function(swiper){ 295 var browserWidthResize = $(window).width(); 296 if (browserWidthResize < 750) { 297 swiper.params.slidesPerGroup=1; 298 } else { 299 swiper.params.slidesPerGroup=slidesPerGroup; 300 } 301 }, 302 onResize: function(swiper){ 303 var browserWidthResize2 = $(window).width(); 304 if (browserWidthResize2 < 750) { 305 swiper.params.slidesPerGroup=1; 306 } else { 307 swiper.params.slidesPerGroup=slidesPerGroup; 308 swiper.resizeFix(true); 309 } 310 }, 311 onSlideChangeEnd: function(swiper){ 312 var activeIndex = (loopVar===true)?swiper.activeLoopIndex:swiper.activeIndex; 313 var qVal = $t.find('.swiper-slide-active').attr('data-val'); 314 $t.find('.swiper-slide[data-val="'+qVal+'"]').addClass('active'); 315 }, 316 onSlideChangeStart: function(swiper){ 317 $t.find('.swiper-slide.active').removeClass('active'); 318 changeBG(); 319 if($t.hasClass('thumbnails-preview')){ 320 var activeIndex = (loopVar===1)?swiper.activeLoopIndex:swiper.activeIndex; 321 swipers['swiper-'+$t.prev().attr('id')].swipeTo(activeIndex); 322 $t.prev().find('.current').removeClass('current'); 323 $t.prev().find('.swiper-slide[data-val="'+activeIndex+'"]').addClass('current'); 324 } 325 }, 326 onSlideClick: function(swiper){ 327 var thisSlide = $(swiper.clickedSlide); 328 if(thisSlide.hasClass('open-modal-popup')) openModalPopup(thisSlide); 329 if($t.hasClass('thumbnails')) { 330 swipers['swiper-'+$t.next().attr('id')].swipeTo(swiper.clickedSlideIndex); 331 } 332 } 333 }); 334 swipers['swiper-'+index].reInit(); 335 if($t.attr('data-slides-per-view')=='responsive'){ 336 var paginationSpan = $t.find('.pagination span'); 337 var paginationSlice = paginationSpan.hide().slice(0,(paginationSpan.length+1-slidesPerViewVar)); 338 if(paginationSlice.length<=1 || slidesPerViewVar>=$t.find('.swiper-slide').length) $t.addClass('pagination-hidden'); 339 else $t.removeClass('pagination-hidden'); 340 paginationSlice.show(); 341 } 342 initIterator++; 343 }); 344 345 } 346 347 function updateSlidesPerView(swiperContainer){ 348 if(winW>=addPoint) return parseInt(swiperContainer.attr('data-add-slides'),10); 349 else if(winW>=lgPoint) return parseInt(swiperContainer.attr('data-lg-slides'),10); 350 else if(winW>=mdPoint) return parseInt(swiperContainer.attr('data-md-slides'),10); 351 else if(winW>=smPoint) return parseInt(swiperContainer.attr('data-sm-slides'),10); 352 else return parseInt(swiperContainer.attr('data-xs-slides'),10); 353 } 354 355 //swiper arrows 356 $('.swiper-arrow-left').on("click",function(){ 357 swipers['swiper-'+$(this).parent().attr('id')].swipePrev(); 358 }); 359 360 $('.swiper-arrow-right').on("click",function(){ 361 swipers['swiper-'+$(this).parent().attr('id')].swipeNext(); 362 }); 363 364 /*==============================*/ 365 /* 08 - buttons, clicks, hovers */ 366 /*==============================*/ 367 // top menu 368 $(".cmn-toggle-switch").on("click", function(){ 369 $(this).toggleClass("active"); 370 $('.nav-container').stop().slideToggle(); 371 return false; 372 }); 373 374 $(".small-menu-btn").on("click",function(){ 375 $(this).toggleClass("active"); 376 $(".sub-nav").stop().slideToggle(); 377 return false; 378 }); 379 380 //modal popup 381 $('.footer-slider a').on('click', function(){ 382 var src = $(this).find("img").attr("src"); 383 $('.modal-popup img').attr("src",src); 384 $('.modal-popup').addClass('active'); 385 386 return false; 387 }); 388 /*photo viewer popup*/ 389 function openModalPopup(foo){ 390 var src = foo.attr("data-src"); 391 $('.modal-popup img').attr("src",src); 392 $('.modal-popup').addClass('active'); 393 } 394 395 $(".footer-slider").on("click",function(){ 396 return false; 397 }) 398 //close modal popup
399 $('.modal-popup .close-button, .modal-popup .close-layer').on('click', function(){ 400 $('.modal-popup.active').removeClass('active'); 401 }); 402 /*open popups buttons*/ 403 $("header .h-search").on("click",function(){ 404 $(".search-popup").addClass("opened"); 405 $(".popup-bg").addClass("opened"); 406 }); 407 $(".video-play").on("click",function(){ 408 var src = $(this).attr("data-src"); 409 $(".video-popup iframe").attr("src",src); 410 setTimeout(function(){ $(".video-popup").addClass("opened");} 411 , 700); 412 $(".popup-bg").addClass("opened"); 413 return false; 414 }); 415 /*close popups buttons*/ 416 $(".popup .close").on("click",function(){ 417 $(".popup").removeClass("opened"); 418 }); 419 $(".header.style-4 .small-menu-btn").on("click",function(){ 420 $(".main-nav").stop().slideToggle(); 421 }); 422 $(".popup-bg").on("click",function(){ 423 $(".popup").removeClass("opened"); 424 }) ; 425 426 $('nav > ul > li > a').on('click', 'span', function(){ 427 if ( $(this).parent().parent().find('.sub-menu').hasClass('slide') ) { 428 $(this).parent().parent().find('.sub-menu').removeClass('slide'); 429 } else { 430 $('.sub-menu').removeClass('slide'); 431 $(this).parent().parent().find('.sub-menu').addClass('slide'); 432 } 433 return false 434 }); 435 436 $('.subscribe-form').submit(function() { 437 var $this = $(this); 438 var url = $this.data('url'); 439 var email = $this.find('input[name="email"]').val(); 440 var code_nonce = $this.find('input[name="code_nonce"]').val(); 441 var submit = $this.find('input[type="submit"]').val(); 442 443 $this.find('input[type="submit"]').val('Loading...'); 444 445 $.ajax({ 446 type: "POST", 447 url: url, 448 data: ({ 449 action: 'nrgblog_subscribe_user', 450 email: email, 451 code_nonce: code_nonce 452 }), 453 success: function(msg) { 454 $this.find('.msg').html(msg); 455 $this.find('input[type="submit"]').val( submit ); 456 } 457 }); 458 return false; 459 }); 460 461 $('.like-it').on('click', function() { 462 var $this = $(this); 463 var id = $this.data('post'); 464 var url = $this.data('url'); 465 $.ajax({ 466 type: "POST", 467 url: url, 468 data: ({ 469 action: 'nrgblog_post_like', 470 id: id 471 }), 472 success: function(msg) { 473 $this.html( msg ); 474 } 475 }); 476 477 return false; 478 }); 479 480})(jQuery, window, document);
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.