1/** 2* isMobile 3* themesflatSearch 4* responsiveMenu 5* detectViewport 6* blog_slider 7* portfolioLoadMore 8* portfolioSingle 9* blogLoadMore 10* goTop 11* removePreloader 12*/ 13 14;(function($) { 15 16 'use strict' 17 18 var isMobile = { 19 Android: function() { 20 return navigator.userAgent.match(/Android/i); 21 }, 22 BlackBerry: function() { 23 return navigator.userAgent.match(/BlackBerry/i); 24 }, 25 iOS: function() { 26 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 27 }, 28 Opera: function() { 29 return navigator.userAgent.match(/Opera Mini/i); 30 }, 31 Windows: function() { 32 return navigator.userAgent.match(/IEMobile/i); 33 }, 34 any: function() { 35 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 36 } 37 }; 38 39 var headerFixed = function() { 40 if ( $('body').hasClass('header_sticky') ) { 41 var top_height = $('.themesflat-top').height(), 42 hd_height = $('#header').height(), 43 injectSpace = $('<div />', { height: hd_height }).insertAfter($('#header')); 44 injectSpace.hide(); 45 $(window).on('load scroll resize', function() { 46 var header = $("#header"); 47 var offset = 0; 48 if (typeof(header.data('offset')) != 'undefined') { 49 offset = header.data('offset'); 50 } 51 var $top = $(window).scrollTop() + header.height() + header.position().top + offset; 52 if (typeof($('#wpadminbar')) != 'undefined' && matchMedia( 'only screen and (min-width: 601px)' ).matches) { 53 $('.header.header-sticky').css('top',$('#wpadminbar').height()); 54 } 55 else { 56 $('.header.header-sticky').css('top',0); 57 } 58 if ( $(window).scrollTop() >= top_height + hd_height + 20 ) { 59 header.addClass('header-sticky'); 60 injectSpace.show(); 61 } else { 62 header.removeClass('header-sticky'); 63 injectSpace.hide(); 64 } 65 }) 66 67 } 68 } 69 70 var themesflatSearch = function () { 71 $(document).on('click', function(e) { 72 var clickID = e.target.id; 73 if ( ( clickID != 's' ) ) { 74 $('.top-search').removeClass('show'); 75 $('.show-search').removeClass('active'); 76 } 77 }); 78 79 $('.show-search').on('click', function(event){ 80 event.stopPropagation(); 81 }); 82 83 $('.search-form').on('click', function(event){ 84 event.stopPropagation(); 85 }); 86 87 $('.show-search').on('click', function (e) { 88 if( !$( this ).hasClass( "active" ) ) 89 $( this ).addClass( 'active' ); 90 else 91 $( this ).removeClass( 'active' ); 92 e.preventDefault(); 93 94 if( !$('.top-search' ).hasClass( "show" ) ) 95 $( '.top-search' ).addClass( 'show' ); 96 else 97 $( '.top-search' ).removeClass( 'show' ); 98 }); 99 } 100 101 var responsiveMenu = function() { 102 var menuType = 'desktop'; 103 104 $(window).on('load resize', function() { 105 var currMenuType = 'desktop'; 106 107 if ( matchMedia( 'only screen and (max-width: 991px)' ).matches ) { 108 currMenuType = 'mobile'; 109 } 110 111 if ( currMenuType !== menuType ) { 112 menuType = currMenuType; 113 114 if ( currMenuType === 'mobile' ) { 115 var $mobileMenu = $('#mainnav').attr('id', 'mainnav-mobi').hide(); 116 var hasChildMenu = $('#mainnav-mobi').find('li:has(ul)'); 117 118 $('#header .nav').after($mobileMenu); 119 hasChildMenu.children('ul').hide(); 120 if (hasChildMenu.find(">span").length == 0) { 121 hasChildMenu.children('a').after('<span class="btn-submenu"></span>'); 122 } 123 $('.btn-menu').removeClass('active'); 124 } else { 125 var $desktopMenu = $('#mainnav-mobi').attr('id', 'mainnav').removeAttr('style'); 126 $desktopMenu.find('.sub-menu').removeAttr('style'); 127 $('#header').find('.nav-wrap').append($desktopMenu); 128 129 } 130 } 131 }); 132 133 $('.btn-menu').on('click', function() { 134 var header = $("#header"); 135 var offset = 0; 136 if (typeof(header.data('offset')) != 'undefined') { 137 offset = header.data('offset'); 138 } 139 140 var $top = $(window).scrollTop() + header.height() + header.position().top + offset; 141 $('#mainnav-mobi').slideToggle(300); 142 $(this).toggleClass('active'); 143 }); 144 145 $(document).on('click', '#mainnav-mobi li .btn-submenu', function(e) { 146 $(this).toggleClass('active').next('ul').slideToggle(300); 147 e.stopImmediatePropagation() 148 }); 149 } 150 151 var detectViewport = function() { 152 $('[data-waypoint-active="yes"]').waypoint(function() { 153 $(this).trigger('on-appear'); 154 }, { offset: '90%', triggerOnce: true });
155 }; 156 157 var blog_slider = function() { 158 if ( $().flexslider ) { 159 $('.featured-post.blog-slider').flexslider({ 160 animation : "slide", 161 direction : "horizontal", // vertical 162 pauseOnHover : true, 163 useCSS : false, 164 animationLoop : false, 165 easing : "swing", 166 animationSpeed : 500, 167 slideshowSpeed : 5000, 168 controlNav : false, 169 directionNav : true, 170 slideshow : true, 171 prevText : '<i class="fa fa-angle-left"></i>', 172 nextText : '<i class="fa fa-angle-right"></i>', 173 smoothHeight : true 174 }); // flexslider 175 } 176 }; 177 178 var portfolioLoadMore = function() { 179 var $container = $('.portfolio-container') 180 var $nav = ".navigation.portfolio.loadmore a"; 181 $($nav).on('click', function(e) { 182 e.preventDefault(); 183 $('<span/>', { 184 class: 'infscr-loading', 185 text: 'Loading...', 186 }).appendTo($container); 187 188 $.ajax({
189 type: "GET", 190 url: $(this).attr('href'), 191 dataType: "html", 192 success: function( out ) { 193 var result = $(out).find('.portfolio-container .item'); 194 var nextlink = $(out).find($nav).attr('href'); 195 result.css({ opacity: 0 }); 196 $container.append(result).imagesLoaded(function () { 197 result.css({ opacity: 1 }); 198 $container.isotope('appended', result); 199 }); 200 if ( nextlink != undefined && result != undefined) { 201 $($nav).attr('href', nextlink); 202 $container.find('.infscr-loading').remove(); 203 } else { 204 $container.find('.infscr-loading').addClass('no-ajax').text('All posts loaded.').delay(2000).queue(function() {$(this).remove();}); 205 $($nav).remove(); 206 } 207 }, 208 error: function() { 209 $container.find('.infscr-loading').addClass('no-ajax').text('All posts loaded.').delay(2000).queue(function() {$(this).remove();}); 210 $($nav).remove(); 211 } 212 }) 213 }) 214 } 215 216 var portfolioSingle = function() { 217 $('.themesflat-portfolio-single-slider').each(function(){ 218 $(this).children('#themesflat-portfolio-carousel').flexslider({ 219 animation: "slide", 220 controlNav: false, 221 directionNav: true, 222 animationLoop: false, 223 slideshow: true, 224 itemWidth: 277, 225 itemMargin: 30, 226 asNavFor: $(this).children('#themesflat-portfolio-flexslider'), 227 prevText: '<i class="fa fa-angle-left"></i>', 228 nextText: '<i class="fa fa-angle-right"></i>' 229 }); 230 $(this).children('#themesflat-portfolio-flexslider').flexslider({ 231 animation: "slide", 232 controlNav: false, 233 animationLoop: true, 234 slideshow: true, 235 sync: $(this).children('#themesflat-portfolio-carousel'), 236 prevText: '<i class="fa fa-angle-left"></i>', 237 nextText: '<i class="fa fa-angle-right"></i>' 238 }); 239 }); 240 }; 241 242 var blogLoadMore = function() { 243 var $container = $('.post-wrap'), 244 $container_faq = $('.themesflat-faq-shortcodes'); 245 if ( $('body').hasClass('page-template') ) { 246 var $container = $('.blog-shortcode'); 247 } 248 249 $('.navigation.loadmore a').on('click', function(e) { 250 e.preventDefault(); 251 var $item = 'article'; 252 if ($(this).parents('nav').hasClass("faq")) { 253 $container = $container_faq; 254 $item = '.item'; 255 } 256 257 $('<span/>', { 258 class: 'infscr-loading', 259 text: 'Loading...', 260 }).appendTo($container); 261 262 $.ajax({
263 type: "GET", 264 url: $(this).attr('href'), 265 dataType: "html", 266 success: function( out ) { 267 var result = $(out).find($item); 268 var nextlink = $(out).find('.navigation.loadmore a').attr('href'); 269 270 result.css({ opacity: 0 }); 271 if ($container.hasClass('masonry')) { 272 $container.append(result).imagesLoaded(function () { 273 result.css({ opacity: 1 }); 274 $container.isotope('appended', result); 275 }); 276 } 277 else { 278 result.css({ opacity: 1 }); 279 $container.append(result); 280 } 281 282 if ( nextlink != undefined ) { 283 $('.navigation.loadmore a').attr('href', nextlink); 284 $container.find('.infscr-loading').remove(); 285 } else { 286 $container.find('.infscr-loading').addClass('no-ajax').text('All posts loaded.').delay(2000).queue(function() {$(this).remove();}); 287 $('.navigation.loadmore a').remove(); 288 } 289 } 290 }) 291 }) 292 } 293 294 var testimonialsServices = function() { 295 $('.testimonials-sidebar').each(function() { 296 if ( $().owlCarousel ) { 297 $('.testimonial03').owlCarousel({ 298 loop: true, 299 margin: 0, 300 nav: false, 301 dots: true, 302 autoplay: false, 303 responsive:{ 304 0:{ 305 items: 1 306 }, 307 480:{ 308 items: 1 309 }, 310 767:{ 311 items: 1 312 }, 313 991:{ 314 items: 1 315 }, 316 1200: { 317 items: 1 318 } 319 } 320 }); 321 } 322 }); 323 }; 324 325 var goTop = function() { 326 $(window).scroll(function() { 327 if ( $(this).scrollTop() > 800 ) { 328 $('.go-top').addClass('show'); 329 } else { 330 $('.go-top').removeClass('show'); 331 } 332 }); 333 334 $('.go-top').on('click', function() { 335 $("html, body").animate({ scrollTop: 0 }, 1000 , 'easeInOutExpo'); 336 return false; 337 }); 338 }; 339 340 var logo = function() { 341 // Elements to inject 342 var mySVGsToInject = document.querySelectorAll('img.logo_svg'); 343 344 // Trigger the injection 345 SVGInjector(mySVGsToInject, { 346 pngFallback: 'assets/png' 347 }); 348 } 349 350// Retina Logos 351var retinaLogos = function() { 352 var retina = window.devicePixelRatio > 1 ? true : false; 353 var img_retina = $('.logo .site-logo').data('retina'); 354 if( retina ) { 355 $('#logo').find('img').attr({src:img_retina,width:'175',height:'50'}); 356 } 357}; 358 359var removePreloader = function() { 360 $('.preloader').css('opacity', 0); 361 setTimeout(function() { 362 $('.preloader').hide(); }, 1000 363 ); 364}; 365 366 367// Dom Ready 368$(function() { 369 responsiveMenu(); 370 headerFixed(); 371 blog_slider(); 372 goTop(); 373 logo(); 374 blogLoadMore(); 375 portfolioLoadMore(); 376 portfolioSingle(); 377 themesflatSearch(); 378 detectViewport(); 379 testimonialsServices(); 380 retinaLogos(); 381 removePreloader(); 382}); 383})(jQuery);
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.