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
feat: introduce World Planner for multi-timezone scheduling and time management with new modules, UI, and styling.
Supun Lakmaleb24e100d13b
diff --git a/modules/constants.js b/modules/constants.jsindex 200f73b..954314c 100644--- a/modules/constants.js+++ b/modules/constants.js@@ -19,7 +19,7 @@ export const DEFAULT_STATE = {l: "en",r: 0,},- mp: { h: null, z: [], s: null, d: null, f24: false },+ mp: { h: null, z: ["UTC"], s: null, d: null, f24: false },};// Timing Constantsdiff --git a/modules/timezoneManager.js b/modules/timezoneManager.jsindex d1729ad..6e1e421 100644--- a/modules/timezoneManager.js+++ b/modules/timezoneManager.js@@ -3,7 +3,7 @@ import { OFFSET_MAX_HOURS, OFFSET_MAX_MINUTES } from "./constants.js";const supportedZones =typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : [];-export const AVAILABLE_ZONES = Array.isArray(supportedZones) ? supportedZones : [];+export const AVAILABLE_ZONES = Array.isArray(supportedZones) ? ["UTC", ...supportedZones.filter(z => z !== "UTC")] : ["UTC"];function formatDateKey(date, timeZone) {const options = {diff --git a/modules/worldPlannerModule.js b/modules/worldPlannerModule.jsindex 8f5b277..020efb7 100644--- a/modules/worldPlannerModule.js+++ b/modules/worldPlannerModule.js@@ -14,7 +14,7 @@ import {import { AVAILABLE_ZONES, getLocalZone, getZoneInfo, parseOffsetSearchTerm } from "./timezoneManager.js";export class WorldPlanner {- constructor({ getState, updateState, ensureEditable, scheduleSave, showToast, closeMobileDrawer } = {}) {+ constructor({ getState, updateState, ensureEditable, scheduleSave, showToast, closeMobileDrawer, openEventModal } = {}) {// Store dependenciesthis.getState = getState;this.updateState = updateState;@@ -22,6 +22,7 @@ export class WorldPlanner {this.scheduleSave = scheduleSave;this.showToast = showToast;this.closeMobileDrawer = closeMobileDrawer;+ this.openEventModal = openEventModal;// Cache DOM elementsthis.modal = document.getElementById("world-planner-modal");@@ -35,6 +36,7 @@ export class WorldPlanner {// Bind methodsthis.handleTzInput = this.handleTzInput.bind(this);this.handleGridClick = this.handleGridClick.bind(this);+ this.handleGridDblClick = this.handleGridDblClick.bind(this);this.handleScrubberMove = this.handleScrubberMove.bind(this);this.handleScrubberClick = this.handleScrubberClick.bind(this);this.handleDateChange = this.handleDateChange.bind(this);@@ -63,6 +65,7 @@ export class WorldPlanner {this.handleScrubberClick(e);this.handleGridClick(e);});+ this.grid.addEventListener("dblclick", this.handleGridDblClick);}}@@ -246,6 +249,21 @@ export class WorldPlanner {}}+ handleGridDblClick(e) {+ if (!this.ensureEditable || !this.ensureEditable()) return;+ const cell = e.target.closest(".wp-cell");+ if (!cell) return;++ const hIndex = Number(cell.dataset.h);+ const baseDate = this.getPlannerDate();+ const ts = baseDate.getTime() + hIndex * MS_PER_HOUR;++ if (this.openEventModal) {+ this.close(); // Close planner so event modal is visible+ this.openEventModal({ date: new Date(ts) });+ }+ }+getPlannerDate() {const state = this.getState();return state.mp.d ? new Date(state.mp.d) : new Date();@@ -399,6 +417,16 @@ export class WorldPlanner {cls += " date-boundary";}+ // Highlight current time slot+ const now = new Date();+ const currentZoneTime = new Date(now.toLocaleString("en-US", { timeZone: zone }));+ const currentHour = currentZoneTime.getHours();+ const currentMin = currentZoneTime.getMinutes();++ if (tHour === currentHour && Math.abs(tMin - currentMin) < 30) {+ cls += " current";+ }+cell.className = cls;cell.dataset.h = h;diff --git a/script.js b/script.jsindex 6c1be82..fb463d1 100644--- a/script.js+++ b/script.js@@ -1890,16 +1890,25 @@ async function init() {fallbackColors: DEFAULT_COLORS,onToggle: updateFocusButton,});- worldPlanner = new WorldPlanner({- getState: () => state,- updateState: (key, value) => {- state[key] = value;- },- ensureEditable,- scheduleSave,- showToast,- closeMobileDrawer,- });+ if (!worldPlanner) {+ worldPlanner = new WorldPlanner({+ getState: () => state,+ updateState: (key, val) => {+ state[key] = val;+ scheduleSave();+ renderTimezones(); // Sync with Sidebar+ render(); // Sync with any main calendar updates+ },+ ensureEditable,+ scheduleSave,+ showToast,+ closeMobileDrawer: () => {+ if (ui.mobileDrawer) ui.mobileDrawer.classList.remove(CSS_CLASSES.IS_ACTIVE);+ if (ui.mobileDrawerBackdrop) ui.mobileDrawerBackdrop.classList.remove(CSS_CLASSES.IS_ACTIVE);+ },+ openEventModal,+ });+ }bindEvents();initResponsiveFeatures();await loadStateFromHash();diff --git a/styles.css b/styles.cssindex 06f4a12..c7c7156 100644--- a/styles.css+++ b/styles.css@@ -2790,5 +2790,35 @@ body[data-theme="dark"] .ripple {opacity: 1;}+/* World Planner Ghost Scrubber */+.ghost-scrubber {+ position: absolute;+ top: 0;+ bottom: 0;+ width: 2px;+ background: var(--accent);+ opacity: 0.3;+ pointer-events: none;+ z-index: 5;+}++.scrubber-overlay {+ pointer-events: none;+}++/* Current time slot highlighting */+.wp-cell.current {+ position: relative;+ background: var(--accent-soft) !important;+ border: 2px solid var(--accent);+ font-weight: 600;+ box-shadow: 0 0 8px var(--accent-soft);+}++body[data-theme="dark"] .wp-cell.current {+ box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);+}++