/* assets/js/rules-admin.js * Логика добавления строк и AJAX-сохранения для страницы Link Rules */ (function($) { 'use strict'; $(document).ready(function() { var $tableBody = $('.rules-table-body'); // Добавить новую строку правил $('#ail-add-rule').on('click', function(e) { e.preventDefault(); // Клонируем шаблон var $newRow = $tableBody.find('tr.ail-new-rule-row').clone(); // Очищаем значения $newRow.find('input').val(''); // Вставляем перед шаблоном $tableBody.append($newRow); }); // AJAX-сохранение при сабмите формы $('#ail-rules-form').on('submit', function(e) { e.preventDefault(); var $form = $(this); var rules = []; // Сбор данных из всех строк (кроме шаблона) $tableBody.find('tr').each(function() { var $row = $(this); var target = $row.find('input[name*="target_url"]').val(); var anchors = $row.find('input[name*="base_anchors"]').val(); var maxRec = $row.find('input[name*="max_per_recipient"]').val(); var maxDon = $row.find('input[name*="max_per_donor"]').val(); if (target || anchors) { rules.push({ target_url: target, base_anchors: anchors, max_per_recipient: maxRec || 1, max_per_donor: maxDon || 1 }); } }); // AJAX $.post( ailRules.ajaxUrl, { action: 'ail_save_rules', nonce: ailRules.nonce, ail_rules: rules } ).done(function(resp) { if (resp.success) { // Показываем уведомление var notice = $('

' + resp.data + '

'); $('.wrap').first().prepend(notice); // Очищаем таблицу и перезагружаем страницу через 1 с setTimeout(function() { location.reload(); }, 1000); } else { alert('Error: ' + resp.data); } }).fail(function() { alert('Request failed.'); }); }); }); })(jQuery); Mario Kart World: Journey from SNES Classics to Switch 2
July 12, 2025
KSN » Blog » Gaming Industry » The Long & Rainbow Road To Mario Kart World: From SNES to Switch 2

Leave a Reply

Your email address will not be published. Required fields are marked *