/* global wpformsElementorVars, elementor, elementorFrontend */ 'use strict'; /** * WPForms integration with Elementor in the editor. * * @since 1.6.0 * @since 1.6.2 Moved frontend integration to `wpforms-elementor-frontend.js` */ var WPFormsElementor = window.WPFormsElementor || ( function( document, window, $ ) { /** * Runtime variables. * * @since 1.6.2 * * @type {object} */ var vars = {}; /** * Public functions and properties. * * @since 1.6.0 * * @type {object} */ var app = { /** * Start the engine. * * @since 1.6.0 */ init: function() { app.events(); }, /** * Register JS events. * * @since 1.6.0 */ events: function() { // Widget events. $( window ).on( 'elementor/frontend/init', function( event, id, instance ) { // Widget buttons click. elementor.channels.editor.on( 'elementorWPFormsAddFormBtnClick', app.addFormBtnClick ); // Widget frontend events. elementorFrontend.hooks.addAction( 'frontend/element_ready/wpforms.default', app.widgetPreviewEvents ); // Initialize widget controls. elementor.hooks.addAction( 'panel/open_editor/widget/wpforms', app.widgetPanelOpen ); // Initialize choiceJS. elementorFrontend.hooks.addAction( 'frontend/element_ready/wpforms.default', app.loadChoicesJS ); } ); }, /** * Init Modern style Dropdown fields (