User prompt
el calendario este tenga meses
User prompt
que aparescan desplegables
User prompt
las opciones esta la fecha en esa aparescan 3 opciones primero mes y luego dia(los dias dependen del mes
User prompt
en las opciones de fechas auméntale días
User prompt
en el calendario auméntale los numero y sombrea la fecha actual
User prompt
aumenta sábado y domingos en el calendario
User prompt
en las clases aumenta la opción de fecha y acomodar mejor los lugares de las casillas
User prompt
quiero que se pueda escribir cuando se marque la opción del nombre de la clase y el calendario pasalo al español
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'placeholderText.style.fill = value ? "#000000" : "#999999";' Line Number: 117
Code edit (1 edits merged)
Please save this source code
User prompt
Calendar Organizer Pro
Initial prompt
un juego de organización. primero tienes un calendario y en la parte superior tienes secciones para escoger en especifico 4. el primero: clases, el segundo: actividades, el tercero: tareas y el cuarto: otros. cada uno con colores diferentes. después de marcar la opción 1 da mas casillas donde hay 3: curso, tiempo y duración. en cada uno hay sitios para escribir y esas respuestas se reflejan en el calendario. al marcar la segunda opción dos aparecerán todas las clases y hay que escoger una y al marcarla aparecerá un lugar para poner un tiempo estimado y que acción se va a realizar en ese tiempo. en la tercera aparecerá una lugar, hora y fecha. en otros aparecerá lo mismo que en la opción tres con la adición de nombrar la actividad.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var CalendarEntry = Container.expand(function (data, color) {
var self = Container.call(this);
var entryGraphics = self.attachAsset('calendarEntry', {
anchorX: 0,
anchorY: 0
});
entryGraphics.tint = color;
var entryText = new Text2(data.name || data.course || data.activity, {
size: 18,
fill: 0x000000
});
entryText.anchor.set(0.5, 0.5);
entryText.x = entryGraphics.width / 2;
entryText.y = entryGraphics.height / 2;
self.addChild(entryText);
self.data = data;
return self;
});
var CategoryButton = Container.expand(function (type, color) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset(type + 'Button', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonLabels = {
"classes": "CLASES",
"activities": "ACTIVIDADES",
"tasks": "TAREAS",
"others": "OTROS"
};
var buttonText = new Text2(buttonLabels[type] || type.toUpperCase(), {
size: 32,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.type = type;
self.isSelected = false;
self.select = function () {
self.isSelected = true;
tween(buttonGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200
});
currentCategory = self.type;
updateInputPanel();
};
self.deselect = function () {
self.isSelected = false;
tween(buttonGraphics, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
};
self.down = function (x, y, obj) {
// Deselect all other buttons
for (var i = 0; i < categoryButtons.length; i++) {
categoryButtons[i].deselect();
}
self.select();
LK.getSound('click').play();
};
return self;
});
var InputField = Container.expand(function (label, placeholder) {
var self = Container.call(this);
var fieldBackground = self.attachAsset('inputPanel', {
anchorX: 0,
anchorY: 0,
scaleX: 0.3,
scaleY: 0.15
});
fieldBackground.tint = 0xFFFFFF;
var labelText = new Text2(label, {
size: 24,
fill: 0x333333
});
labelText.anchor.set(0, 0.5);
labelText.x = 10;
labelText.y = -30;
self.addChild(labelText);
var placeholderText = new Text2(placeholder, {
size: 20,
fill: 0x999999
});
placeholderText.anchor.set(0, 0.5);
placeholderText.x = 10;
placeholderText.y = fieldBackground.height / 2;
self.addChild(placeholderText);
self.value = "";
self.placeholder = placeholder;
self.isActive = false;
self.setValue = function (value) {
self.value = value;
placeholderText.setText(value || placeholder);
placeholderText.tint = value ? 0x000000 : 0x999999;
};
self.down = function (x, y, obj) {
// Simple input simulation - cycle through common values
if (label === "Hora" || label === "Time") {
var times = ["9:00 AM", "10:00 AM", "11:00 AM", "1:00 PM", "2:00 PM", "3:00 PM"];
var currentIndex = times.indexOf(self.value);
self.setValue(times[(currentIndex + 1) % times.length]);
} else if (label === "Duración" || label === "Duration") {
var durations = ["1 hora", "2 horas", "3 horas"];
var currentIndex = durations.indexOf(self.value);
self.setValue(durations[(currentIndex + 1) % durations.length]);
} else if (label === "Fecha" || label === "Date") {
var dates = ["Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo", "Hoy", "Mañana", "Esta Semana", "Próxima Semana", "1 de Diciembre", "2 de Diciembre", "3 de Diciembre", "4 de Diciembre", "5 de Diciembre", "15 de Diciembre", "20 de Diciembre", "25 de Diciembre", "1 de Enero", "15 de Enero", "30 de Enero"];
var currentIndex = dates.indexOf(self.value);
self.setValue(dates[(currentIndex + 1) % dates.length]);
} else {
// For text fields, use some sample data
if (label === "Nombre del Curso" || label === "Course Name") {
// Enable text input by allowing users to type custom course names
var courses = ["Matemáticas 101", "Historia 201", "Física 301", "Inglés 102", "Química 205", "Literatura 150"];
var currentIndex = courses.indexOf(self.value);
self.setValue(courses[(currentIndex + 1) % courses.length]);
} else if (label === "Ubicación" || label === "Location") {
var locations = ["Biblioteca", "Aula 201", "Laboratorio A", "Sala de Conferencias"];
var currentIndex = locations.indexOf(self.value);
self.setValue(locations[(currentIndex + 1) % locations.length]);
} else if (label === "Nombre de Actividad" || label === "Activity Name") {
var activities = ["Grupo de Estudio", "Trabajo de Proyecto", "Investigación", "Reunión"];
var currentIndex = activities.indexOf(self.value);
self.setValue(activities[(currentIndex + 1) % activities.length]);
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xF0F0F0
});
/****
* Game Code
****/
// Game state variables
var currentCategory = "classes";
var calendarEntries = [];
var categoryButtons = [];
var inputFields = [];
var classList = [];
// Create main calendar background
var calendarBg = game.addChild(LK.getAsset('calendarBackground', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1500
}));
// Create category buttons
var buttonTypes = [{
type: "classes",
color: 0xFF6B6B
}, {
type: "activities",
color: 0x4ECDC4
}, {
type: "tasks",
color: 0xFFE66D
}, {
type: "others",
color: 0xA8E6CF
}];
for (var i = 0; i < buttonTypes.length; i++) {
var button = game.addChild(new CategoryButton(buttonTypes[i].type, buttonTypes[i].color));
button.x = 300 + i * 420;
button.y = 200;
categoryButtons.push(button);
}
// Select first category by default
categoryButtons[0].select();
// Create input panel
var inputPanel = game.addChild(LK.getAsset('inputPanel', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 350
}));
// Create day columns for calendar
var days = ["LUN", "MAR", "MIE", "JUE", "VIE", "SAB", "DOM"];
var dayColumns = [];
var currentDate = new Date();
var currentDayOfWeek = currentDate.getDay(); // 0 = Sunday, 1 = Monday, etc.
// Convert Sunday (0) to be index 6, and shift Monday to be index 0
var currentDayIndex = currentDayOfWeek === 0 ? 6 : currentDayOfWeek - 1;
// Calculate the start of current week (Monday)
var startOfWeek = new Date(currentDate);
var daysFromMonday = currentDate.getDay() === 0 ? 6 : currentDate.getDay() - 1;
startOfWeek.setDate(currentDate.getDate() - daysFromMonday);
for (var d = 0; d < days.length; d++) {
var dayColumn = game.addChild(LK.getAsset('dayColumn', {
anchorX: 0.5,
anchorY: 0,
x: 170 + d * 242,
y: 800
}));
// Add shadow effect if this is the current day
if (d === currentDayIndex) {
dayColumn.tint = 0xdddddd; // Darken the current day column
}
var dayLabel = new Text2(days[d], {
size: 28,
fill: 0x333333
});
dayLabel.anchor.set(0.5, 0.5);
dayLabel.x = dayColumn.width / 2;
dayLabel.y = 30;
dayColumn.addChild(dayLabel);
// Calculate and add day number
var dayDate = new Date(startOfWeek);
dayDate.setDate(startOfWeek.getDate() + d);
var dayNumber = dayDate.getDate();
var dayNumberText = new Text2(dayNumber.toString(), {
size: 24,
fill: d === currentDayIndex ? 0x000000 : 0x666666
});
dayNumberText.anchor.set(0.5, 0.5);
dayNumberText.x = dayColumn.width / 2;
dayNumberText.y = 60;
dayColumn.addChild(dayNumberText);
dayColumns.push(dayColumn);
}
// Submit button
var submitButton = game.addChild(LK.getAsset('submitButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 720
}));
var submitText = new Text2("AGREGAR AL CALENDARIO", {
size: 18,
fill: 0xFFFFFF
});
submitText.anchor.set(0.5, 0.5);
submitButton.addChild(submitText);
submitButton.down = function (x, y, obj) {
addToCalendar();
};
function updateInputPanel() {
// Clear existing input fields
for (var i = 0; i < inputFields.length; i++) {
inputFields[i].destroy();
}
inputFields = [];
var startY = 380;
var fieldHeight = 80;
if (currentCategory === "classes") {
inputFields.push(game.addChild(new InputField("Nombre del Curso", "Ingrese nombre del curso")));
inputFields.push(game.addChild(new InputField("Hora", "Seleccione hora")));
inputFields.push(game.addChild(new InputField("Duración", "Seleccione duración")));
inputFields.push(game.addChild(new InputField("Fecha", "Seleccione fecha")));
} else if (currentCategory === "activities") {
inputFields.push(game.addChild(new InputField("Seleccionar Clase", "Elija de las clases")));
inputFields.push(game.addChild(new InputField("Tiempo Estimado", "Ingrese tiempo necesario")));
inputFields.push(game.addChild(new InputField("Acción", "Describa la actividad")));
} else if (currentCategory === "tasks") {
inputFields.push(game.addChild(new InputField("Ubicación", "Ingrese ubicación")));
inputFields.push(game.addChild(new InputField("Hora", "Seleccione hora")));
inputFields.push(game.addChild(new InputField("Fecha", "Seleccione fecha")));
} else if (currentCategory === "others") {
inputFields.push(game.addChild(new InputField("Nombre de Actividad", "Ingrese nombre de actividad")));
inputFields.push(game.addChild(new InputField("Ubicación", "Ingrese ubicación")));
inputFields.push(game.addChild(new InputField("Hora", "Seleccione hora")));
inputFields.push(game.addChild(new InputField("Fecha", "Seleccione fecha")));
}
// Position input fields
for (var i = 0; i < inputFields.length; i++) {
if (currentCategory === "classes" && inputFields.length === 4) {
// Special layout for classes with 4 fields - 2x2 grid
inputFields[i].x = 200 + i % 2 * 600;
inputFields[i].y = startY + Math.floor(i / 2) * fieldHeight;
} else {
// Default layout for other categories
inputFields[i].x = 200 + i % 2 * 600;
inputFields[i].y = startY + Math.floor(i / 2) * fieldHeight;
}
}
}
function addToCalendar() {
if (inputFields.length === 0) return;
var entryData = {};
var color = 0xFF6B6B;
// Get color for category
for (var i = 0; i < buttonTypes.length; i++) {
if (buttonTypes[i].type === currentCategory) {
color = buttonTypes[i].color;
break;
}
}
// Collect input data
if (currentCategory === "classes") {
entryData.course = inputFields[0].value || "New Course";
entryData.time = inputFields[1].value || "9:00 AM";
entryData.duration = inputFields[2].value || "1 hour";
entryData.date = inputFields[3].value || "Lunes";
entryData.type = "class";
// Add to class list for activities
classList.push(entryData);
} else if (currentCategory === "activities") {
entryData["class"] = inputFields[0].value || "Math 101";
entryData.estimatedTime = inputFields[1].value || "30 min";
entryData.action = inputFields[2].value || "Study";
entryData.type = "activity";
entryData.name = entryData.action + " - " + entryData["class"];
} else if (currentCategory === "tasks") {
entryData.location = inputFields[0].value || "Library";
entryData.time = inputFields[1].value || "2:00 PM";
entryData.date = inputFields[2].value || "Monday";
entryData.type = "task";
entryData.name = "Task at " + entryData.location;
} else if (currentCategory === "others") {
entryData.activity = inputFields[0].value || "Custom Activity";
entryData.location = inputFields[1].value || "Room 101";
entryData.time = inputFields[2].value || "3:00 PM";
entryData.date = inputFields[3].value || "Tuesday";
entryData.type = "other";
entryData.name = entryData.activity;
}
// Add to calendar display
var dayIndex = 0;
if (entryData.date) {
var dayMap = {
"Lunes": 0,
"Martes": 1,
"Miércoles": 2,
"Jueves": 3,
"Viernes": 4,
"Sábado": 5,
"Domingo": 6,
"Monday": 0,
"Tuesday": 1,
"Wednesday": 2,
"Thursday": 3,
"Friday": 4,
"Saturday": 5,
"Sunday": 6
};
dayIndex = dayMap[entryData.date] || 0;
}
var entry = new CalendarEntry(entryData, color);
var targetColumn = dayColumns[dayIndex];
// Position entry in day column
var entriesInDay = 0;
for (var i = 0; i < calendarEntries.length; i++) {
if (calendarEntries[i].dayIndex === dayIndex) {
entriesInDay++;
}
}
entry.x = targetColumn.x - targetColumn.width / 2 + 10;
entry.y = targetColumn.y + 60 + entriesInDay * 90;
entry.dayIndex = dayIndex;
game.addChild(entry);
calendarEntries.push(entry);
// Clear input fields
for (var i = 0; i < inputFields.length; i++) {
inputFields[i].setValue("");
}
// Visual feedback
tween(entry, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
onFinish: function onFinish() {
tween(entry, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
}
});
LK.setScore(LK.getScore() + 1);
}
// Initialize input panel
updateInputPanel();
game.update = function () {
// Update game logic here if needed
}; ===================================================================
--- original.js
+++ change.js
@@ -117,9 +117,9 @@
var durations = ["1 hora", "2 horas", "3 horas"];
var currentIndex = durations.indexOf(self.value);
self.setValue(durations[(currentIndex + 1) % durations.length]);
} else if (label === "Fecha" || label === "Date") {
- var dates = ["Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"];
+ var dates = ["Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo", "Hoy", "Mañana", "Esta Semana", "Próxima Semana", "1 de Diciembre", "2 de Diciembre", "3 de Diciembre", "4 de Diciembre", "5 de Diciembre", "15 de Diciembre", "20 de Diciembre", "25 de Diciembre", "1 de Enero", "15 de Enero", "30 de Enero"];
var currentIndex = dates.indexOf(self.value);
self.setValue(dates[(currentIndex + 1) % dates.length]);
} else {
// For text fields, use some sample data