%PDF- %PDF-
| Direktori : /dom645759/wp-content/plugins/fusion-builder/front-end/views/elements/ |
| Current File : /dom645759/wp-content/plugins/fusion-builder/front-end/views/elements/view-stripe-button.js |
var FusionPageBuilder = FusionPageBuilder || {};
( function() {
jQuery( document ).ready( function() {
// Fusion Stripe Button View.
FusionPageBuilder.fusion_stripe_button = FusionPageBuilder.ElementView.extend( {
/**
* Modify template attributes.
*
* @since 3.1
* @param {Object} atts - The attributes object.
* @return {Object}
*/
filterTemplateAtts: function( atts ) {
var attributes = {};
if ( ! this.btnInstance ) {
this.btnInstance = new FusionPageBuilder.fusion_button( {
model: this.model,
attributes: atts
} );
this.btnInstance.elementTemplate = FusionPageBuilder.template( jQuery( '#tmpl-fusion_button-shortcode' ).html() );
}
// Create attribute
attributes.html = this.getAmountField( atts.values ) + this.btnInstance.render().$el.html();
return attributes;
},
/**
* Builds the visible amount field, for the customer chooses price mode.
* The live preview has no form around it, so this is for layout only. The bounds are enforced on the server.
*
* @since 3.16.2
* @param {Object} values - The element params.
* @return {String}
*/
getAmountField: function( values ) {
var zeroDecimal = [ 'BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF' ],
label,
step,
html;
if ( ! values || 'customer' !== values.price_mode ) {
return '';
}
label = '' !== values.amount_label ? values.amount_label : 'Amount';
step = -1 !== jQuery.inArray( ( values.currency || '' ).toUpperCase(), zeroDecimal ) ? '1' : '0.01';
html = '<div class="awb-stripe-button-amount">';
html += '<label class="awb-stripe-button-amount-label">' + _.escape( label ) + '</label>';
html += '<input type="number" class="awb-stripe-button-amount-input" step="' + step + '"';
if ( '' !== values.min_price ) {
html += ' min="' + _.escape( values.min_price ) + '" value="' + _.escape( values.min_price ) + '"';
}
if ( '' !== values.max_price ) {
html += ' max="' + _.escape( values.max_price ) + '"';
}
html += ' />';
html += '</div>';
return html;
}
} );
} );
}( jQuery ) );