Likes: 1
Dislikes: 1
Rating: 50%
Rank: 55
Votes: 2
Views: 3612

Top Rated Videos Studio Tiny4k in category Hardcore (0 Videos)


jQuery(function($){ // Показ нужной формы по ссылкам-переключателям внутри модалки $(document).on('click', '.modal-auth__switch [data-view]', function(e){ e.preventDefault(); const view = $(this).data('view'); // login | register // здесь твой загрузчик модалки, например: $.post(ModalCfg.ajaxurl, { action: 'load_modal', nonce: ModalCfg.nonce, view }, function(resp){ if (resp?.success && resp.data?.html) { $('#app-modal-content').html(resp.data.html); if (window.renderRecaptchaWidgets) window.renderRecaptchaWidgets('#app-modal-content'); window.dispatchEvent(new Event('app-modal-opened')); } }); }); // Вход $(document).on('submit', '.js-auth-login', function(e){ e.preventDefault(); const $f = $(this); $.post($f.attr('action'), $f.serialize()) .done(function(r){ try { r = typeof r === 'string' ? JSON.parse(r) : r; } catch(e){} if (r && r.success) { location.reload(); } else { alert(r?.message || 'Ошибка входа'); } }) .fail(()=>alert('Сеть недоступна')); }); // Регистрация (с one-click login) $(document).on('submit', '.js-auth-register', function(e){ e.preventDefault(); const $f = $(this); $.post($f.attr('action'), $f.serialize()) .done(function(r){ try { r = typeof r === 'string' ? JSON.parse(r) : r; } catch(e){} if (r && r.success) { // Если сервер отдал one-click токен — логинимся сразу if (r.oneclick_token) { $.post($f.attr('action'), { action: 'ajax_oneclick_login', _ajax_nonce: $f.find('input[name="_ajax_nonce"]').val(), token: r.oneclick_token }).done(function(rr){ try { rr = typeof rr === 'string' ? JSON.parse(rr) : rr; } catch(e){} if (rr && rr.success) location.reload(); else alert(rr?.message || 'Не удалось выполнить авто-вход'); }).fail(()=>alert('Сеть недоступна')); return; } // иначе просто обновим страницу location.reload(); } else { alert(r?.message || 'Ошибка регистрации'); } }) .fail(()=>alert('Сеть недоступна')); }); // reCAPTCHA: отрисовать после вставки HTML window.addEventListener('app-modal-opened', function(){ if (window.renderRecaptchaWidgets) window.renderRecaptchaWidgets('#app-modal-content'); }); });