1(function($) { 2 "use strict"; 3 4 $(document).ready(function() { 5 6 $('.post').fitVids(); 7 8 // Close the featured post drawer if it's open 9 function closeDrawer() { 10 $('.category-drawer').removeClass('drawer-open'); 11 $('.browse-toggle').removeClass('browse-active'); 12 $('html').removeClass('no-scroll'); 13 } 14 15 // Close the menu if it's open 16 function closeMenu() { 17 $('html').removeClass('slideout-open'); 18 $('.menu-toggle').removeClass('menu-active'); 19 } 20 21 // Menu toggle 22 $('.menu-toggle').click(function(e) { 23 closeDrawer(); 24 $('html').toggleClass('slideout-open'); 25 $(this).toggleClass('menu-active'); 26 return false; 27 }); 28 29 // Post drawer toggle 30 $('.browse-toggle').click(function(e) { 31 closeMenu(); 32 $('.category-drawer').toggleClass('drawer-open'); 33 $(this).toggleClass('browse-active'); 34 $('html').toggleClass('no-scroll'); 35 return false; 36 }); 37 38 // Close the drawer with the escape key 39 $(window).keydown(function(e){ 40 if (e.keyCode == 27) { 41 closeDrawer(); 42 closeMenu(); 43 } 44 }); 45 46 // Close the drawer on body click 47 $('html').click(function() { 48 closeDrawer(); 49 closeMenu(); 50 }); 51 52 // Allow clicking in the drawer when it's open 53 $('.category-drawer,.slideout-menu').click(function(event){ 54 event.stopPropagation(); 55 }); 56 57 // Remove fancy underline from linked images 58 $('.entry-content img').each(function() { 59 $(this).parent().addClass('no-underline'); 60 }); 61 62 63 // Standardize drop menu types 64 $('.sidebar-navigation .children').addClass('sub-menu'); 65 $('.sidebar-navigation .page_item_has_children').addClass('menu-item-has-children'); 66 67 // Append a clickable icon to mobile drop menus 68 var item = $('<span class="toggle-sub"><i class="fa fa-angle-down"></i></span>'); 69 $('.slideout-menu .menu-item-has-children,.slideout-menu .page_item_has_children').prepend(item); 70 71 // Change the icon to angle up on toggle 72 $('.slideout-menu .toggle-sub').click(function() { 73 $(this).find('i').toggleClass('fa-angle-down').toggleClass('fa-angle-up'); 74 var dropopen = $(this).closest('.menu-item-has-children').toggleClass('drop-open'); 75 }); 76 77 78 // Headroom fixed nav bar 79 $('.fixed-nav').headroom({ 80 offset : 200, 81 tolerance : 10 82 }); 83 84 85 // Fade in the images as they load 86 function fade_images() { 87 $('.gallery-wrapper .gallery-thumb').each(function(i) { 88 var row = $(this); 89 setTimeout(function() { 90 row.addClass('fadeInUp'); 91 }, 90*i) 92 }); 93 } 94 95 96 // Masonry blocks 97 var $blocks = $('.two-column .gallery-wrapper,.three-column .gallery-wrapper'); 98 99 $blocks.imagesLoaded( function() { 100 $blocks.masonry({ 101 itemSelector: 'body:not(.one-column) .post', 102 transitionDuration: 0 103 }); 104 105 // Fade blocks in after images are ready 106 fade_images(); 107 }); 108 109 110 // Resize masonry blocks on window resize 111 $(window).resize(function() { 112 $blocks.masonry(); 113 }); 114 115 116 // Layout posts that arrive via infinite scroll 117 $(document.body ).on('post-load', function() { 118 var $newItems = $('.new-infinite-posts').not('.is--replaced'); 119 var $elements = $newItems.find('.post'); 120 $elements.hide(); 121 $blocks.append($elements); 122 123 $blocks.imagesLoaded( function() { 124 $blocks.masonry('appended', $elements, true ).masonry('reloadItems').masonry('layout'); 125 $elements.show(); 126 fade_images(); 127 $('#infinite-handle').show(); 128 }); 129 }); 130 131 132 // Add padding to footer to smooth out infinite scroll 133 $('body').on('click', '#infinite-handle', function() { 134 $('.site-footer').addClass('footer-padding').delay(1500).queue(function(){ 135 $(this).removeClass('footer-padding').dequeue(); 136 }); 137 }); 138 139 140 // Show the initial IS handle 141 $('#infinite-handle').show(); 142 143 144 // Fade out the featured post container while loading 145 $('.sort-list a').click(function(e) { 146 $('.post-container').addClass('post-loading'); 147 }); 148 149 150 // Close the sort list to show posts on mobile 151 $(window).on('load', function() { 152 var current_width = $(window).width(); 153 154 // If width is below iPad size 155 if (current_width < 769) { 156 $('.sort-list a').click(function(e) { 157 setTimeout(function() { 158 $('.sort-list').slideUp(); 159 }, 400) 160 }); 161 } 162 }); 163 164 165 // Sort list toggle 166 $('.sort-list-toggle').click(function(e) { 167 $('.sort-list').slideToggle(); 168 return false;
169 }); 170 171 172 // Fetch ajax posts for category menu in the header 173 var header_drawer = $('#category-menu a'); 174 175 header_drawer.click(function (event) { 176 177 var cat_link = $(this).attr('data-object-id'); 178 179 if (typeof cat_link !== typeof undefined && cat_link !== false) { 180 181 event.preventDefault(); 182 183 var id = $(this).attr('data-object-id'); 184 var container = $('.header-drawer .post-container'); 185 var catHeader = $('.header-drawer .featured-header-category'); 186 187 var data = { 188 action: 'baseline_category', 189 id: id 190 } 191 192 // Fade out the featured post container while loading 193 $('.header-drawer .post-container').addClass('post-loading'); 194 195 $.ajax({ 196 data: data, 197 type: "POST", 198 dataType: "json", 199 url: baseline_js_vars.ajaxurl, 200 success: function(response) { 201 container.html(response.html); 202 catHeader.html(response.term_html); 203 $('.post-container').removeClass('post-loading'); 204 }, 205 error: function(response) { 206 container.html(response.html); 207 } 208 }); 209 210 $(this).parent().siblings().removeClass('current-menu-item'); 211 $(this).parent().addClass('current-menu-item'); 212 } 213 }); 214 215 216 // Fetch ajax posts for footer category menu in the footer 217 var footer_drawer = $('#footer-category-menu a'); 218 219 footer_drawer.click(function (event) { 220 221 var cat_link = $(this).attr('data-object-id'); 222 223 if (typeof cat_link !== typeof undefined && cat_link !== false) { 224 225 event.preventDefault(); 226 227 var id = $(this).attr('data-object-id'); 228 var container = $('.footer-drawer .post-container'); 229 var catHeader = $('.footer-drawer .featured-header-category'); 230 231 var data = { 232 action: 'baseline_category', 233 id: id 234 } 235 236 // Fade out the featured post container while loading 237 $('.footer-drawer .post-container').addClass('post-loading'); 238 239 $.ajax({ 240 data: data, 241 type: "POST", 242 dataType: "json", 243 url: baseline_js_vars.ajaxurl, 244 success: function(response) { 245 container.html(response.html); 246 catHeader.html(response.term_html); 247 $('.post-container').removeClass('post-loading'); 248 }, 249 error: function(response) { 250 container.html(response.html); 251 } 252 }); 253 254 $(this).parent().siblings().removeClass('current-menu-item'); 255 $(this).parent().addClass('current-menu-item'); 256 } 257 }); 258 259 260 // Click the first category link to use as a placeholder 261 $('.sort-list li:first-child a').click(); 262 263 264 // Initialize responsive slides 265 var $slides = $('.featured-content .featured-slides'); 266 $slides.responsiveSlides({ 267 auto: false, 268 speed: 200, 269 nav: true, 270 navContainer: ".slide-navs", 271 pager: true, 272 manualControls: "#pager-navs" 273 }); 274 275 276 // Next ResponsiveSlide 277 $('.arrow-link.prev').click(function(e) { 278 $(this).closest('.featured-content').find('.rslides_nav.prev').click(); 279 }); 280 281 // Next ResponsiveSlide 282 $('.arrow-link.next').click(function(e) { 283 $(this).closest('.featured-content').find('.rslides_nav.next').click(); 284 }); 285 286 287 // Allow clicking anywhere in post nav to navigate 288 $('.nav-post').click(function() { 289 window.location = $(this).find('a').attr('href'); 290 return false; 291 }); 292 }); 293 294})(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.