1//jQuery(document).ready(function($) { 2 3(function($,window,undefined) { 4 5 // Bootstrap JS 6 function bootstrapJS() { 7 $('[data-toggle="tooltip"]').tooltip() 8 .filter('[data-trigger*="click"]') 9 .on('click', function(e) { 10 e.preventDefault(); 11 }); 12 } 13 14 // mCustomScrollbar JS 15 function detectMobile() { 16 $.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 17 18 if( $.browser.device === false ) { 19 $(".main-navigation").mCustomScrollbar(); 20 } else { 21 $(".main-navigation").mCustomScrollbar("destroy"); 22 } 23 } 24 25 // Target your .container, .wrapper, .post, etc. 26 function fitVidsInit() { 27 $(".post, .hentry, .entry-content, .mejs-video").fitVids(); 28 } 29 30 // Add Dropdown Effect & Slide 31 function subMenuDropDown() { 32 $("<div class='menu-btn-sub-menu'></div>").prependTo('.menu-item-has-children'); 33 34 $(".menu-item-has-children .menu-btn-sub-menu").click(function() { 35 if ($(this).hasClass('sub-menu-expanded')) { 36 $(this).removeClass('sub-menu-expanded'); 37 $(this).next().next().slideUp(); 38 } else { 39 $(this).addClass('sub-menu-expanded'); 40 $(this).next().next().slideDown(); 41 } 42 }); 43 } 44 45 // Add Dropdown Effect & Slide to Widgets 46 function widgetDropdown() { 47 var $widget = $('.site-header .widget:has(ul), .site-header .widget:has(#calendar_wrap), .site-header .widget:has(.tagcloud)'); 48 var $widgetClass = "widget-dropdown-expand"; 49 50 $($widget).addClass('widget-has-dropdown'); 51 $(".widget-has-dropdown").click(function() { 52 if ($(this).hasClass($widgetClass)) { 53 $(this).removeClass($widgetClass); 54 } else { 55 $(this).addClass($widgetClass); 56 } 57 }); 58 } 59 60 function wrapperPosition(){ 61 var $headerHeight = $('#masthead').height(); 62 $('#wrapper').css('padding-top', $headerHeight + 'px'); 63 $('#site-navigation').css('top', $headerHeight + 'px'); 64 } 65 66 function sliderHeight(){ 67 var $headerHeight = $('#masthead').height(), 68 windowHeight = $(window).height(), 69 hentry = $('.page-template-templatestemplate-home-php .flexslider-sticky-post .hentry'); 70 $(hentry).css('padding-top','0px'); 71 $(hentry).css('height', windowHeight - $headerHeight + 'px'); 72 } 73 74 // Mobile Nav Button JS 75 function mobileNavBtn(){ 76 $(".mobile-nav-btn, .mobile-nav-btn-computer").click(function() { 77 if ($('.main-navigation').hasClass('nav-expand')) { 78 $('#wrapper, .main-navigation').removeClass("nav-expand"); 79 $('.site-header').removeClass("widget-expand"); 80 } else { 81 $('#wrapper, .main-navigation').addClass("nav-expand",function(){ 82 wrapperPosition(); 83 }); 84 $('.site-header').removeClass("widget-expand"); 85 } 86 }); 87 } 88 89 // Mobile Widget Button JS 90 function mobileWidgetBtn(){ 91 $(".mobile-widget-btn").click(function() { 92 if ($('.site-header').hasClass('widget-expand')) { 93 $('.site-header').removeClass("widget-expand"); 94 } else { 95 window.scrollTo(0, 0); 96 $('.site-header').addClass("widget-expand"); 97 } 98 }); 99 } 100 101 function stickyHeader() { 102 var $stickyClass = "site-header-sticky", 103 header = $('#masthead'), 104 headerHeight = header.height(), 105 sticky = header.offset(); 106 107 $(window).scroll(function() { 108 if ( $(window).scrollTop() > sticky.top + headerHeight ) { 109 if (!$('body').hasClass($stickyClass)) { 110 $('body').addClass($stickyClass); 111 wrapperPosition(); 112 } 113 } else { 114 $('body').removeClass($stickyClass); 115 wrapperPosition(); 116 } 117 }); 118 } 119 120 function mobileNavInit() { 121 var windowWidth = $(window).width(); 122 123 if( windowWidth < 1000 ) { 124 $(".main-navigation .widget").click(function() { 125 if ($('body').hasClass('nav-expand')) { 126 return; 127 } else { 128 $('body, .main-navigation').addClass('nav-expand'); 129 } 130 }); 131 } 132 } 133 134 // global masonry variables 135 var $masonry_container = $('.blog-grid'); 136 137 // masonry Init 138 function masonryInit() { 139 if ( $masonry_container.length ) { 140 masonryRun(); 141 142 //tell infinite scroll to wait once content is loaded 143 $masonry_container.imagesLoaded(function(){ 144 masonryInfiniteScrollingInit(); 145 }); 146 } 147 } 148 149 // masonry Update 150 function masonryUpdateLayout() { 151 if ( $masonry_container.length ) { 152 $masonry_container.packery(); 153 } 154 } 155 156 // Layout Refresh 157 function layoutRefresh() { 158 masonryUpdateLayout(); 159 } 160 161 // masonry Run 162 function masonryRun() { 163 if ( $masonry_container.length ) { 164 // masonry init 165 $masonry_container.packery({ 166 itemSelector: '.blog-item', 167 }); 168 } 169 } 170 171 // masonry Infinite Scrolling Initialization 172 function masonryInfiniteScrollingInit() { 173 174 $masonry_container.infinitescroll({ 175 navSelector : '#load-more:last', 176 nextSelector : 'a#load-more:last', 177 itemSelector : '.blog-item', 178 debug: false, 179 prefill: true, 180 errorCallback: function(){} 181 }, 182 // trigger masonry as a callback 183 function( newElements ) { 184
185 newElements.forEach(function(e){ 186 $(e).css('opacity', 0); 187 }); 188 189 var $newElems = $( newElements ); 190 infiniteScrollingRefreshComponents(); 191 192 // load images before masonry 193 $newElems.imagesLoaded(function(){ 194 195 $masonry_container.packery('appended', $newElems); 196 197 //refresh all there is to refresh 198 layoutRefresh(); 199 }); 200 }); 201 202 infiniteScrollingOnClick($masonry_container); 203 } 204 205 function infiniteScrollingOnClick($container) { 206 // unbind normal behavior. needs to occur after normal infinite scroll setup. 207 $(window).unbind('.infscr'); 208 209 $('a#load-more').click(function(){ 210 $(this).addClass('loading'); 211 $container.infinitescroll('retrieve'); 212 return false; 213 }); 214 } 215 216 function infiniteScrollingRefreshComponents() { 217 //var $mediacontainer = $('video, audio'); 218 219 //if ( $mediacontainer.length ){ 220 // $mediacontainer.mediaelementplayer(); 221 //} 222 } 223 224 function loadInit() { 225 bootstrapJS(); 226 detectMobile(); 227 fitVidsInit(); 228 mobileNavInit(); 229 widgetDropdown(); 230 subMenuDropDown(); 231 mobileNavBtn(); 232 mobileWidgetBtn(); 233 wrapperPosition(); 234 sliderHeight(); 235 stickyHeader(); 236 masonryInit(); 237 } 238 239 $(document).ready(function(){ 240 loadInit(); 241 }); 242 243 // Fire once loaded 244 $(window).load(function(){ 245 masonryUpdateLayout(); 246 }); 247 248 // Fire resizing 249 $(window).resize(function() { 250 wrapperPosition(); 251 sliderHeight(); 252 }); 253 254})(jQuery, window); 255 256//});
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.