403Webshell
Server IP : 104.171.130.249  /  Your IP : 216.73.216.146
Web Server : nginx/1.25.5
System : Linux 0dac65491b7e 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/themes/matreshka/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/themes/matreshka/assets/js/payment-modal.js
/**
 * Matreshka — Payment Method Modal
 * Выбор способа оплаты на странице корзины
 */
(function ($) {
  'use strict';

  var $overlay = $('#payment-modal-overlay');
  var $modal   = $('#payment-modal');

  /* ── Icon map (matches PHP $gateway_icon_map) ──── */
  var iconMap = {
    cod:  'money',
    bacs: 'credit_card'
  };

  /* ── Open / Close ───────────────────────────────── */
  function openModal() {
    $overlay.addClass('open');
    requestAnimationFrame(function () {
      $modal.addClass('open');
    });
    $('body').css('overflow', 'hidden');
  }

  function closeModal() {
    $modal.removeClass('open');
    $overlay.removeClass('open');
    $('body').css('overflow', '');
  }

  $(document).on('click', '#btn-payment-modal', function (e) {
    e.preventDefault();
    openModal();
  });

  $(document).on('click', '#payment-modal-close, #payment-modal-overlay', function () {
    closeModal();
  });

  $(document).on('keydown', function (e) {
    if (e.key === 'Escape' && $modal.hasClass('open')) {
      closeModal();
    }
  });

  /* ── Radio selection ────────────────────────────── */
  $(document).on('change', 'input[name="matreshka_payment_method"]', function () {
    $('.payment-method-item').removeClass('active');
    $(this).closest('.payment-method-item').addClass('active');
  });

  /* ── Done — save via AJAX, update label, close ──── */
  $(document).on('click', '#payment-modal-done', function () {
    var $checked = $('input[name="matreshka_payment_method"]:checked');
    if (!$checked.length) {
      closeModal();
      return;
    }

    var gatewayId    = $checked.val();
    var gatewayTitle = $checked.closest('.payment-method-item')
                               .find('.montserrat-semibold').first().text().trim();
    var iconName     = iconMap[gatewayId] || 'payments';

    // Update the button label immediately
    $('#payment-current-label').html(
      '<span class="material-icons-outlined me-1" style="font-size:18px;vertical-align:middle;">' +
      iconName + '</span>' + gatewayTitle
    );

    // Save to WC session via AJAX
    $.post(matreshka_ajax.ajax_url, {
      action:         'matreshka_set_payment_method',
      security:       matreshka_ajax.nonce,
      payment_method: gatewayId
    });

    closeModal();
  });

  /* ── Re-bind after WC AJAX cart refresh ─────────── */
  $(document.body).on('updated_cart_totals', function () {
    $overlay = $('#payment-modal-overlay');
    $modal   = $('#payment-modal');
  });

})(jQuery);

Youez - 2016 - github.com/yon3zu
LinuXploit