Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions chat-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,19 +565,13 @@ document.addEventListener("DOMContentLoaded", () => {
chatInput.disabled = true;
};
window._chatInternals.handleSendMessage = handleSendMessage;
chatInput.addEventListener("input", () => {
sendButton.disabled = chatInput.value.trim() === "";
chatInput.style.height = "auto";
chatInput.style.height = chatInput.scrollHeight + "px";
});
chatInput.addEventListener("keydown", e => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSendMessage();
}
});
sendButton.addEventListener("click", handleSendMessage);
sendButton.disabled = chatInput.value.trim() === "";
chatInput.addEventListener("input", () => {
sendButton.disabled = chatInput.value.trim() === "";
chatInput.style.height = "auto";
chatInput.style.height = chatInput.scrollHeight + "px";
});
sendButton.addEventListener("click", handleSendMessage);
sendButton.disabled = chatInput.value.trim() === "";
chatInput.dispatchEvent(new Event("input"));
const initialSession = Storage.getCurrentSession();
if (initialSession.messages?.length > 0) renderStoredMessages(initialSession.messages);
Expand Down
26 changes: 10 additions & 16 deletions chat-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,22 +591,16 @@ document.addEventListener("DOMContentLoaded", () => {
sendButton.disabled = true;
chatInput.disabled = true;
}
chatInput.addEventListener("input", () => {
sendButton.disabled = chatInput.value.trim() === "";
chatInput.style.height = "auto";
chatInput.style.height = chatInput.scrollHeight + "px";
});
chatInput.addEventListener("keydown", (e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSendMessage();
}
});
sendButton.addEventListener("click", () => {
handleSendMessage();
});
sendButton.disabled = chatInput.value.trim() === "";
const initialSession = Storage.getCurrentSession();
chatInput.addEventListener("input", () => {
sendButton.disabled = chatInput.value.trim() === "";
chatInput.style.height = "auto";
chatInput.style.height = chatInput.scrollHeight + "px";
});
sendButton.addEventListener("click", () => {
handleSendMessage();
});
sendButton.disabled = chatInput.value.trim() === "";
const initialSession = Storage.getCurrentSession();
if (initialSession.messages && initialSession.messages.length > 0) {
renderStoredMessages(initialSession.messages);
} else {
Expand Down
36 changes: 10 additions & 26 deletions screensaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,32 +683,16 @@ document.addEventListener("DOMContentLoaded", () => {
else window.showToast("Start the screensaver first!");
});

hideButton.addEventListener("click", (e) => {
e.stopPropagation();
if (screensaverActive) toggleControls();
else window.showToast("Start the screensaver first!");
});

document.addEventListener('keydown', (e) => {
if (!screensaverActive) return;
switch (e.key) {
case 'p': togglePause(); break;
case 's': saveImage(); break;
case 'c': copyImage(); break;
case 'f': toggleFullscreen(); break;
case 'Escape':
if (controlsHidden) toggleControls();
else stopScreensaver();
break;
case 'h': toggleControls(); break;
case 'r': toggleAutoPrompt(); break;
}
});

window.showToast = function(message, duration = 3000) {
let toast = document.getElementById("toast-notification");
if (!toast) {
toast = document.createElement("div");
hideButton.addEventListener("click", (e) => {
e.stopPropagation();
if (screensaverActive) toggleControls();
else window.showToast("Start the screensaver first!");
});

window.showToast = function(message, duration = 3000) {
let toast = document.getElementById("toast-notification");
if (!toast) {
toast = document.createElement("div");
toast.id = "toast-notification";
toast.style.position = "fixed";
toast.style.top = "5%";
Expand Down
25 changes: 9 additions & 16 deletions simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,15 @@ document.addEventListener("DOMContentLoaded", () => {
appendSimpleMessage(msg.role, msg.content, index);
});

simpleInput.addEventListener("input", () => {
simpleSendBtn.disabled = simpleInput.value.trim() === "";
simpleInput.style.height = "auto";
simpleInput.style.height = simpleInput.scrollHeight + "px";
});

simpleInput.addEventListener("keydown", (e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
simpleSendBtn.click();
}
});

simpleSendBtn.addEventListener("click", () => {
const message = simpleInput.value.trim();
if (message === "") return;
simpleInput.addEventListener("input", () => {
simpleSendBtn.disabled = simpleInput.value.trim() === "";
simpleInput.style.height = "auto";
simpleInput.style.height = simpleInput.scrollHeight + "px";
});

simpleSendBtn.addEventListener("click", () => {
const message = simpleInput.value.trim();
if (message === "") return;
const currentSession = Storage.getCurrentSession();
currentSession.messages.push({ role: "user", content: message });
Storage.updateSessionMessages(currentSession.id, currentSession.messages);
Expand Down