/** * Created by Ovidiu on 7/20/2017. */ var _instance = null, shortcode_base = TVE.shortcode_manager; module.exports = TVE.modal.base.extend( { after_initialize: function () { this.$el.addClass( 'medium' ); this.$campaign = this.$el.find( '#tve_ult_campaign' ); this.$shortcode = this.$el.find( '#tve_ult_shortcode' ); }, before_open: function () { if ( ! TVE.ActiveElement.hasClass( 'tcb-elem-placeholder' ) ) { var _config = this.get_config(); if ( typeof _config[ 'tve_ult_campaign' ] !== 'undefined' && typeof _config[ 'tve_ult_shortcode' ] !== 'undefined' ) { this.$campaign.val( _config[ 'tve_ult_campaign' ] ).trigger( 'change' ); this.$shortcode.val( _config[ 'tve_ult_shortcode' ] ); } } }, /** * Returns Ultimatum Shortcode Settings * * @returns {*} */ get_config: function () { var shortcode_config = shortcode_base( TVE.ActiveElement.find( '.thrive-shortcode-config' ), 'ultimatum_shortcode' ); return shortcode_config.get(); }, campaign_changed: function ( event, dom ) { var _$shortcode = this.$shortcode; _$shortcode.html( '' ); if ( dom.value ) { jQuery.each( tve_ult_page_data.tu_shortcode_campaigns[ dom.value ].designs, function ( id, name ) { var $option = jQuery( '