Submit
Path:
~
/
home
/
getwphos
/
public_html
/
almajd
/
wp-content
/
plugins
/
woocommerce
/
assets
/
js
/
frontend
/
File Content:
cart-fragments.js
/* global wc_cart_fragments_params, Cookies */ jQuery( function( $ ) { // wc_cart_fragments_params is required to continue, ensure the object exists if ( typeof wc_cart_fragments_params === 'undefined' ) { return false; } /* Storage Handling */ var $supports_html5_storage = true, cart_hash_key = wc_cart_fragments_params.cart_hash_key; try { $supports_html5_storage = ( 'sessionStorage' in window && window.sessionStorage !== null ); window.sessionStorage.setItem( 'wc', 'test' ); window.sessionStorage.removeItem( 'wc' ); window.localStorage.setItem( 'wc', 'test' ); window.localStorage.removeItem( 'wc' ); } catch( err ) { $supports_html5_storage = false; } /* Cart session creation time to base expiration on */ function set_cart_creation_timestamp() { if ( $supports_html5_storage ) { sessionStorage.setItem( 'wc_cart_created', ( new Date() ).getTime() ); } } /** Set the cart hash in both session and local storage */ function set_cart_hash( cart_hash ) { if ( $supports_html5_storage ) { localStorage.setItem( cart_hash_key, cart_hash ); sessionStorage.setItem( cart_hash_key, cart_hash ); } } var $fragment_refresh = { url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_refreshed_fragments' ), type: 'POST', data: { time: new Date().getTime() }, timeout: wc_cart_fragments_params.request_timeout, success: function( data ) { if ( data && data.fragments ) { $.each( data.fragments, function( key, value ) { $( key ).replaceWith( value ); }); if ( $supports_html5_storage ) { sessionStorage.setItem( wc_cart_fragments_params.fragment_name, JSON.stringify( data.fragments ) ); set_cart_hash( data.cart_hash ); if ( data.cart_hash ) { set_cart_creation_timestamp(); } } $( document.body ).trigger( 'wc_fragments_refreshed' ); } }, error: function() { $( document.body ).trigger( 'wc_fragments_ajax_error' ); } }; /* Named callback for refreshing cart fragment */ function refresh_cart_fragment() { $.ajax( $fragment_refresh ); } /* Cart Handling */ if ( $supports_html5_storage ) { var cart_timeout = null, day_in_ms = ( 24 * 60 * 60 * 1000 ); $( document.body ).on( 'wc_fragment_refresh updated_wc_div', function() { refresh_cart_fragment(); }); $( document.body ).on( 'added_to_cart removed_from_cart', function( event, fragments, cart_hash ) { var prev_cart_hash = sessionStorage.getItem( cart_hash_key ); if ( prev_cart_hash === null || prev_cart_hash === undefined || prev_cart_hash === '' ) { set_cart_creation_timestamp(); } sessionStorage.setItem( wc_cart_fragments_params.fragment_name, JSON.stringify( fragments ) ); set_cart_hash( cart_hash ); }); $( document.body ).on( 'wc_fragments_refreshed', function() { clearTimeout( cart_timeout ); cart_timeout = setTimeout( refresh_cart_fragment, day_in_ms ); } ); // Refresh when storage changes in another tab $( window ).on( 'storage onstorage', function ( e ) { if ( cart_hash_key === e.originalEvent.key && localStorage.getItem( cart_hash_key ) !== sessionStorage.getItem( cart_hash_key ) ) { refresh_cart_fragment(); } }); // Refresh when page is shown after back button (safari) $( window ).on( 'pageshow' , function( e ) { if ( e.originalEvent.persisted ) { $( '.widget_shopping_cart_content' ).empty(); $( document.body ).trigger( 'wc_fragment_refresh' ); } } ); try { var wc_fragments = JSON.parse( sessionStorage.getItem( wc_cart_fragments_params.fragment_name ) ), cart_hash = sessionStorage.getItem( cart_hash_key ), cookie_hash = Cookies.get( 'woocommerce_cart_hash'), cart_created = sessionStorage.getItem( 'wc_cart_created' ); if ( cart_hash === null || cart_hash === undefined || cart_hash === '' ) { cart_hash = ''; } if ( cookie_hash === null || cookie_hash === undefined || cookie_hash === '' ) { cookie_hash = ''; } if ( cart_hash && ( cart_created === null || cart_created === undefined || cart_created === '' ) ) { throw 'No cart_created'; } if ( cart_created ) { var cart_expiration = ( ( 1 * cart_created ) + day_in_ms ), timestamp_now = ( new Date() ).getTime(); if ( cart_expiration < timestamp_now ) { throw 'Fragment expired'; } cart_timeout = setTimeout( refresh_cart_fragment, ( cart_expiration - timestamp_now ) ); } if ( wc_fragments && wc_fragments['div.widget_shopping_cart_content'] && cart_hash === cookie_hash ) { $.each( wc_fragments, function( key, value ) { $( key ).replaceWith(value); }); $( document.body ).trigger( 'wc_fragments_loaded' ); } else { throw 'No fragment'; } } catch( err ) { refresh_cart_fragment(); } } else { refresh_cart_fragment(); } /* Cart Hiding */ if ( Cookies.get( 'woocommerce_items_in_cart' ) > 0 ) { $( '.hide_cart_widget_if_empty' ).closest( '.widget_shopping_cart' ).show(); } else { $( '.hide_cart_widget_if_empty' ).closest( '.widget_shopping_cart' ).hide(); } $( document.body ).on( 'adding_to_cart', function() { $( '.hide_cart_widget_if_empty' ).closest( '.widget_shopping_cart' ).show(); }); // Customiser support. var hasSelectiveRefresh = ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh && wp.customize.widgetsPreview && wp.customize.widgetsPreview.WidgetPartial ); if ( hasSelectiveRefresh ) { wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() { refresh_cart_fragment(); } ); } });
Submit
FILE
FOLDER
Name
Size
Permission
Action
test
---
0755
a8c-address-autocomplete-service.js
13187 bytes
0644
a8c-address-autocomplete-service.min.js
5065 bytes
0644
account-i18n.js
712 bytes
0644
account-i18n.min.js
179 bytes
0644
add-payment-method.js
1415 bytes
0644
add-payment-method.min.js
905 bytes
0644
add-to-cart-variation.js
30253 bytes
0644
add-to-cart-variation.min.js
14751 bytes
0644
add-to-cart.js
8414 bytes
0644
add-to-cart.min.js
4035 bytes
0644
address-autocomplete.js
24206 bytes
0644
address-autocomplete.min.js
8330 bytes
0644
address-i18n.js
5053 bytes
0644
address-i18n.min.js
2750 bytes
0644
cart-fragments.js
5639 bytes
0644
cart-fragments.min.js
2939 bytes
0644
cart.js
20962 bytes
0644
cart.min.js
9878 bytes
0644
checkout.js
33724 bytes
0644
checkout.min.js
18099 bytes
0644
country-select.js
6367 bytes
0644
country-select.min.js
3494 bytes
0644
credit-card-form.js
588 bytes
0644
credit-card-form.min.js
518 bytes
0644
geolocation.js
3845 bytes
0644
geolocation.min.js
1286 bytes
0644
lost-password.js
159 bytes
0644
lost-password.min.js
132 bytes
0644
order-attribution.js
6721 bytes
0644
order-attribution.min.js
2346 bytes
0644
password-strength-meter.js
4216 bytes
0644
password-strength-meter.min.js
2190 bytes
0644
price-slider.js
3065 bytes
0644
price-slider.min.js
2138 bytes
0644
single-product.js
16883 bytes
0644
single-product.min.js
9649 bytes
0644
tokenization-form.js
3841 bytes
0644
tokenization-form.min.js
2264 bytes
0644
woocommerce.js
6913 bytes
0644
woocommerce.min.js
3915 bytes
0644
wp-consent-api-integration.js
727 bytes
0644
wp-consent-api-integration.min.js
435 bytes
0644
N4ST4R_ID | Naxtarrr