HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (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/html/wpemobiq/wp-content/themes/salient/js/src/nectar-single-product-reviews.js
/**
 * Salient Single Product Reviews.
 *
 * @package Salient
 * @author ThemeNectar
 */

 (function( $ ) {
  
  "use strict";

  
  /**
  * Nectar Modal Product Reviews
  *
  */
   function NectarWooReviewsModal() {

    this.$el = $('#tab-reviews #review_form_wrapper');
    this.$button = $('#reviews .nectar-product-reviews-trigger');

    this.setup();

    this.state = {
      open: false
    };

  }

  NectarWooReviewsModal.prototype.setup = function() {

    var that = this;

    // DOM.
    this.$el.addClass('modal');
    if( $('body.material').length > 0 ) {
      this.$el.find('#review_form').prepend('<div class="nectar-close-btn-wrap"><a href="#" class="nectar-close-btn small"><span class="close-wrap"><span class="close-line close-line1"></span><span class="close-line close-line2"></span></span></a></div>');
    } 
    else {
      this.$el.find('#review_form').prepend('<div class="nectar-close-btn-wrap"><a href="#" class="nectar-close-btn small"><span class="icon-salient-m-close"></span></a></div>');
    }
    this.$el.detach();
    $('body').append(this.$el);
    
    if( $('body').find('.nectar-slide-in-cart-bg').length == 0 ) {
      $('body').append('<div class="nectar-slide-in-cart-bg"></div>');
    }
    
    this.$closeBtnEl = this.$el.find('.nectar-close-btn-wrap');
    this.$bgEl = $('.nectar-slide-in-cart-bg');
    
    this.timeout = '';
    
    // Events.
    this.$button.on('click', function() {
      that.open();
      return false;
    });
    
    $('#review_form .nectar-close-btn-wrap, .nectar-slide-in-cart-bg').on('click', function(e) {
      that.close();
      e.preventDefault();
    });

  };

  NectarWooReviewsModal.prototype.open = function() {
    
    clearTimeout(this.timeout);
    
    this.$closeBtnEl.addClass('open');
    this.$el.addClass('open');
    this.$bgEl.addClass('open').addClass('revealed');
    
    this.state.open = true;

  };
  
  NectarWooReviewsModal.prototype.close = function() {
    
    var that = this;
    
    this.$el.removeClass('open');
    this.$bgEl.removeClass('open');
    this.$closeBtnEl.removeClass('open');
    
    this.timeout = setTimeout(function() {
      that.$bgEl.removeClass('revealed');
    },400);
    
    this.state.open = false;

  };
  
  
  jQuery(document).ready(function($) {
    if( $('.nectar-product-reviews-trigger').length > 0 ) {
      var reviewsModal = new NectarWooReviewsModal();
    }
  });

 
 }(jQuery));