1/** 2 * Theme's WooCommerce frontend scripts 3 * 4 * @package Monument Valley 5 * @copyright WebMan Design, Oliver Juhas 6 * 7 * @since 1.0.0 8 * @version 1.9.0 9 * 10 * Contents: 11 * 12 * 10) Adding to cart 13 * 20) Tabs 14 */ 15 16( function( $ ) { 17 18 'use strict'; 19 20 21 22 23 24 /** 25 * Cache 26 */ 27 28 var 29 $body = $( document.body ), 30 $headerCart = $( document.getElementById( 'header-shopping-cart' ) ); 31 32 33 34 35 36 /** 37 * 10) Adding to cart 38 */ 39 40 // Displaying sticky header (with header cart) when product is added to cart 41 42 if ( $body.hasClass( 'has-header-cart' ) ) { 43 44 $body 45 .on( 'adding_to_cart', function() { 46 47 // Processing 48 49 $body 50 .addClass( 'scrolling-up' ) 51 .removeClass( 'scrolling-down' ); 52 53 $headerCart 54 .addClass( 'focus' ); 55 56 } ) 57 .on( 'added_to_cart', function() { 58 59 // Processing 60 61 var $previewDelay = ( $headerCart.data( 'previewDelay' ) ) ? ( $headerCart.data( 'previewDelay' ) ) : ( 1000 ); 62 63 setTimeout( function() { 64 65 $headerCart 66 .removeClass( 'focus' ); 67 68 }, $previewDelay ); 69 70 } ); 71 72 } 73 74 75 76 77 78 /** 79 * 20) Tabs 80 */ 81 82 // Add class of tabs count on tab selector wrapper 83 84 $( '.woocommerce-tabs' ) 85 .addClass( function() { 86 return 'tabs-count-' + $( this ).find( '.tabs li' ).length; 87 } ); 88 89 // Apply additional classes and attributes into reviews pagination 90 91 $( '#reviews .woocommerce-pagination' ) 92 .addClass( 'pagination' ) 93 .attr( 'data-current', function() { 94 95 // Output 96 97 return jQuery( this ).find( '.current' ).text(); 98 99 } ) 100 .attr( 'data-total', function() { 101 102 // Output 103 104 return jQuery( this ).find( '.page-numbers:not(.prev):not(.next)' ).length; 105 106 } ); 107 108 // Product "More details" link tabs switching and smooth scroll to product tabs 109 110 $body 111 .on( 'click', 'a.product-description-link', function() { 112 113 // Helper variables 114 115 var 116 $tabs = $( '.woocommerce-tabs' ), 117 $tab = $( '.description_tab a' ); 118 119 120 // Requirements check 121 122 if ( ! $tabs.length ) { 123 return false; 124 } 125 126 127 // Processing 128 129 if ( $tab.length ) { 130 131 $( '.description_tab a' ) 132 .trigger( 'click' ); 133 134 } else { 135 136 $( '.additional_information_tab a' ) 137 .trigger( 'click' ); 138 139 } 140 141 $( 'html, body' ) 142 .stop() 143 .animate( { 144 scrollTop : $tabs.offset().top - 100 + 'px' 145 }, 600 ); 146 147 } ) 148 .on( 'click', 'a.woocommerce-review-link', function() { 149 150 // Helper variables 151 152 var 153 $tabs = $( '.woocommerce-tabs' ); 154 155 156 // Requirements check 157 158 if ( ! $tabs.length ) { 159 return false; 160 } 161 162 163 // Processing 164 165 $( 'html, body' ) 166 .stop() 167 .animate( { 168 scrollTop : $tabs.offset().top - 100 + 'px' 169 }, 600 ); 170 171 } ); 172 173 174 175 176 177} )( 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.