HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vm8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: afleverb (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/mussarq_bak/wp-content/themes/wpnull24/framework/js/base/comments.js
/**
 * WordPress Comments Form
 *
 */
! function( $ ) {
	"use strict";

	$us.CommnentsForm = function( container, options ) {
		this.init( container, options );
	};

	$us.CommnentsForm.prototype = {
		init: function( container, options ) {
			this.$container = $( container );
			this.$form = this.$container.find( 'form.comment-form' );
			if ( ! this.$form.length ) {
				return;
			}
			this.$jsonContainer = this.$container.find( '.us-comments-json' );
			if ( ! this.$jsonContainer.length ) {
				return;
			}
			this.jsonData = this.$jsonContainer[ 0 ].onclick() || {};
			this.$jsonContainer.remove();

			this.$fields = {
				content: {
					field: this.$form.find( 'textarea' ),
					msg: this.jsonData.no_content_msg || 'Please enter a Message'
				},
				name: {
					field: this.$form.find( '.for_text input[type="text"]' ),
					msg: this.jsonData.no_name_msg || 'Please enter your Name'
				},
				email: {
					field: this.$form.find( '.for_email input[type="email"]' ),
					msg: this.jsonData.no_email_msg || 'Please enter a valid email address.'
				}
			};

			this._events = {
				formSubmit: this.formSubmit.bind( this )
			};

			this.$form.on( 'submit', this._events.formSubmit );
		},
		formSubmit: function( event ) {
			// Clear errors
			this.$form.find( '.w-form-row.check_wrong' ).removeClass( 'check_wrong' );
			this.$form.find( '.w-form-state' ).html( '' );

			// Do not send empty fields
			for ( var i in this.$fields ) {
				if ( this.$fields[ i ].field.length == 0 ) {
					continue;
				}
				if ( this.$fields[ i ].field.val() == '' && this.$fields[ i ].field.attr( 'data-required' ) ) {
					this.$fields[ i ].field.closest( '.w-form-row' ).toggleClass( 'check_wrong' );
					this.$fields[ i ].field.closest( '.w-form-row' ).find( '.w-form-row-state' ).html( this.$fields[ i ].msg );
					event.preventDefault();
				}
			}
		}
	};

	$.fn.CommnentsForm = function( options ) {
		return this.each( function() {
			$( this ).data( 'CommnentsForm', new $us.CommnentsForm( this, options ) );
		} );
	};

	$( function() {
		$( '.w-post-elm.post_comments.layout_comments_template' ).CommnentsForm();
		$( '.l-section.for_comments' ).CommnentsForm();
	} );
}( jQuery );