1/** 2 * global.js 3 * 4 * General JavaScript used throughout the theme. 5 * 6 */ 7 8( function( $ ) { 9 10 /** 11 * 12 * Slideshow magic! 13 * 14 */ 15 16 var $slideCount = $(".slides").find("li").length; 17 18 $( '#featured-slideshow .wrap .slideshow' ).flexslider( { 19 animation: 'slide', 20 directionNav: false, 21 } ); 22 23 /* wrapping the dot nav in a div, and sticking the prev/next links in there for placement */ 24 $( '.flex-control-nav' ).wrap( '<div class="slideshow-navigation"></div>' ); 25 26 // make sure there's more than one slide before appending prev/next links 27 if ( $slideCount > 1 ) { 28 $( '.slideshow-navigation' ).append( '<span class="next-slide"><span class="screen-reader-text">' + toujours_script_strings.next_link + '</span></span>' ); 29 $( '.slideshow-navigation' ).prepend( '<span class="prev-slide"><span class="screen-reader-text">' + toujours_script_strings.previous_link + '</span></span>' ); 30 31 /* ... then add some click events to those new buttons */ 32 $( 'body' ).on( 'click', '.prev-slide', function() { 33 $('#featured-slideshow .wrap .slideshow').flexslider('prev'); 34 } ); 35 36 $( 'body' ).on( 'click', '.next-slide', function() { 37 $('#featured-slideshow .wrap .slideshow').flexslider('next'); 38 } ); 39 } 40 41 /* Make it possible to click the whole slide to get ot the post */ 42 $( '.slide' ).each( function() { 43 // make sure the page isn't loaded in an iframe, like in the Customizer 44 if ( self == top ) { 45 var $link = $( '.posted-on a', this ).attr( 'href' ); 46 $( this ).css( 'cursor', 'pointer' ).click( function(){ 47 window.location = $link; 48 }); 49 } 50 } ); 51 /** 52 * Search 53 * Adding some JS so the faux button has a hover state 54 */ 55 $( '.search-submit' ).mouseenter( function() { 56 $( this ).parent().addClass( 'hover-button' ); 57 } ).mouseleave( function() { 58 $( this ).parent().removeClass( 'hover-button' ); 59 } ); 60 61 /** 62 * Masonry for footer widgets 63 */ 64 65 var ltr = true; 66 if ( $( 'html' ).attr( 'dir' ) == 'rtl') { 67 ltr = false;
68 } 69 70 function footerMasonry() { 71 var $footerContainer = $( '#footer-widgets .grid-layout' ); 72 $footerContainer.imagesLoaded( function() { 73 $footerContainer.masonry( { 74 itemSelector: '.widget', 75 columnWidth: '#footer-widgets aside', 76 isOriginLeft: ltr, 77 gutter: 30, 78 } ); 79 } ); 80 } 81 82 /** 83 * Masonry for Guestbook template 84 */ 85 function guestbookMasonry() { 86 var $guestbookContainer = $( '.page-template-guestbook #comments .comment-list'); 87 $guestbookContainer.imagesLoaded( function() { 88 $guestbookContainer.masonry( { 89 itemSelector: '.comment', 90 isOriginLeft: ltr, 91 gutter: 30, 92 } ); 93 } ); 94 } 95 96 /** 97 * Add class to tables to help make them responsive 98 */ 99 $( 'table' ).addClass( 'table' ); 100 $( 'table' ).wrap( '<div class="table-responsive" />' ); 101 102 var infiniteCount = 0; 103 104 $( document.body ).on( 'post-load', function() { 105 infiniteCount = infiniteCount + 1; 106 var infiniteItems = jQuery( '.infinite-wrap.infinite-view-' + infiniteCount ); 107 infiniteItems.find( 'table' ).addClass( 'table' ).wrap( '<div class="table-responsive" />' ); 108 }); 109 110 /* Functions to fire on pageload */ 111 $( window ).load( function() { 112 113 guestbookMasonry(); 114 footerMasonry(); 115 116 // re-fire widgets after a delay, for widgets loaded via JS 117 setTimeout( footerMasonry, 2500 ); 118 } ); 119 120} )( 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.