HEX
Server: Apache
System: Linux ecngx285.inmotionhosting.com 4.18.0-553.79.1.lve.el8.x86_64 #1 SMP Wed Oct 15 17:59:35 UTC 2025 x86_64
User: zeusxp5 (3862)
PHP: 8.3.28
Disabled: NONE
Upload Files
File: /home/zeusxp5/chuair.org/wp-content/plugins/post-and-page-builder/assets/js/builder/feedback.js
window.BOLDGRID = window.BOLDGRID || {};
BOLDGRID.EDITOR = BOLDGRID.EDITOR || {};

( function( $ ) {
	'use strict';

	var self,
		BG = BOLDGRID.EDITOR;

	BG.Feedback = {
		init: function() {
			self.$input = $( '[name="boldgrid-record-feedback"]' );
			self.bindEvents();
		},

		bindEvents: function() {
			$( window ).on( 'boldgrid_added_gridblock', self.addGridblock );
		},

		/**
		 * Add an action to feedback.
		 *
		 * @since 1.5
		 *
		 * @param {object} options Object to store.
		 */
		add: function( options ) {
			var val = self.$input.val() || '[]';
			val = JSON.parse( val );
			val.push( options );
			self.$input.attr( 'value', JSON.stringify( val ) );
			self.$input.val( JSON.stringify( val ) );
		},

		/**
		 * Record feedback when gridblock added.
		 *
		 * @since 1.5
		 *
		 * @param {Event} event
		 * @param {Object} data
		 */
		addGridblock: function( event, data ) {
			if ( data && data.template ) {
				self.add( {
					action: 'installed_gridblock',
					data: {
						template: data.template
					}
				} );
			}
		}
	};

	self = BOLDGRID.EDITOR.Feedback;
	BOLDGRID.EDITOR.Feedback.init();
} )( jQuery );