lightweight, client-only calendar web application. All data persists in the URL hash for instant sharing, No backend required. Optional AES-GCM password protection keeps shared links locked without a server
JavaScript
update apps
Supun Lakmal11f1d1a09507
diff --git a/index.html b/index.htmlindex c20ec98..a444a18 100644--- a/index.html+++ b/index.html@@ -123,9 +123,6 @@data-i18n-aria-label="launcher.ariaLabel" aria-expanded="false"><i class="fa-solid fa-grip"></i></button>- <div id="app-launcher-menu" class="app-launcher-menu hidden">- <!-- Content injected by JS -->- </div></div><div class="action-divider desktop-only"></div>@@ -412,6 +409,23 @@</div></div>+ <div id="app-launcher-modal" class="modal hidden" role="dialog" aria-modal="true"+ aria-labelledby="app-launcher-modal-title">+ <div class="modal-backdrop"></div>+ <div class="app-launcher-modal-panel" role="document">+ <div class="app-launcher-modal-header">+ <h3 id="app-launcher-modal-title" class="app-launcher-modal-title">Apps</h3>+ <button id="app-launcher-close" type="button" class="app-launcher-modal-close" aria-label="Close app launcher">+ <i class="fa-solid fa-xmark" aria-hidden="true"></i>+ </button>+ </div>+ <div class="app-launcher-modal-body">+ <iframe id="app-launcher-iframe" title="Open Edit Apps" loading="lazy"+ referrerpolicy="strict-origin-when-cross-origin" src="" data-src="https://open-edit.netlify.app/apps.html"></iframe>+ </div>+ </div>+ </div>+<dialog id="tz-modal" class="tz-modal" aria-labelledby="tz-modal-title"><div class="tz-modal-card"><header class="tz-modal-header">diff --git a/modules/app_launcher.js b/modules/app_launcher.jsindex db3f070..fd9ac8b 100644--- a/modules/app_launcher.js+++ b/modules/app_launcher.js@@ -1,121 +1,60 @@-import { onLanguageChange, t } from './i18n.js';-+/**+ * AppLauncher Module+ * Opens the ecosystem apps page inside a modal iframe.+ */export class AppLauncher {- constructor() {- this.apps = [- {- nameKey: 'app.calendar',- url: 'https://hash-calendar.netlify.app/',- icon: 'fa-solid fa-calendar-days',- color: '#1a73e8'- },- {- nameKey: 'app.spreadsheet',- url: 'https://spreadsheetlive.netlify.app/',- icon: 'fa-solid fa-table-cells',- color: '#107c41'- }- ];-- this.init();- onLanguageChange(() => this.renderMenu());+ constructor() {+ this.launcherUrl = "https://open-edit.netlify.app/apps.html";+ this.btn = document.getElementById("app-launcher-btn");+ this.modal = document.getElementById("app-launcher-modal");+ this.closeBtn = document.getElementById("app-launcher-close");+ this.backdrop = this.modal ? this.modal.querySelector(".modal-backdrop") : null;+ this.frame = document.getElementById("app-launcher-iframe");+ this.bodyOverflowBeforeOpen = "";++ if (!this.btn || !this.modal || !this.closeBtn || !this.frame) return;++ this.setupEventListeners();+ }++ setupEventListeners() {+ this.btn.addEventListener("click", (event) => {+ event.stopPropagation();+ if (this.modal.classList.contains("hidden")) {+ this.openModal();+ } else {+ this.closeModal();+ }+ });++ this.closeBtn.addEventListener("click", () => this.closeModal());++ if (this.backdrop) {+ this.backdrop.addEventListener("click", () => this.closeModal());}+ document.addEventListener("keydown", (event) => {+ if (event.key === "Escape" && !this.modal.classList.contains("hidden")) {+ this.closeModal();+ }+ });+ }-- init() {- this.renderMenu();- this.setupEventListeners();+ openModal() {+ if (!this.frame.getAttribute("src")) {+ this.frame.setAttribute("src", this.frame.dataset.src || this.launcherUrl);}- renderMenu() {- const menuContainer = document.getElementById('app-launcher-menu');- if (!menuContainer) return;-- // Clear existing content just in case- menuContainer.innerHTML = '';-- // Create the grid- const grid = document.createElement('div');- grid.className = 'app-launcher-grid';-- this.apps.forEach(app => {- const appItem = document.createElement('a');- appItem.href = app.url;- appItem.target = '_blank';- appItem.className = 'app-launcher-item';- appItem.rel = 'noopener noreferrer';-- appItem.innerHTML = `- <div class="app-icon-wrapper" style="background-color: ${app.color}15; color: ${app.color}">- <i class="${app.icon}"></i>- </div>- <span class="app-name">${window.t ? window.t(app.nameKey) : app.nameKey}</span>- `;-- grid.appendChild(appItem);- });-- menuContainer.appendChild(grid);-- // Add a "More apps" placeholder if needed or footer- // For now, simple grid is fine.- }+ this.bodyOverflowBeforeOpen = document.body.style.overflow || "";+ document.body.style.overflow = "hidden";- setupEventListeners() {- const btn = document.getElementById('app-launcher-btn');- const menu = document.getElementById('app-launcher-menu');+ this.modal.classList.remove("hidden");+ this.btn.setAttribute("aria-expanded", "true");+ }- if (!btn || !menu) return;-- // Toggle menu- btn.addEventListener('click', (e) => {- e.stopPropagation();- const isHidden = menu.classList.contains('hidden');-- // Close all other open menus/modals if needed (optional, keeping it simple)-- if (isHidden) {- this.openMenu();- } else {- this.closeMenu();- }- });-- // Close on click outside- document.addEventListener('click', (e) => {- if (!menu.classList.contains('hidden') && !menu.contains(e.target) && !btn.contains(e.target)) {- this.closeMenu();- }- });-- // Close on Escape key- document.addEventListener('keydown', (e) => {- if (e.key === 'Escape' && !menu.classList.contains('hidden')) {- this.closeMenu();- }- });- }-- openMenu() {- const menu = document.getElementById('app-launcher-menu');- const btn = document.getElementById('app-launcher-btn');-- menu.classList.remove('hidden');- btn.setAttribute('aria-expanded', 'true');-- // Slight animation class if we want to trigger CSS animations explicitly- // CSS transition on opacity/transform is usually enough if not display:none- // But since we use 'hidden' (display: none), we might need a small timeout for transition- // For simplicity, we'll rely on CSS animation on the 'hidden' removal or separate class.- // Let's assume standard toggle for now.- }-- closeMenu() {- const menu = document.getElementById('app-launcher-menu');- const btn = document.getElementById('app-launcher-btn');-- menu.classList.add('hidden');- btn.setAttribute('aria-expanded', 'false');- }+ closeModal() {+ this.modal.classList.add("hidden");+ this.btn.setAttribute("aria-expanded", "false");+ document.body.style.overflow = this.bodyOverflowBeforeOpen;+ }}diff --git a/styles.css b/styles.cssindex 9fdcaa1..4c88c97 100644--- a/styles.css+++ b/styles.css@@ -1325,6 +1325,108 @@ button:disabled {justify-content: center;}+.app-launcher-modal-panel {+ position: relative;+ width: min(980px, 96vw);+ max-height: min(92vh, 760px);+ margin: 0 auto;+ padding: 16px;+ border: 1px solid #d4dae4;+ border-radius: 16px;+ background: #f8fafc;+ box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);+ display: flex;+ flex-direction: column;+ gap: 12px;+ animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);+}++body[data-theme="dark"] .app-launcher-modal-panel,+.dark-mode .app-launcher-modal-panel {+ background: #1f2937;+ border-color: #374151;+ box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);+}++.app-launcher-modal-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+}++.app-launcher-modal-title {+ margin: 0;+ font-family: system-ui, -apple-system, "Segoe UI", sans-serif;+ font-size: 1rem;+ font-weight: 600;+ color: #0f172a;+}++body[data-theme="dark"] .app-launcher-modal-title,+.dark-mode .app-launcher-modal-title {+ color: #e5e7eb;+}++.app-launcher-modal-close {+ width: 34px;+ height: 34px;+ padding: 0;+ border-radius: 10px;+ border: 1px solid #d4dae4;+ background: rgba(255, 255, 255, 0.75);+ color: #334155;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+ transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;+}++.app-launcher-modal-close:hover {+ background: #eff6ff;+ border-color: #93c5fd;+ color: #1d4ed8;+}++body[data-theme="dark"] .app-launcher-modal-close,+.dark-mode .app-launcher-modal-close {+ background: rgba(15, 23, 42, 0.7);+ border-color: #4b5563;+ color: #cbd5e1;+}++body[data-theme="dark"] .app-launcher-modal-close:hover,+.dark-mode .app-launcher-modal-close:hover {+ background: rgba(30, 41, 59, 0.9);+ border-color: #60a5fa;+ color: #93c5fd;+}++.app-launcher-modal-body {+ width: 100%;+ height: min(76vh, 680px);+ min-height: 360px;+ border: 1px solid #d4dae4;+ border-radius: 12px;+ overflow: hidden;+ background: #ffffff;+}++body[data-theme="dark"] .app-launcher-modal-body,+.dark-mode .app-launcher-modal-body {+ border-color: #334155;+ background: #0f172a;+}++.app-launcher-modal-body iframe {+ width: 100%;+ height: 100%;+ border: 0;+ display: block;+ background: #ffffff;+}+.modal-header {display: flex;justify-content: space-between;@@ -2274,6 +2376,18 @@ body[data-theme="dark"] .app-launcher-menu {/* Mobile adjustments */@media (max-width: 768px) {+ .app-launcher-modal-panel {+ width: min(100vw, 100vw);+ max-height: 92vh;+ padding: 12px;+ border-radius: 16px 16px 0 0;+ }++ .app-launcher-modal-body {+ height: 72vh;+ min-height: 320px;+ }+.app-launcher-menu {position: fixed;top: auto;