404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.129.67.244: ~ $
/*global wc_users_params */
jQuery( function ( $ ) {

	/**
	 * Users country and state fields
	 */
	var wc_users_fields = {
		states: null,
		init: function() {
			if ( typeof wc_users_params.countries !== 'undefined' ) {
				/* State/Country select boxes */
				this.states = JSON.parse( wc_users_params.countries.replace( /"/g, '"' ) );
			}

			$( '.js_field-country' ).selectWoo().on( 'change', this.change_country );
			$( '.js_field-country' ).trigger( 'change', [ true ] );
			$( document.body ).on( 'change', 'select.js_field-state', this.change_state );

			$( document.body ).on( 'click', 'button.js_copy-billing', this.copy_billing );
		},

		change_country: function( e, stickValue ) {
			// Check for stickValue before using it
			if ( typeof stickValue === 'undefined' ) {
				stickValue = false;
			}

			// Prevent if we don't have the metabox data
			if ( wc_users_fields.states === null ) {
				return;
			}

			var $this = $( this ),
				country = $this.val(),
				$state = $this.parents( '.form-table' ).find( ':input.js_field-state' ),
				$parent = $state.parent(),
				input_name = $state.attr( 'name' ),
				input_id = $state.attr( 'id' ),
				stickstatefield = 'woocommerce.stickState-' + country,
				value = $this.data( stickstatefield ) ? $this.data( stickstatefield ) : $state.val(),
				placeholder = $state.attr( 'placeholder' ),
				$newstate;

			if ( stickValue ){
				$this.data( 'woocommerce.stickState-' + country, value );
			}

			// Remove the previous DOM element
			$parent.show().find( '.select2-container' ).remove();

			if ( ! $.isEmptyObject( wc_users_fields.states[ country ] ) ) {
				var state          = wc_users_fields.states[ country ],
					$defaultOption = $( '<option value=""></option>' )
						.text( wc_users_fields.i18n_select_state_text );

				$newstate = $( '<select style="width: 25em;"></select>' )
					.prop( 'id', input_id )
					.prop( 'name', input_name )
					.prop( 'placeholder', placeholder )
					.addClass( 'js_field-state' )
					.append( $defaultOption );

				$.each( state, function( index ) {
					var $option = $( '<option></option>' )
						.prop( 'value', index )
						.text( state[ index ] );
					$newstate.append( $option );
				} );

				$newstate.val( value );

				$state.replaceWith( $newstate );

				$newstate.show().selectWoo().hide().trigger( 'change' );
			} else {
				$newstate = $( '<input type="text" />' )
					.prop( 'id', input_id )
					.prop( 'name', input_name )
					.prop( 'placeholder', placeholder )
					.addClass( 'js_field-state regular-text' )
					.val( value );
				$state.replaceWith( $newstate );
			}

			// This event has a typo - deprecated in 2.5.0
			$( document.body ).trigger( 'contry-change.woocommerce', [country, $( this ).closest( 'div' )] );
			$( document.body ).trigger( 'country-change.woocommerce', [country, $( this ).closest( 'div' )] );
		},

		change_state: function() {
			// Here we will find if state value on a select has changed and stick it to the country data
			var $this = $( this ),
				state    = $this.val(),
				$country = $this.parents( '.form-table' ).find( ':input.js_field-country' ),
				country  = $country.val();

			$country.data( 'woocommerce.stickState-' + country, state );
		},

		copy_billing: function( event ) {
			event.preventDefault();

			$( '#fieldset-billing' ).find( 'input, select' ).each( function( i, el ) {
				// The address keys match up, except for the prefix
				var shipName = el.name.replace( /^billing_/, 'shipping_' );
				// Swap prefix, then check if there are any elements
				var shipEl = $( '[name="' + shipName + '"]' );
				// No corresponding shipping field, skip this item
				if ( ! shipEl.length ) {
					return;
				}
				// Found a matching shipping element, update the value
				shipEl.val( el.value ).trigger( 'change' );
			} );
		}
	};

	wc_users_fields.init();

});

Filemanager

Name Type Size Permission Actions
api-keys.js File 3.89 KB 0644
api-keys.min.js File 2.23 KB 0644
backbone-modal.js File 4.35 KB 0644
backbone-modal.min.js File 2.77 KB 0644
marketplace-suggestions.js File 15.59 KB 0644
marketplace-suggestions.min.js File 6.29 KB 0644
meta-boxes-coupon.js File 2.03 KB 0644
meta-boxes-coupon.min.js File 1.19 KB 0644
meta-boxes-order.js File 49.69 KB 0644
meta-boxes-order.min.js File 30.9 KB 0644
meta-boxes-product-variation.js File 40.54 KB 0644
meta-boxes-product-variation.min.js File 21.73 KB 0644
meta-boxes-product.js File 33.75 KB 0644
meta-boxes-product.min.js File 17.73 KB 0644
meta-boxes.js File 4.88 KB 0644
meta-boxes.min.js File 2.97 KB 0644
network-orders.js File 2.34 KB 0644
network-orders.min.js File 1.25 KB 0644
order-attribution-admin.js File 1.16 KB 0644
order-attribution-admin.min.js File 730 B 0644
product-editor.js File 405 B 0644
product-editor.min.js File 240 B 0644
product-ordering.js File 2.49 KB 0644
product-ordering.min.js File 1.61 KB 0644
quick-edit.js File 6.78 KB 0644
quick-edit.min.js File 4.42 KB 0644
reports.js File 6.31 KB 0644
reports.min.js File 3.17 KB 0644
settings-views-html-settings-tax.js File 11.96 KB 0644
settings-views-html-settings-tax.min.js File 6.01 KB 0644
settings.js File 6.72 KB 0644
settings.min.js File 4.19 KB 0644
system-status.js File 4.18 KB 0644
system-status.min.js File 2.43 KB 0644
term-ordering.js File 4.57 KB 0644
term-ordering.min.js File 2.47 KB 0644
users.js File 3.78 KB 0644
users.min.js File 1.87 KB 0644
wc-clipboard.js File 869 B 0644
wc-clipboard.min.js File 336 B 0644
wc-enhanced-select.js File 13.58 KB 0644
wc-enhanced-select.min.js File 7.71 KB 0644
wc-orders.js File 1.98 KB 0644
wc-orders.min.js File 1.17 KB 0644
wc-product-export.js File 3.63 KB 0644
wc-product-export.min.js File 2.02 KB 0644
wc-product-import.js File 2.92 KB 0644
wc-product-import.min.js File 1.7 KB 0644
wc-setup.js File 10.05 KB 0644
wc-setup.min.js File 6.35 KB 0644
wc-shipping-classes.js File 6.42 KB 0644
wc-shipping-classes.min.js File 3.41 KB 0644
wc-shipping-zone-methods.js File 26.9 KB 0644
wc-shipping-zone-methods.min.js File 14.39 KB 0644
wc-shipping-zones.js File 8.97 KB 0644
wc-shipping-zones.min.js File 4.71 KB 0644
wc-status-widget.js File 823 B 0644
wc-status-widget.min.js File 584 B 0644
woocommerce_admin.js File 19.73 KB 0644
woocommerce_admin.min.js File 10.68 KB 0644