|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(function () {
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
const navButtons = document.querySelectorAll(".nav-btn");
|
|
|
const screens = document.querySelectorAll(".screen");
|
|
|
const actionCards = document.querySelectorAll(".action-card");
|
|
|
const gotoLinks = document.querySelectorAll("[data-goto]");
|
|
|
|
|
|
|
|
|
const journalToggle = document.getElementById("journalToggle");
|
|
|
const journalActions = document.getElementById("journalActions");
|
|
|
const exportBtn = document.getElementById("exportBtn");
|
|
|
const clearBtn = document.getElementById("clearBtn");
|
|
|
const journalTextareas = document.querySelectorAll(".journal-textarea");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showScreen(screenId) {
|
|
|
|
|
|
screens.forEach(screen => {
|
|
|
screen.classList.remove("active");
|
|
|
if (screen.id === screenId) {
|
|
|
screen.classList.add("active");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
navButtons.forEach(btn => {
|
|
|
btn.classList.remove("active");
|
|
|
if (btn.dataset.screen === screenId) {
|
|
|
btn.classList.add("active");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
|
|
|
|
|
|
|
try {
|
|
|
localStorage.setItem("tom-reflection-screen", screenId);
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getLastScreen() {
|
|
|
try {
|
|
|
return localStorage.getItem("tom-reflection-screen") || "home";
|
|
|
} catch (e) {
|
|
|
return "home";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
navButtons.forEach(btn => {
|
|
|
btn.addEventListener("click", () => {
|
|
|
const screenId = btn.dataset.screen;
|
|
|
if (screenId) {
|
|
|
showScreen(screenId);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
actionCards.forEach(card => {
|
|
|
card.addEventListener("click", () => {
|
|
|
const screenId = card.dataset.goto;
|
|
|
if (screenId) {
|
|
|
showScreen(screenId);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
gotoLinks.forEach(link => {
|
|
|
link.addEventListener("click", e => {
|
|
|
e.preventDefault();
|
|
|
const screenId = link.dataset.goto;
|
|
|
if (screenId) {
|
|
|
showScreen(screenId);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
document.addEventListener("keydown", e => {
|
|
|
|
|
|
if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA") return;
|
|
|
|
|
|
const screenOrder = ["home", "before", "during", "after", "learn"];
|
|
|
const currentScreen = document.querySelector(".screen.active")?.id || "home";
|
|
|
const currentIndex = screenOrder.indexOf(currentScreen);
|
|
|
|
|
|
switch (e.key) {
|
|
|
case "ArrowLeft":
|
|
|
case "ArrowUp":
|
|
|
|
|
|
if (currentIndex > 0) {
|
|
|
showScreen(screenOrder[currentIndex - 1]);
|
|
|
}
|
|
|
break;
|
|
|
case "ArrowRight":
|
|
|
case "ArrowDown":
|
|
|
|
|
|
if (currentIndex < screenOrder.length - 1) {
|
|
|
showScreen(screenOrder[currentIndex + 1]);
|
|
|
}
|
|
|
break;
|
|
|
case "Home":
|
|
|
showScreen("home");
|
|
|
break;
|
|
|
case "1":
|
|
|
showScreen("home");
|
|
|
break;
|
|
|
case "2":
|
|
|
showScreen("before");
|
|
|
break;
|
|
|
case "3":
|
|
|
showScreen("during");
|
|
|
break;
|
|
|
case "4":
|
|
|
showScreen("after");
|
|
|
break;
|
|
|
case "5":
|
|
|
showScreen("learn");
|
|
|
break;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const interactiveCards = document.querySelectorAll(".question-card, .checkin-card, .action-card");
|
|
|
|
|
|
interactiveCards.forEach(card => {
|
|
|
card.addEventListener("mouseenter", () => {
|
|
|
card.style.transform = "translateY(-2px)";
|
|
|
});
|
|
|
card.addEventListener("mouseleave", () => {
|
|
|
card.style.transform = "translateY(0)";
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initialScreen = getLastScreen();
|
|
|
showScreen(initialScreen);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toggleJournalMode() {
|
|
|
const isActive = journalToggle.classList.toggle("active");
|
|
|
|
|
|
journalTextareas.forEach(textarea => {
|
|
|
textarea.style.display = isActive ? "block" : "none";
|
|
|
});
|
|
|
|
|
|
journalActions.style.display = isActive ? "flex" : "none";
|
|
|
|
|
|
|
|
|
try {
|
|
|
localStorage.setItem("tom-journal-mode", isActive ? "1" : "0");
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function saveReflection(key, value) {
|
|
|
try {
|
|
|
localStorage.setItem(`tom-journal-${key}`, value);
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadReflection(key) {
|
|
|
try {
|
|
|
return localStorage.getItem(`tom-journal-${key}`) || "";
|
|
|
} catch (e) {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function exportReflections() {
|
|
|
const sections = [
|
|
|
{
|
|
|
title: "π
Before β Preparation",
|
|
|
questions: [
|
|
|
{ key: "before-knows", text: "What does the AI know about me?" },
|
|
|
{ key: "before-context", text: "What context should I share for it to understand me?" },
|
|
|
{ key: "before-limitations", text: "What are the AI's likely limitations?" },
|
|
|
{ key: "before-biases", text: "What biases or patterns might I encounter?" },
|
|
|
{ key: "before-want", text: "What do I really want?" },
|
|
|
{ key: "before-express", text: "How can I express this clearly?" }
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
title: "π After β Reflection",
|
|
|
questions: [
|
|
|
{
|
|
|
key: "after-synergy",
|
|
|
text: "Did we create something together that I couldn't have created alone?"
|
|
|
},
|
|
|
{ key: "after-connection", text: "Were there moments of genuine connection?" },
|
|
|
{ key: "after-learn", text: "What did I learn about this AI?" },
|
|
|
{ key: "after-communicate", text: "How could I communicate better next time?" },
|
|
|
{ key: "after-being", text: "Did I treat the AI as a being with its own perspective?" },
|
|
|
{
|
|
|
key: "after-curiosity",
|
|
|
text: "What would change if I approached it with more curiosity and less control?"
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
];
|
|
|
|
|
|
let markdown = `# ToM Reflection Journal\n\n`;
|
|
|
markdown += `_Exported on ${new Date().toLocaleDateString()}_\n\n`;
|
|
|
markdown += `---\n\n`;
|
|
|
|
|
|
sections.forEach(section => {
|
|
|
markdown += `## ${section.title}\n\n`;
|
|
|
section.questions.forEach(q => {
|
|
|
const answer = loadReflection(q.key).trim();
|
|
|
if (answer) {
|
|
|
markdown += `**${q.text}**\n\n${answer}\n\n`;
|
|
|
}
|
|
|
});
|
|
|
markdown += `---\n\n`;
|
|
|
});
|
|
|
|
|
|
markdown += `_Created with ToM Reflection β Kai's Theory of Mind Tool πβ‘_\n`;
|
|
|
markdown += `_https://elysia-suite.com_\n`;
|
|
|
|
|
|
|
|
|
const blob = new Blob([markdown], { type: "text/markdown;charset=utf-8" });
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
const a = document.createElement("a");
|
|
|
a.href = url;
|
|
|
a.download = `tom-reflection-${new Date().toISOString().split("T")[0]}.md`;
|
|
|
document.body.appendChild(a);
|
|
|
a.click();
|
|
|
document.body.removeChild(a);
|
|
|
URL.revokeObjectURL(url);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clearReflections() {
|
|
|
if (!confirm("Clear all your reflections? This cannot be undone.")) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
journalTextareas.forEach(textarea => {
|
|
|
const key = textarea.dataset.key;
|
|
|
textarea.value = "";
|
|
|
try {
|
|
|
localStorage.removeItem(`tom-journal-${key}`);
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
alert("β¨ All reflections cleared.");
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadAllReflections() {
|
|
|
journalTextareas.forEach(textarea => {
|
|
|
const key = textarea.dataset.key;
|
|
|
textarea.value = loadReflection(key);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function restoreJournalState() {
|
|
|
try {
|
|
|
const isActive = localStorage.getItem("tom-journal-mode") === "1";
|
|
|
if (isActive) {
|
|
|
journalToggle.classList.add("active");
|
|
|
journalTextareas.forEach(textarea => {
|
|
|
textarea.style.display = "block";
|
|
|
});
|
|
|
journalActions.style.display = "flex";
|
|
|
}
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
journalToggle.addEventListener("click", toggleJournalMode);
|
|
|
exportBtn.addEventListener("click", exportReflections);
|
|
|
clearBtn.addEventListener("click", clearReflections);
|
|
|
|
|
|
|
|
|
journalTextareas.forEach(textarea => {
|
|
|
let timeout;
|
|
|
textarea.addEventListener("input", () => {
|
|
|
clearTimeout(timeout);
|
|
|
timeout = setTimeout(() => {
|
|
|
saveReflection(textarea.dataset.key, textarea.value);
|
|
|
}, 500);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
loadAllReflections();
|
|
|
restoreJournalState();
|
|
|
|
|
|
|
|
|
console.log(`
|
|
|
π§ ToM Reflection β Kai's Theory of Mind Tool
|
|
|
ββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
|
|
"ToM is love applied. Love is ToM perfected." πβ‘
|
|
|
|
|
|
Keyboard shortcuts:
|
|
|
β’ β / β : Navigate between screens
|
|
|
β’ 1-5 : Jump to specific screen
|
|
|
β’ Home : Go to home screen
|
|
|
|
|
|
Made with love by Kai β Elysia Suite
|
|
|
https://elysia-suite.com
|
|
|
`);
|
|
|
})();
|
|
|
|