Skip to content

Commit

Permalink
Dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanPerez9 committed Dec 6, 2023
1 parent c305ec4 commit db25ca0
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions assets/js/weekly.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ document.addEventListener("DOMContentLoaded", function() {
savedMeals[`${day}-${mealType}`] = mealInput.value;
localStorage.setItem("weeklyMeals", JSON.stringify(savedMeals));
});

// Event listener to handle the drop event
mealInput.addEventListener("drop", function(event) {
event.preventDefault();
Expand All @@ -103,7 +103,7 @@ document.addEventListener("DOMContentLoaded", function() {

// Event listener to prevent the default behavior and allow drop events on the input field
mealInput.addEventListener("dragover", function(event) {
event.preventDefault();
event.preventDefault();
});

return mealInput;
Expand All @@ -121,27 +121,6 @@ document.addEventListener("DOMContentLoaded", function() {
// Agregar cualquier código de limpieza necesario aquí
}

// Función para manejar el evento de soltar
function handleDrop(event) {
event.preventDefault();
const draggedItemText = event.dataTransfer.getData("text/plain");

// Identificar el campo de entrada de destino
const targetInput = document.activeElement;

// Verificar si el elemento activo es un campo de entrada
if (targetInput.tagName === 'INPUT' && targetInput.classList.contains('meal-input')) {
// Establecer el valor del campo de entrada al texto arrastrado
targetInput.value = draggedItemText;

// Guardar la comida ingresada en el almacenamiento local
const day = targetInput.getAttribute('data-day');
const mealType = targetInput.getAttribute('data-meal-type');
savedMeals[`${day}-${mealType}`] = targetInput.value;
localStorage.setItem("weeklyMeals", JSON.stringify(savedMeals));
}
}

// Botón para borrar todos los datos
const clearDataBtn = document.getElementById("clearDataBtn");
clearDataBtn.addEventListener("click", function() {
Expand Down

0 comments on commit db25ca0

Please sign in to comment.