WEBLEB
Accueil
Éditeur
Connexion
Pro
Français
English
Français
Español
Português
Deutsch
Italiano
हिंदी
HTML
CSS
JS
Set Alarm
00:00
AM
PM
Upcoming Alarm
S M T W T F S
Reset
Alarm
Clock
Stopwatch
Inspiration from
@rrauix
/* Custom CSS */ body { font-family: 'Inter', sans-serif; /* Using Inter as a common, clean sans-serif font */ } .font-inter { font-family: 'Inter', sans-serif; } /* Toggle Switch */ .toggle-checkbox:checked + .toggle-label .toggle-dot { transform: translateX(100%); } .toggle-checkbox:checked + .toggle-label { background-color: #000; /* Black when checked */ } .toggle-checkbox:not(:checked) + .toggle-label { background-color: #E5E7EB; /* Gray-200 when not checked */ } .analog-clock-hand { transform-origin: center center; } /* Styling for S M T W T F S text in alarms */ .alarm-days { font-size: 0.6rem; /* Extra small */ letter-spacing: 0.05em; /* Spaced out a bit */ color: #9CA3AF; /* gray-400 */ } /* Active/Inactive Nav Item */ .nav-item-active svg { color: black; } .nav-item-active span { color: black; } .nav-item-inactive svg { color: #9CA3AF; /* gray-400 */ } .nav-item-inactive span { color: #9CA3AF; /* gray-400 */ }
function app() { return { activeScreen: 'clock', // Default screen // Clock Screen Data location: 'Sydney', currentDate: 'Friday, 01 January 2021', currentTime: { time: '00:00', period: 'AM' }, greeting: 'Good Evening', hourAngle: 0, minuteAngle: 0, // Alarm Screen Data alarms: [ { id: 2, title: 'Morning Exercise', time: '06:30 AM', enabled: true }, { id: 3, title: 'Study', time: '09:00 AM', enabled: true }, { id: 4, title: 'Online Class', time: '13:00 PM', enabled: true } ], // Stopwatch Screen Data stopwatchTime: 0, // in seconds stopwatchDisplay: '00:00', stopwatchInterval: null, stopwatchRunning: false, initApp() { // Any initial setup if needed, for now static data is used. // If dynamic time was needed: this.updateLiveTime(); setInterval(() => this.updateLiveTime(), 1000 * 60); // Update every minute }, updateLiveTime() { // Example for dynamic time const now = new Date(); this.currentDate = now.toLocaleDateString('en-US', { weekday: 'long', day: '2-digit', month: 'long', year: 'numeric' }); let hours = now.getHours(); const minutes = now.getMinutes(); const ampm = hours >= 12 ? 'PM' : 'AM'; hours = hours % 12; hours = hours ? hours : 12; // the hour '0' should be '12' this.currentTime.time = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`; this.currentTime.period = ampm; this.hourAngle = (hours * 30) + (minutes / 60 * 30); this.minuteAngle = (minutes * 6); const currentHour = now.getHours(); if (currentHour < 12) this.greeting = 'Good Morning'; else if (currentHour < 18) this.greeting = 'Good Afternoon'; else this.greeting = 'Good Evening'; }, toggleStopwatch() { if (this.stopwatchRunning) { clearInterval(this.stopwatchInterval); thiswatchRunning = false; } else { this.stopwatchRunning = true; this.stopwatchInterval = setInterval(() => { this.stopwatchTime++; const minutes = Math.floor(this.stopwatchTime / 60); const seconds = this.stopwatchTime % 60; this.stopwatchDisplay = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; }, 1000); } }, resetStopwatch() { clearInterval(this.stopwatchInterval); this.stopwatchRunning = false; this.stopwatchTime = 0; this.stopwatchDisplay = '00:00'; } } }
Validating your code, please wait...
HTML
CSS
JS
Set Alarm
00:00
AM
PM
Upcoming Alarm
S M T W T F S
Reset
Alarm
Clock
Stopwatch
Inspiration from
@rrauix
/* Custom CSS */ body { font-family: 'Inter', sans-serif; /* Using Inter as a common, clean sans-serif font */ } .font-inter { font-family: 'Inter', sans-serif; } /* Toggle Switch */ .toggle-checkbox:checked + .toggle-label .toggle-dot { transform: translateX(100%); } .toggle-checkbox:checked + .toggle-label { background-color: #000; /* Black when checked */ } .toggle-checkbox:not(:checked) + .toggle-label { background-color: #E5E7EB; /* Gray-200 when not checked */ } .analog-clock-hand { transform-origin: center center; } /* Styling for S M T W T F S text in alarms */ .alarm-days { font-size: 0.6rem; /* Extra small */ letter-spacing: 0.05em; /* Spaced out a bit */ color: #9CA3AF; /* gray-400 */ } /* Active/Inactive Nav Item */ .nav-item-active svg { color: black; } .nav-item-active span { color: black; } .nav-item-inactive svg { color: #9CA3AF; /* gray-400 */ } .nav-item-inactive span { color: #9CA3AF; /* gray-400 */ }
function app() { return { activeScreen: 'clock', // Default screen // Clock Screen Data location: 'Sydney', currentDate: 'Friday, 01 January 2021', currentTime: { time: '00:00', period: 'AM' }, greeting: 'Good Evening', hourAngle: 0, minuteAngle: 0, // Alarm Screen Data alarms: [ { id: 2, title: 'Morning Exercise', time: '06:30 AM', enabled: true }, { id: 3, title: 'Study', time: '09:00 AM', enabled: true }, { id: 4, title: 'Online Class', time: '13:00 PM', enabled: true } ], // Stopwatch Screen Data stopwatchTime: 0, // in seconds stopwatchDisplay: '00:00', stopwatchInterval: null, stopwatchRunning: false, initApp() { // Any initial setup if needed, for now static data is used. // If dynamic time was needed: this.updateLiveTime(); setInterval(() => this.updateLiveTime(), 1000 * 60); // Update every minute }, updateLiveTime() { // Example for dynamic time const now = new Date(); this.currentDate = now.toLocaleDateString('en-US', { weekday: 'long', day: '2-digit', month: 'long', year: 'numeric' }); let hours = now.getHours(); const minutes = now.getMinutes(); const ampm = hours >= 12 ? 'PM' : 'AM'; hours = hours % 12; hours = hours ? hours : 12; // the hour '0' should be '12' this.currentTime.time = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`; this.currentTime.period = ampm; this.hourAngle = (hours * 30) + (minutes / 60 * 30); this.minuteAngle = (minutes * 6); const currentHour = now.getHours(); if (currentHour < 12) this.greeting = 'Good Morning'; else if (currentHour < 18) this.greeting = 'Good Afternoon'; else this.greeting = 'Good Evening'; }, toggleStopwatch() { if (this.stopwatchRunning) { clearInterval(this.stopwatchInterval); thiswatchRunning = false; } else { this.stopwatchRunning = true; this.stopwatchInterval = setInterval(() => { this.stopwatchTime++; const minutes = Math.floor(this.stopwatchTime / 60); const seconds = this.stopwatchTime % 60; this.stopwatchDisplay = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; }, 1000); } }, resetStopwatch() { clearInterval(this.stopwatchInterval); this.stopwatchRunning = false; this.stopwatchTime = 0; this.stopwatchDisplay = '00:00'; } } }