-
Renombrar Hermandad
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/change_email_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/change_email_response.js
deleted file mode 100644
index ffed7b2..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/change_email_response.js
+++ /dev/null
@@ -1,53 +0,0 @@
-$(document).ready(function() {
- function handleResponse(response, button, originalText) {
- $("#change-email-response").html(response.message).hide().slideDown();
-
- if (response.redirect_url) {
- setTimeout(function() {
- window.location.href = response.redirect_url;
- }, 2000);
- return;
- }
-
- if (response.success) {
- button.html("Proceso completado");
- } else {
- setTimeout(function() {
- $("#change-email-response").slideUp(function() {
- $("#change-email-response").empty();
- button.html(originalText);
- button.prop("disabled", false);
- });
- }, 5000);
- }
- }
-
- // Manejar los enlaces de confirmación
- $('.confirm-link').on('click', function(e) {
- e.preventDefault();
- $("#change-email-response").empty();
-
- var button = $(this);
- var url = button.attr('href');
- var originalText = button.html();
-
- button.html("Verificando...");
- button.prop("disabled", true);
-
- $.ajax({
- type: 'GET',
- url: url,
- dataType: 'json',
- success: function(response) {
- handleResponse(response, button, originalText);
- },
- error: function(xhr, status, error) {
- console.error("Error:", error);
- console.error("Detalles:", xhr.responseText);
- $("#change-email-response").html('Algo ha salido mal. Inténtelo de nuevo.');
- button.html(originalText);
- button.prop("disabled", false);
- }
- });
- });
-});
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/change_faction_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/change_faction_response.js
deleted file mode 100644
index 909c96a..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/change_faction_response.js
+++ /dev/null
@@ -1,45 +0,0 @@
-if (window.history.replaceState) {
- window.history.replaceState(null, null, window.location.href);
-};
-
-$(function(){
- $('.change-faction-button').on('click', function(e) {
- e.preventDefault();
- $("#change-faction-response").empty();
-
- var button = $(this);
- var buttonoriginal = button.html();
- var data = $("#nw-change-faction-form").serialize();
-
- var conf = confirm("¿Estás seguro de cambiar de facción al personaje seleccionado?");
-
- if (conf === true) {
- changeButton(button, 'Procesando pago...');
-
- $.ajax({
- type: 'POST',
- url: '', // URL actual
- data: data,
- dataType: 'json',
- success: function(response) {
- if (response.success) {
- var stripe = Stripe(response.stripe_public_key);
- stripe.redirectToCheckout({ sessionId: response.session_id }).then(function(result) {
- if (result.error) {
- $("#change-faction-response").append('' + result.error.message + '').hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- });
- } else {
- $("#change-faction-response").append(response.message).hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- },
- error: function() {
- $("#change-faction-response").append('Error inesperado. Por favor, intente más tarde.').hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- });
- }
- });
-});
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/change_password_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/change_password_response.js
deleted file mode 100644
index 5202b71..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/change_password_response.js
+++ /dev/null
@@ -1,43 +0,0 @@
-$(function(){
- $('.change-password-button').on('click', function(e) {
- e.preventDefault();
- e.stopPropagation();
- $("#change-password-response").empty();
-
- var button = $(this);
- var originalText = button.html();
- var data = $("#nw-change-password-form").serialize();
-
- changeButton(button, 'Cambiando contraseña');
-
- $.ajax({
- type: 'POST',
- url: '',
- data: data,
- dataType: 'json',
- success: function(response) {
- $("#change-password-response").html(response.message).hide().slideDown();
-
- if (response.success) {
- button.html("Contraseña cambiada").css("color", "#d79602");
- if (response.redirect) {
- setTimeout(function() {
- window.location.href = '/es/log-in';
- }, 3000);
- }
- } else {
- setTimeout(function() {
- $("#change-password-response").slideUp(function() {
- $("#change-password-response").empty();
- restoreButton(button, originalText);
- });
- }, 5000);
- }
- },
- error: function() {
- alert("Algo ha salido mal. Por favor, intenta más tarde.");
- window.location.reload();
- }
- });
- });
-});
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/change_race_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/change_race_response.js
deleted file mode 100644
index 28993bb..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/change_race_response.js
+++ /dev/null
@@ -1,73 +0,0 @@
-if (window.history.replaceState) {
- window.history.replaceState(null, null, window.location.href);
-}
-
-function doRefresh() {
- $("#nw-change-race-form").load(document.URL + " #nw-change-race-form>*", function () {
- $.getScript('/static/nw-themes/nw-ryu/nw-js-handlers/change_race_response.js');
- });
-}
-
-$(function () {
- $('select').on('change', function () {
- var select = $(this);
- select.css('color', select.children('option:selected').css('color'));
- });
-});
-
-$(function () {
- $('.change-race-button').on('click', function (e) {
- e.preventDefault();
- e.stopPropagation();
- $("#change-race-response").empty();
-
- var button = $(this);
- var buttonoriginal = button.html();
- var data = $("#nw-change-race-form").serialize();
-
- var conf = confirm("¿Estás seguro de cambiar de raza al personaje seleccionado?");
- if (conf === true) {
- changeButton(button, 'Procesando pago...');
-
- $.ajax({
- type: 'POST',
- url: '', // La URL para manejar la solicitud POST
- data: data,
- dataType: 'json',
- success: function (response) {
- if (response.success) {
- // Verificar si Stripe.js está disponible
- if (typeof Stripe === 'undefined') {
- console.error("Stripe.js no está cargado.");
- $("#change-race-response").append('Error al cargar Stripe. Intente nuevamente más tarde.').hide().slideDown();
- restoreButton(button, buttonoriginal);
- return;
- }
-
- // Inicializar Stripe con la clave pública
- var stripe = Stripe(response.stripe_public_key);
-
- // Redirigir al checkout de Stripe
- stripe.redirectToCheckout({
- sessionId: response.session_id
- }).then(function (result) {
- if (result.error) {
- $("#change-race-response").append('' + result.error.message + '').hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- });
- } else {
- $("#change-race-response").append(response.message).hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- },
- error: function () {
- setTimeout(function () {
- alert("Algo ha salido mal. Por favor intente más tarde");
- window.location.reload();
- }, 2000);
- }
- });
- }
- });
-});
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/customize_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/customize_response.js
deleted file mode 100644
index 309f606..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/customize_response.js
+++ /dev/null
@@ -1,52 +0,0 @@
-if (window.history.replaceState) {
- window.history.replaceState(null, null, window.location.href);
-}
-
-$(function(){
- $('.customize-button').on('click', function(e) {
- e.preventDefault();
- $("#customize-response").empty();
-
- var button = $(this);
- var buttonoriginal = button.html();
- var data = $("#nw-customize-form").serialize();
-
- var conf = confirm("¿Estás seguro de personalizar al personaje seleccionado?");
-
- if (conf === true) {
- button.html("Procesando pago...");
- button.prop("disabled", true);
-
- $.ajax({
- type: 'POST',
- url: '', // Endpoint para manejar el POST
- data: data,
- dataType: 'json',
- success: function(response) {
- if (response.success) {
- var stripe = Stripe(response.stripe_public_key);
-
- stripe.redirectToCheckout({
- sessionId: response.session_id
- }).then(function(result) {
- if (result.error) {
- $("#customize-response").html('' + result.error.message + '');
- button.html(buttonoriginal);
- button.prop("disabled", false);
- }
- });
- } else {
- $("#customize-response").html(response.message);
- button.html(buttonoriginal);
- button.prop("disabled", false);
- }
- },
- error: function() {
- $("#customize-response").html('Algo salió mal. Intenta de nuevo.');
- button.html(buttonoriginal);
- button.prop("disabled", false);
- }
- });
- }
- });
-});
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/gold_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/gold_response.js
deleted file mode 100644
index 33e62a5..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/gold_response.js
+++ /dev/null
@@ -1,35 +0,0 @@
-$(function(){
- $('.gold-button').on('click', function(e) {
- e.preventDefault();
- $("#gold-response").empty();
-
- var button = $(this);
- var originalText = button.html();
- var data = $("#nw-gold-form").serialize();
-
- button.html('Procesando pago...');
- button.prop('disabled', true);
-
- $.ajax({
- type: 'POST',
- url: '',
- data: data,
- dataType: 'json',
- success: function(response) {
- if (response.success) {
- var stripe = Stripe(response.stripe_public_key);
- stripe.redirectToCheckout({ sessionId: response.session_id });
- } else {
- $("#gold-response").append(response.message).hide().slideDown();
- button.html(originalText);
- button.prop('disabled', false);
- }
- },
- error: function() {
- $("#gold-response").append('Error inesperado. Por favor, intente más tarde.').hide().slideDown();
- button.html(originalText);
- button.prop('disabled', false);
- }
- });
- });
-});
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/level_up_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/level_up_response.js
deleted file mode 100644
index ac7e4ae..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/level_up_response.js
+++ /dev/null
@@ -1,47 +0,0 @@
-if (window.history.replaceState) {
- window.history.replaceState(null, null, window.location.href);
-}
-
-$(function() {
- $('.level-up-button').on('click', function(e) {
- e.preventDefault();
- $("#levelup-response").empty();
-
- var button = $(this);
- var buttonoriginal = button.html();
- var data = $("#nw-levelup-form").serialize();
-
- var conf = confirm("¿Estás seguro de subir al nivel 80 al personaje seleccionado?");
-
- if (conf === true) {
- changeButton(button, 'Procesando pago...');
-
- $.ajax({
- type: 'POST',
- url: '',
- data: data,
- dataType: 'json',
- success: function(response) {
- if (response.success) {
- var stripe = Stripe(response.stripe_public_key);
- stripe.redirectToCheckout({
- sessionId: response.session_id
- }).then(function(result) {
- if (result.error) {
- $("#levelup-response").append('' + result.error.message + '').hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- });
- } else {
- $("#levelup-response").append(response.message).hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- },
- error: function() {
- $("#levelup-response").append('Error inesperado. Por favor intente más tarde.').hide().slideDown();
- restoreButton(button, buttonoriginal);
- }
- });
- }
- });
-});
diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/login_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/login_response.js
deleted file mode 100644
index 8e79be1..0000000
--- a/static/nw-themes/nw-ryu/nw-js-handlers/login_response.js
+++ /dev/null
@@ -1,119 +0,0 @@
-// Evitar el reenvío del formulario si la página se recarga
-if (window.history.replaceState) {
- window.history.replaceState(null, null, window.location.href);
-}
-
-// Mostrar/ocultar la contraseña
-$(function() {
- $(".toggle-password").click(function() {
- $(this).toggleClass("fa-eye fa-eye-slash");
- const type = $(this).hasClass("fa-eye-slash") ? "text" : "password";
- $("#password").attr("type", type);
- });
-});
-
-// Manejar el envío del formulario de inicio de sesión
-$(function() {
- $('.login-button').on('click', function(e) {
- e.preventDefault();
- e.stopPropagation();
-
- const button = $(this);
- const buttonOriginal = button.html();
- const username = $("#username").val().trim();
- const password = $("#password").val().trim();
- const loginResponse = $("#login-response");
-
- // Cambiar el texto del botón a "Conectando..."
- changeButton(button, 'Conectando');
-
- // Validar si los campos están vacíos
- if (username === "" || password === "") {
- loginResponse.html('Por favor rellene todos los campos.');
- loginResponse.hide().slideDown();
-
- // Limpiar el mensaje y restaurar el botón después de 5 segundos
- setTimeout(function() {
- loginResponse.slideUp(function() {
- loginResponse.empty();
- restoreButton(button, buttonOriginal);
- });
- }, 5000);
- return;
- }
-
- // Serializar datos para el envío
- const bValue = button.data('id');
- let data = { login: bValue };
- data = $("#nw-login-form").serialize() + '&' + $.param(data);
-
- $.ajax({
- type: 'POST',
- url: '',
- data: data,
- dataType: 'json',
- success: function(response) {
- loginResponse.hide().empty();
-
- if (response.success === true) {
- // Si el inicio de sesión es exitoso
- button.html("Conectado");
- button.css("color", "#d79602");
-
- // Mostrar mensaje de conexión exitosa
- loginResponse.html('Conexión exitosa.
Redirigiendo...'); - loginResponse.hide().slideDown(); - - // Redirigir después de 3 segundos - setTimeout(function() { - window.location = "my-account"; - }, 3000); - } else if (response.alert === true) { - button.html("Sancionado"); - } else if (response.locked === true) { - button.html("Seguridad"); - } else { - // Mostrar mensaje para credenciales incorrectas - loginResponse.html('Nombre de usuario / Contraseña incorrectos.'); - loginResponse.hide().slideDown(); - - // Restaurar el botón y ocultar el mensaje después de 5 segundos - setTimeout(function() { - loginResponse.slideUp(function() { - loginResponse.empty(); - restoreButton(button, buttonOriginal); - }); - }, 5000); - } - }, - error: function() { - setTimeout(function() { - alert("Algo ha salido mal. Por favor intente más tarde"); - window.location.reload(); - }, 2000); - } - }); - }); -}); - -// Función para cambiar el estado del botón a "Conectando" -function changeButton(button, text) { - button.html(text); - button.prop("disabled", true); - button.css({ - "color": "rgb(177, 153, 127)", - "background-color": "rgba(255, 255, 255, 0.1)", - "cursor": "default" - }); -} - -// Función para restaurar el estado original del botón -function restoreButton(button, originalText) { - button.html(originalText); - button.prop("disabled", false); - button.css({ - "color": "", - "background-color": "", - "cursor": "" - }); -} \ No newline at end of file diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/register.js b/static/nw-themes/nw-ryu/nw-js-handlers/register.js deleted file mode 100644 index 7a11f63..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/register.js +++ /dev/null @@ -1,38 +0,0 @@ -$(function() { - // Manejar el envío del formulario de creación de cuenta - $('#nw-create-form').on('submit', function(e) { - e.preventDefault(); - const data = $(this).serialize(); - const createResponse = $("#create-response"); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - createResponse.hide().empty(); - if (response.success) { - createResponse.html(`${response.message}`).slideDown(); - } else { - createResponse.html(`${response.message}`).slideDown(); - } - }, - error: function() { - createResponse.html('Error en el servidor. Inténtalo de nuevo más tarde.').slideDown(); - } - }); - }); - - // Manejar el estado del botón según el checkbox - $('#accept-terms-cookies').on('change', function() { - $('#create-account-btn').prop('disabled', !this.checked); - }); -}); - -// Función para habilitar/deshabilitar el botón según el estado del checkbox (alternativa sin jQuery) -function click_checkbox() { - const checkbox = document.getElementById('accept-terms-cookies'); - const createButton = document.getElementById('create-account-btn'); - createButton.disabled = !checkbox.checked; -} diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js deleted file mode 100644 index 26f95e0..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js +++ /dev/null @@ -1,83 +0,0 @@ -if (window.history.replaceState) { - window.history.replaceState(null, null, window.location.href); -}; - -$(function(){ - $(".toggle-token").click(function() { - $(this).toggleClass("fa-eye fa-eye-slash"); - var type = $(this).hasClass("fa-eye-slash") ? "text" : "password"; - $("#security-token").attr("type", type); - }); -}); - -function doRefresh() { - $("#nw-rename-guild-form").load(document.URL + " #nw-rename-guild-form>*", function(){ - $.getScript('/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js'); - }); -} - -$(function(){ - $('select').on('change', function(){ - var select = $(this); - - select.css('color', select.children('option:selected').css('color')); - }); -}); - -$(function(){ - $('.rename-guild-button').on('click', function(e) { - e.preventDefault(); - e.stopPropagation(); - $("#rename-guild-response").empty(); - - var button = $(this); - var buttonoriginal = button.html(); - var bValue = button.data('id'); - var data = {renameguild : bValue}; - data = $("#nw-rename-guild-form").serialize() + '&' + $.param(data); - - var conf = confirm("¿Estás seguro de renombrar la hermandad seleccionada?"); - - if (conf === true) { - changeButton(button, 'Procesando pago...'); - - $.ajax({ - type: 'POST', - url: '', // Asegúrate de que la URL es la correcta - data: data, - dataType: 'json', - success: function(data) { - if (data.success) { // ✅ Verificamos correctamente - if (typeof Stripe === 'undefined') { - console.error("Stripe.js no está cargado."); - $("#rename-guild-response").append('Error al cargar Stripe. Intente nuevamente más tarde.').hide().slideDown(); - restoreButton(button, buttonoriginal); - return; - } - - var stripe = Stripe(data.stripe_public_key); // ✅ Usamos correctamente el public key - - stripe.redirectToCheckout({ - sessionId: data.session_id // ✅ Ahora usamos data.session_id correctamente - }).then(function (result) { - if (result.error) { - $("#rename-guild-response").append('' + result.error.message + '').hide().slideDown(); - restoreButton(button, buttonoriginal); - } - }); - - } else { - $("#rename-guild-response").append(data.message).hide().slideDown(); - restoreButton(button, buttonoriginal); - } - }, - error: function () { - setTimeout(function () { - alert("Algo ha salido mal. Por favor intente más tarde"); - window.location.reload(); - }, 2000); - } - }); - } - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/revive_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/revive_response.js deleted file mode 100644 index 48fccbf..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/revive_response.js +++ /dev/null @@ -1,37 +0,0 @@ -$(document).ready(function() { - $('.revive-button').on('click', function(e) { - e.preventDefault(); - $("#revive-response").empty(); - - var button = $(this); - var originalText = button.html(); - var data = $("#nw-revive-form").serialize(); - - button.html("Reviviendo..."); - button.prop("disabled", true); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - $("#revive-response").html(response.message).hide().slideDown(); - if (response.success) { - button.html("Revivido"); - setTimeout(function() { - location.reload(); // Refrescar para actualizar el formulario - }, 5000); - } else { - button.html(originalText); - button.prop("disabled", false); - } - }, - error: function(xhr, status, error) { - $("#revive-response").html('Algo salió mal. Intente nuevamente.'); - button.html(originalText); - button.prop("disabled", false); - } - }); - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/security_token_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/security_token_response.js deleted file mode 100644 index d3550ac..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/security_token_response.js +++ /dev/null @@ -1,60 +0,0 @@ -$(function() { - $('.sec-token-button').on('click', function(e) { - e.preventDefault(); - - var button = $(this); - var originalText = button.html(); - var data = $("#nw-sec-token-form").serialize(); - - // Cambiar el texto del botón a "Solicitando token" - changeButton(button, 'Solicitando token'); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - $("#sec-token-response").html(response.message).hide().slideDown(); - - if (response.success) { - // Actualizar la fecha del token en la página si se ha generado correctamente - if (response.token_date) { - $("#token-date").text(response.token_date); - } - - // Cambiar el texto del botón a "Token enviado" - button.html("Token enviado").css("color", "#d79602"); - - // Restablecer el botón después de 5 segundos - setTimeout(function() { - restoreButton(button, originalText); - $("#sec-token-response").slideUp(function() { - $("#sec-token-response").empty(); - }); - }, 5000); - } else { - // Restablecer el botón y ocultar el mensaje en caso de error - setTimeout(function() { - $("#sec-token-response").slideUp(function() { - $("#sec-token-response").empty(); - restoreButton(button, originalText); - }); - }, 5000); - } - }, - error: function() { - alert("Algo ha salido mal. Por favor, intenta más tarde."); - window.location.reload(); - } - }); - }); -}); - -function changeButton(button, text) { - button.prop('disabled', true).html(text); -} - -function restoreButton(button, originalText) { - button.prop('disabled', false).html(originalText).css("color", ""); -} diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/transfer_character_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/transfer_character_response.js deleted file mode 100644 index b096b0d..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/transfer_character_response.js +++ /dev/null @@ -1,37 +0,0 @@ -$(function(){ - $('.transfer-button').on('click', function(e) { - e.preventDefault(); - $("#transfer-character-response").empty(); - - var button = $(this); - var originalText = button.text(); - var data = $("#nw-transfer-character-form").serialize(); - - button.text("Procesando pago..."); - button.prop("disabled", true); - - $.ajax({ - type: 'POST', - url: '', // URL de transferencia - data: data, - dataType: 'json', - success: function(response) { - if (response.success) { - var stripe = Stripe(response.stripe_public_key); - stripe.redirectToCheckout({ - sessionId: response.session_id - }); - } else { - $("#transfer-character-response").append(response.message).hide().slideDown(); - button.text(originalText); - button.prop("disabled", false); - } - }, - error: function() { - $("#transfer-character-response").append('Error inesperado. Intente más tarde.').hide().slideDown(); - button.text(originalText); - button.prop("disabled", false); - } - }); - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/unstuck_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/unstuck_response.js deleted file mode 100644 index 8e8cd6d..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/unstuck_response.js +++ /dev/null @@ -1,41 +0,0 @@ -$(function() { - $('.unstuck-button').on('click', function(e) { - e.preventDefault(); - e.stopPropagation(); - $("#unstuck-response").empty(); - - var button = $(this); - var originalText = button.html(); - var data = $("#nw-unstuck-form").serialize(); - - button.html("Desbloqueando..."); - button.prop("disabled", true); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(data) { - $("#unstuck-response").html(data.message).hide().slideDown(); - - if (data.success) { - button.html("Desbloqueado"); - setTimeout(function() { - $("#nw-unstuck-form")[0].reset(); - button.html(originalText); - button.prop("disabled", false); - }, 5000); - } else { - button.html(originalText); - button.prop("disabled", false); - } - }, - error: function() { - $("#unstuck-response").html('Algo ha salido mal. Inténtelo más tarde.'); - button.html(originalText); - button.prop("disabled", false); - } - }); - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js deleted file mode 100644 index 29072f2..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js +++ /dev/null @@ -1,83 +0,0 @@ -function doRefresh() { - $("#vote-panel").load(document.URL + " #vote-panel>*", function(){ - $.getScript('/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js'); - }); -} - -$(document).ready(function() { - $('.vote-button').each(function() { - var button = $(this); - var remainingTime = button.data('remaining-time'); - - if (remainingTime) { - startCooldownTimer(button, remainingTime); - } - }); - - $('.vote-button').on('click', function(e) { - e.preventDefault(); - $("#voteResponse").empty(); - - var button = $(this); - var voteUrl = button.data('url').trim(); - var data = { vote: voteUrl }; - - button.html("Votando..."); - button.prop("disabled", true); - - var otherWindow = window.open(voteUrl, "_blank"); - otherWindow.opener = null; - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - $("#voteResponse").html(response.message).hide().slideDown(); - - if (response.success) { - button.html("Votado"); - button.prop("disabled", true); - } else { - button.html("Votar"); - button.prop("disabled", false); - } - - // Ocultar el mensaje después de 5 segundos - setTimeout(function() { - $("#voteResponse").slideUp(function() { - $("#voteResponse").empty(); - }); - }, 5000); - }, - error: function() { - $("#voteResponse").html('Algo ha salido mal. Por favor, inténtalo más tarde.'); - - // Ocultar el mensaje después de 5 segundos en caso de error - setTimeout(function() { - $("#voteResponse").slideUp(function() { - $("#voteResponse").empty(); - }); - }, 5000); - } - }); - }); -}); - - - -function startCooldownTimer(button, remainingTime) { - var interval = setInterval(function() { - if (remainingTime <= 0) { - clearInterval(interval); - button.html("Votar"); - button.prop("disabled", false); - } else { - var hours = Math.floor(remainingTime / 3600); - var minutes = Math.floor((remainingTime % 3600) / 60); - button.html(`Espera ${hours}h ${minutes}m`); - remainingTime--; - } - }, 1000); -}
Redirigiendo...'); - loginResponse.hide().slideDown(); - - // Redirigir después de 3 segundos - setTimeout(function() { - window.location = "my-account"; - }, 3000); - } else if (response.alert === true) { - button.html("Sancionado"); - } else if (response.locked === true) { - button.html("Seguridad"); - } else { - // Mostrar mensaje para credenciales incorrectas - loginResponse.html('Nombre de usuario / Contraseña incorrectos.'); - loginResponse.hide().slideDown(); - - // Restaurar el botón y ocultar el mensaje después de 5 segundos - setTimeout(function() { - loginResponse.slideUp(function() { - loginResponse.empty(); - restoreButton(button, buttonOriginal); - }); - }, 5000); - } - }, - error: function() { - setTimeout(function() { - alert("Algo ha salido mal. Por favor intente más tarde"); - window.location.reload(); - }, 2000); - } - }); - }); -}); - -// Función para cambiar el estado del botón a "Conectando" -function changeButton(button, text) { - button.html(text); - button.prop("disabled", true); - button.css({ - "color": "rgb(177, 153, 127)", - "background-color": "rgba(255, 255, 255, 0.1)", - "cursor": "default" - }); -} - -// Función para restaurar el estado original del botón -function restoreButton(button, originalText) { - button.html(originalText); - button.prop("disabled", false); - button.css({ - "color": "", - "background-color": "", - "cursor": "" - }); -} \ No newline at end of file diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/register.js b/static/nw-themes/nw-ryu/nw-js-handlers/register.js deleted file mode 100644 index 7a11f63..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/register.js +++ /dev/null @@ -1,38 +0,0 @@ -$(function() { - // Manejar el envío del formulario de creación de cuenta - $('#nw-create-form').on('submit', function(e) { - e.preventDefault(); - const data = $(this).serialize(); - const createResponse = $("#create-response"); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - createResponse.hide().empty(); - if (response.success) { - createResponse.html(`${response.message}`).slideDown(); - } else { - createResponse.html(`${response.message}`).slideDown(); - } - }, - error: function() { - createResponse.html('Error en el servidor. Inténtalo de nuevo más tarde.').slideDown(); - } - }); - }); - - // Manejar el estado del botón según el checkbox - $('#accept-terms-cookies').on('change', function() { - $('#create-account-btn').prop('disabled', !this.checked); - }); -}); - -// Función para habilitar/deshabilitar el botón según el estado del checkbox (alternativa sin jQuery) -function click_checkbox() { - const checkbox = document.getElementById('accept-terms-cookies'); - const createButton = document.getElementById('create-account-btn'); - createButton.disabled = !checkbox.checked; -} diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js deleted file mode 100644 index 26f95e0..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js +++ /dev/null @@ -1,83 +0,0 @@ -if (window.history.replaceState) { - window.history.replaceState(null, null, window.location.href); -}; - -$(function(){ - $(".toggle-token").click(function() { - $(this).toggleClass("fa-eye fa-eye-slash"); - var type = $(this).hasClass("fa-eye-slash") ? "text" : "password"; - $("#security-token").attr("type", type); - }); -}); - -function doRefresh() { - $("#nw-rename-guild-form").load(document.URL + " #nw-rename-guild-form>*", function(){ - $.getScript('/static/nw-themes/nw-ryu/nw-js-handlers/rename_guild_response.js'); - }); -} - -$(function(){ - $('select').on('change', function(){ - var select = $(this); - - select.css('color', select.children('option:selected').css('color')); - }); -}); - -$(function(){ - $('.rename-guild-button').on('click', function(e) { - e.preventDefault(); - e.stopPropagation(); - $("#rename-guild-response").empty(); - - var button = $(this); - var buttonoriginal = button.html(); - var bValue = button.data('id'); - var data = {renameguild : bValue}; - data = $("#nw-rename-guild-form").serialize() + '&' + $.param(data); - - var conf = confirm("¿Estás seguro de renombrar la hermandad seleccionada?"); - - if (conf === true) { - changeButton(button, 'Procesando pago...'); - - $.ajax({ - type: 'POST', - url: '', // Asegúrate de que la URL es la correcta - data: data, - dataType: 'json', - success: function(data) { - if (data.success) { // ✅ Verificamos correctamente - if (typeof Stripe === 'undefined') { - console.error("Stripe.js no está cargado."); - $("#rename-guild-response").append('Error al cargar Stripe. Intente nuevamente más tarde.').hide().slideDown(); - restoreButton(button, buttonoriginal); - return; - } - - var stripe = Stripe(data.stripe_public_key); // ✅ Usamos correctamente el public key - - stripe.redirectToCheckout({ - sessionId: data.session_id // ✅ Ahora usamos data.session_id correctamente - }).then(function (result) { - if (result.error) { - $("#rename-guild-response").append('' + result.error.message + '').hide().slideDown(); - restoreButton(button, buttonoriginal); - } - }); - - } else { - $("#rename-guild-response").append(data.message).hide().slideDown(); - restoreButton(button, buttonoriginal); - } - }, - error: function () { - setTimeout(function () { - alert("Algo ha salido mal. Por favor intente más tarde"); - window.location.reload(); - }, 2000); - } - }); - } - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/revive_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/revive_response.js deleted file mode 100644 index 48fccbf..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/revive_response.js +++ /dev/null @@ -1,37 +0,0 @@ -$(document).ready(function() { - $('.revive-button').on('click', function(e) { - e.preventDefault(); - $("#revive-response").empty(); - - var button = $(this); - var originalText = button.html(); - var data = $("#nw-revive-form").serialize(); - - button.html("Reviviendo..."); - button.prop("disabled", true); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - $("#revive-response").html(response.message).hide().slideDown(); - if (response.success) { - button.html("Revivido"); - setTimeout(function() { - location.reload(); // Refrescar para actualizar el formulario - }, 5000); - } else { - button.html(originalText); - button.prop("disabled", false); - } - }, - error: function(xhr, status, error) { - $("#revive-response").html('Algo salió mal. Intente nuevamente.'); - button.html(originalText); - button.prop("disabled", false); - } - }); - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/security_token_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/security_token_response.js deleted file mode 100644 index d3550ac..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/security_token_response.js +++ /dev/null @@ -1,60 +0,0 @@ -$(function() { - $('.sec-token-button').on('click', function(e) { - e.preventDefault(); - - var button = $(this); - var originalText = button.html(); - var data = $("#nw-sec-token-form").serialize(); - - // Cambiar el texto del botón a "Solicitando token" - changeButton(button, 'Solicitando token'); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - $("#sec-token-response").html(response.message).hide().slideDown(); - - if (response.success) { - // Actualizar la fecha del token en la página si se ha generado correctamente - if (response.token_date) { - $("#token-date").text(response.token_date); - } - - // Cambiar el texto del botón a "Token enviado" - button.html("Token enviado").css("color", "#d79602"); - - // Restablecer el botón después de 5 segundos - setTimeout(function() { - restoreButton(button, originalText); - $("#sec-token-response").slideUp(function() { - $("#sec-token-response").empty(); - }); - }, 5000); - } else { - // Restablecer el botón y ocultar el mensaje en caso de error - setTimeout(function() { - $("#sec-token-response").slideUp(function() { - $("#sec-token-response").empty(); - restoreButton(button, originalText); - }); - }, 5000); - } - }, - error: function() { - alert("Algo ha salido mal. Por favor, intenta más tarde."); - window.location.reload(); - } - }); - }); -}); - -function changeButton(button, text) { - button.prop('disabled', true).html(text); -} - -function restoreButton(button, originalText) { - button.prop('disabled', false).html(originalText).css("color", ""); -} diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/transfer_character_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/transfer_character_response.js deleted file mode 100644 index b096b0d..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/transfer_character_response.js +++ /dev/null @@ -1,37 +0,0 @@ -$(function(){ - $('.transfer-button').on('click', function(e) { - e.preventDefault(); - $("#transfer-character-response").empty(); - - var button = $(this); - var originalText = button.text(); - var data = $("#nw-transfer-character-form").serialize(); - - button.text("Procesando pago..."); - button.prop("disabled", true); - - $.ajax({ - type: 'POST', - url: '', // URL de transferencia - data: data, - dataType: 'json', - success: function(response) { - if (response.success) { - var stripe = Stripe(response.stripe_public_key); - stripe.redirectToCheckout({ - sessionId: response.session_id - }); - } else { - $("#transfer-character-response").append(response.message).hide().slideDown(); - button.text(originalText); - button.prop("disabled", false); - } - }, - error: function() { - $("#transfer-character-response").append('Error inesperado. Intente más tarde.').hide().slideDown(); - button.text(originalText); - button.prop("disabled", false); - } - }); - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/unstuck_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/unstuck_response.js deleted file mode 100644 index 8e8cd6d..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/unstuck_response.js +++ /dev/null @@ -1,41 +0,0 @@ -$(function() { - $('.unstuck-button').on('click', function(e) { - e.preventDefault(); - e.stopPropagation(); - $("#unstuck-response").empty(); - - var button = $(this); - var originalText = button.html(); - var data = $("#nw-unstuck-form").serialize(); - - button.html("Desbloqueando..."); - button.prop("disabled", true); - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(data) { - $("#unstuck-response").html(data.message).hide().slideDown(); - - if (data.success) { - button.html("Desbloqueado"); - setTimeout(function() { - $("#nw-unstuck-form")[0].reset(); - button.html(originalText); - button.prop("disabled", false); - }, 5000); - } else { - button.html(originalText); - button.prop("disabled", false); - } - }, - error: function() { - $("#unstuck-response").html('Algo ha salido mal. Inténtelo más tarde.'); - button.html(originalText); - button.prop("disabled", false); - } - }); - }); -}); diff --git a/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js b/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js deleted file mode 100644 index 29072f2..0000000 --- a/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js +++ /dev/null @@ -1,83 +0,0 @@ -function doRefresh() { - $("#vote-panel").load(document.URL + " #vote-panel>*", function(){ - $.getScript('/static/nw-themes/nw-ryu/nw-js-handlers/vote_points_response.js'); - }); -} - -$(document).ready(function() { - $('.vote-button').each(function() { - var button = $(this); - var remainingTime = button.data('remaining-time'); - - if (remainingTime) { - startCooldownTimer(button, remainingTime); - } - }); - - $('.vote-button').on('click', function(e) { - e.preventDefault(); - $("#voteResponse").empty(); - - var button = $(this); - var voteUrl = button.data('url').trim(); - var data = { vote: voteUrl }; - - button.html("Votando..."); - button.prop("disabled", true); - - var otherWindow = window.open(voteUrl, "_blank"); - otherWindow.opener = null; - - $.ajax({ - type: 'POST', - url: '', - data: data, - dataType: 'json', - success: function(response) { - $("#voteResponse").html(response.message).hide().slideDown(); - - if (response.success) { - button.html("Votado"); - button.prop("disabled", true); - } else { - button.html("Votar"); - button.prop("disabled", false); - } - - // Ocultar el mensaje después de 5 segundos - setTimeout(function() { - $("#voteResponse").slideUp(function() { - $("#voteResponse").empty(); - }); - }, 5000); - }, - error: function() { - $("#voteResponse").html('Algo ha salido mal. Por favor, inténtalo más tarde.'); - - // Ocultar el mensaje después de 5 segundos en caso de error - setTimeout(function() { - $("#voteResponse").slideUp(function() { - $("#voteResponse").empty(); - }); - }, 5000); - } - }); - }); -}); - - - -function startCooldownTimer(button, remainingTime) { - var interval = setInterval(function() { - if (remainingTime <= 0) { - clearInterval(interval); - button.html("Votar"); - button.prop("disabled", false); - } else { - var hours = Math.floor(remainingTime / 3600); - var minutes = Math.floor((remainingTime % 3600) / 60); - button.html(`Espera ${hours}h ${minutes}m`); - remainingTime--; - } - }, 1000); -}