1/*! 2 * Custom v1.0 3 * Contains handlers for the different site functions 4 * 5 * Copyright (c) 2013-2016 DesignOrbital.com 6 * License: GNU General Public License v2 or later 7 * http://www.gnu.org/licenses/gpl-2.0.html 8 */ 9 10( function( $ ) { 11 12 var maxilla = { 13 14 // Menu 15 menuInit: function() { 16 17 // Superfish Menu 18 $( 'ul.sf-menu' ).superfish( { 19 delay: 1500, 20 animation: { opacity : 'show', height : 'show' }, 21 speed: 'fast', 22 autoArrows: false, 23 cssArrows: true 24 } ); 25 26 }, 27 28 // Responsive Menu 29 responsiveMenuInit: function() { 30 31 // Clone the Primary Menu and remove classes from clone to prevent css issues 32 var $primaryMenuClone = $( '.primary-menu' ).clone().removeAttr( 'class' ).addClass( 'primary-menu-responsive' ); 33 $primaryMenuClone.removeAttr( 'style' ).find( '*' ).each( function( i,e ) { 34 $( e ).removeAttr( 'style' ); 35 } ); 36 37 // Insert the cloned menu before the site content 38 $( '<div class="site-primary-menu-responsive" />' ).insertBefore( '.site-content' ); 39 $primaryMenuClone.appendTo( '.site-primary-menu-responsive' ); 40 41 // Add dropdown toggle that display child menu items. 42 $( '.site-primary-menu-responsive .page_item_has_children > a, .site-primary-menu-responsive .menu-item-has-children > a' ).append( '<button class="dropdown-toggle" aria-expanded="false"/>' ); 43 $( '.site-primary-menu-responsive .dropdown-toggle' ).off( 'click' ).on( 'click', function( e ) { 44 e.preventDefault(); 45 $( this ).toggleClass( 'toggle-on' ); 46 $( this ).parent().next( '.children, .sub-menu' ).toggleClass( 'toggle-on' ); 47 $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 48 } ); 49 50 }, 51 52 // Open Slide Panel - Responsive Mobile Menu 53 slidePanelInit: function() { 54 55 // Elements 56 var menuResponsive = $( '.site-primary-menu-responsive' ); 57 var overlayEffect = $( '.overlay-effect' ); 58 59 // Responsive Menu Slide 60 $( '.toggle-menu-control' ).off( 'click' ).on( 'click', function( e ) { 61 62 // Prevent Default 63 e.preventDefault(); 64 e.stopPropagation(); 65 66 // ToggleClass 67 menuResponsive.toggleClass( 'show' ); 68 overlayEffect.toggleClass( 'open' ); 69 70 } ); 71 72 // Overlay Slide Close 73 overlayEffect.off( 'click' ).on( 'click', function() { 74 maxilla.slidePanelCloseInit(); 75 } ); 76 77 }, 78 79 // Close Slide Panel 80 slidePanelCloseInit: function() { 81 82 // Elements 83 var menuResponsive = $( '.site-primary-menu-responsive' ); 84 var overlayEffect = $( '.overlay-effect' ); 85 86 // Slide Panel Close Logic 87 if( overlayEffect.hasClass( 'open' ) ) { 88 89 // For Menu 90 if( menuResponsive.hasClass( 'show' ) ) { 91 menuResponsive.toggleClass( 'show' ); 92 } 93 94 // Toggle Overlay Slide 95 overlayEffect.toggleClass( 'open' ); 96 97 } 98 99 }, 100 101 // Widget Logic 102 widgetLogicInit: function() { 103 104 // Social Menu Widget 105 $( '.widget_nav_menu > div[class^="menu-social-"] > ul > li > a' ).wrapInner( '<span class="screen-reader-text"></span>' ); 106 107 // Custom Menu Widget 108 $( '.widget_nav_menu .menu-item-has-children > a' ).append( '<span class="custom-menu-toggle" aria-expanded="false"></span>' ); 109 $( '.widget_nav_menu .custom-menu-toggle' ).off( 'click' ).on( 'click', function( e ) { 110 e.preventDefault(); 111 $( this ).toggleClass( 'toggle-on' ); 112 $( this ).parent().next( '.sub-menu' ).toggleClass( 'toggle-on' ); 113 $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 114 } ); 115 116 // Pages Widget 117 $( '.widget_pages .page_item_has_children > a' ).append( '<span class="page-toggle" aria-expanded="false"></span>' ); 118 $( '.widget_pages .page-toggle' ).off( 'click' ).on( 'click', function( e ) { 119 e.preventDefault(); 120 $( this ).toggleClass( 'toggle-on' ); 121 $( this ).parent().next( '.children' ).toggleClass( 'toggle-on' ); 122 $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 123 } ); 124 125 // Categories Widget 126 $( '.widget_categories' ).find( '.children' ).parent().addClass( 'category_item_has_children' ); 127 $( '.widget_categories .category_item_has_children > a' ).append( '<span class="category-toggle" aria-expanded="false"></span>' ); 128 $( '.widget_categories .category-toggle' ).off( 'click' ).on( 'click', function( e ) { 129 e.preventDefault(); 130 $( this ).toggleClass( 'toggle-on' ); 131 $( this ).parent().next( '.children' ).toggleClass( 'toggle-on' ); 132 $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 133 } ); 134 135 }, 136 137 // Media Queries 138 mqInit: function() { 139 140 enquire.register( 'screen and ( max-width: 991px )' , { 141 142 deferSetup : true, 143 setup : function() { 144 145 // Responsive Menu 146 maxilla.responsiveMenuInit(); 147 148 }, 149 match : function() { 150 151 // Sliding Panels for Menu 152 maxilla.slidePanelInit(); 153 154 // Responsive Tables 155 $( '.entry-content, .sidebar, .footer-sidebar' ).find( 'table' ).wrap( '<div class="table-responsive"></div>' ); 156 157 }, 158 unmatch : function() { 159 160 // Responsive Menu Close 161 maxilla.slidePanelCloseInit(); 162 163 // Responsive Tables Undo 164 $( '.entry-content, .sidebar, .footer-sidebar' ).find( 'table' ).unwrap( '<div class="table-responsive"></div>' ); 165 166 } 167 168 }); 169 170 } 171 172 }; 173 174 // Document Ready 175 $( document ).ready( function() { 176 177 // Menu 178 maxilla.menuInit(); 179 180 // Sliding Panels for Menu and Sidebar 181 maxilla.slidePanelInit(); 182 183 // Widget Logic 184 maxilla.widgetLogicInit(); 185 186 // Media Queries 187 maxilla.mqInit(); 188 189 } ); 190 191 // Document Keyup 192 $( document ).keyup( function( e ) { 193 194 // Escape Key 195 if ( e.keyCode === 27 ) { 196 197 // Make the escape key to close the slide panel 198 maxilla.slidePanelCloseInit(); 199 200 } 201 202 } ); 203 204 205 jQuery(window).load(function() { 206 if (jQuery(window).width() > 992) { 207 var sidebar = false;
208 var footer = false; 209 var footer_position = false; 210 if (jQuery('#custom_html-2').length) { 211 var sidebar_position = jQuery("#custom_html-2").offset().top; 212 } 213 footer_position = jQuery(".site-footer-widgets-wrapper").offset(); 214 var sidebar_height = jQuery("#custom_html-2").height(); 215 jQuery(window).scroll(function () { 216 if (jQuery(this).scrollTop() >= (sidebar_position - 20)) { 217 if (!sidebar) { 218 jQuery("#custom_html-2").addClass('fixed'); 219 sidebar = true; 220 } 221 } else { 222 if (sidebar) { 223 jQuery("#custom_html-2").removeClass('fixed'); 224 sidebar = false; 225 } 226 } 227 if ((jQuery(this).scrollTop() + sidebar_height) >= footer_position.top) { 228 if (footer) { 229 var sidebar_relative_position = footer_position.top - sidebar_height - sidebar_position; 230 jQuery("#custom_html-2").addClass('fixedBottom'); 231 jQuery("#custom_html-2").css('top', sidebar_relative_position + 'px'); 232 footer = false; 233 } 234 } else { 235 if (!footer) { 236 jQuery("#custom_html-2").removeClass('fixedBottom'); 237 jQuery("#custom_html-2").css('top', '20px'); 238 footer = true; 239 } 240 } 241 }); 242 } 243 }); 244 245 246} )( 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.