EDIT
Save Current Configuration
Load Saved Configuration
co
Lock All
Clear All
ChatGPT
Perplexity
Google Docs
Hide inputs
Load
SRC 1
Pull Bottom Output → Top (Copy + Paste)
Lock
Clear
include
/* ========================================================= CTG EDITOR (GREEN BUTTON BAR REMOVED) - Keeps: edit toggle + panel editing (8 items) - Removes: ctg-bar and the green .ctg-btn button grid ========================================================= */ (function () { "use strict"; const STORAGE_PREFIX = "ctg"; const ITEM_COUNT = 8; const AUTO_SAVE_DELAY = 1000; const DEFAULT_TEXT = `THREAD CONTINUATION NOTICE: This prompt is an addendum to the existing ChatGPT thread titled "THREAD NAME OR TOPIC." All prior context, assumptions, findings, and conclusions from that thread are incorporated by reference and remain fully operative.`; const PANEL = document.getElementById("ctg-edit-panel"); const TOGGLE = document.getElementById("ctg-edit-toggle"); const SAVE_INDICATOR = document.getElementById("ctg-save-indicator"); if (!PANEL || !TOGGLE) return; let editMode = false; const autoSaveTimers = {}; const lastSaveTime = {}; function getFromStorage(key, fallback = DEFAULT_TEXT) { try { const val = localStorage.getItem(STORAGE_PREFIX + "_" + key); return val !== null ? val : fallback; } catch { return fallback; } } function getButtonTitle(i) { try { const val = localStorage.getItem(STORAGE_PREFIX + "_title" + i); return val !== null ? val : "C" + i; } catch { return "C" + i; } } function saveToStorage(key, value) { try { localStorage.setItem(STORAGE_PREFIX + "_" + key, value); lastSaveTime[key] = Date.now(); return true; } catch { return false; } } function saveButtonTitle(i, title) { try { localStorage.setItem(STORAGE_PREFIX + "_title" + i, title); return true; } catch { return false; } } function showSaveIndicator() { if (!SAVE_INDICATOR) return; SAVE_INDICATOR.style.display = "inline-block"; setTimeout(() => { SAVE_INDICATOR.style.display = "none"; }, 600); } function getTimeSinceLastSave(key) { const savedAt = lastSaveTime[key]; if (!savedAt) return "Never"; const diff = Date.now() - savedAt; if (diff < 60000) return "Just now"; if (diff < 3600000) return Math.floor(diff / 60000) + "m ago"; return Math.floor(diff / 3600000) + "h ago"; } function setupAutoSave(key, ta) { ta.addEventListener("input", () => { if (autoSaveTimers[key]) clearTimeout(autoSaveTimers[key]); autoSaveTimers[key] = setTimeout(() => { if (saveToStorage(key, ta.value)) { showSaveIndicator(); const statusEl = document.getElementById("ctg-status-" + key); if (statusEl) statusEl.textContent = "Saved just now"; } }, AUTO_SAVE_DELAY); }); } function setupAutoSaveTitle(i, titleInput) { titleInput.addEventListener("input", () => { const k = "title" + i; if (autoSaveTimers[k]) clearTimeout(autoSaveTimers[k]); autoSaveTimers[k] = setTimeout(() => { const newTitle = titleInput.value.trim() || "C" + i; if (saveButtonTitle(i, newTitle)) { showSaveIndicator(); const statusEl = document.getElementById("ctg-status-title-" + i); if (statusEl) statusEl.textContent = "Title saved just now"; } }, AUTO_SAVE_DELAY); }); } function buildEditPanel() { PANEL.innerHTML = ""; for (let i = 1; i <= ITEM_COUNT; i++) { const key = "msg" + i; const itemContainer = document.createElement("div"); itemContainer.className = "ctg-edit-item"; const label = document.createElement("label"); label.className = "ctg-edit-label"; label.textContent = "CTG" + i; const sublabel = document.createElement("label"); sublabel.className = "ctg-edit-sublabel"; sublabel.textContent = "Button Title"; const titleInput = document.createElement("input"); titleInput.type = "text"; titleInput.value = getButtonTitle(i); titleInput.maxLength = "10"; titleInput.placeholder = "e.g., C" + i; const msgLabel = document.createElement("label"); msgLabel.className = "ctg-edit-sublabel"; msgLabel.textContent = "Message Content"; const ta = document.createElement("textarea"); ta.dataset.key = key; ta.value = getFromStorage(key); ta.placeholder = "Enter text (auto-saves after 1 second)"; const status = document.createElement("span"); status.className = "ctg-edit-save-status"; status.id = "ctg-status-" + key; status.textContent = "Saved: " + getTimeSinceLastSave(key); const statusTitle = document.createElement("span"); statusTitle.className = "ctg-edit-save-status"; statusTitle.id = "ctg-status-title-" + i; statusTitle.textContent = ""; itemContainer.appendChild(label); itemContainer.appendChild(sublabel); itemContainer.appendChild(titleInput); itemContainer.appendChild(statusTitle); itemContainer.appendChild(msgLabel); itemContainer.appendChild(ta); itemContainer.appendChild(status); PANEL.appendChild(itemContainer); setupAutoSave(key, ta); setupAutoSaveTitle(i, titleInput); } } function setEditMode(enabled) { editMode = enabled; if (enabled) { PANEL.style.display = "block"; TOGGLE.textContent = "CLOSE"; TOGGLE.style.background = "#ff6600"; } else { PANEL.style.display = "none"; TOGGLE.textContent = "EDIT"; TOGGLE.style.background = "#333"; } } TOGGLE.addEventListener("click", () => setEditMode(!editMode)); document.addEventListener("keydown", (e) => { if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === "E") { e.preventDefault(); setEditMode(!editMode); } if (e.key === "Escape" && editMode) setEditMode(false); }); window.addEventListener("beforeunload", () => { for (let key in autoSaveTimers) { if (autoSaveTimers[key]) clearTimeout(autoSaveTimers[key]); } }); buildEditPanel(); })();