-
Notifications
You must be signed in to change notification settings - Fork 85
Time, Fullscreen, and Settings
The time logic in DuckOS provides real-time updates for the displayed time. The updateTime
function calculates the current time, formats it based on the user's time format preference (12 or 24-hour format), and updates the DOM element with the id time
. The padZero
function ensures that single-digit minutes and seconds are prefixed with a zero for better formatting. The time is updated every second using the setInterval
function.
// Example usage:
updateTime();
setInterval(updateTime, 1000);
The fullscreen control allows the user to toggle between fullscreen and regular window mode. The toggleFullscreen function checks the current fullscreen status and either requests fullscreen or exits fullscreen accordingly. The event listener is attached to an HTML element with the id fullscreen.
Example Usage javascript Copy code // Example usage: const fullscreenElement = document.getElementById('fullscreen'); fullscreenElement.addEventListener('click', toggleFullscreen);
# Settings List
## Functionality
The settings list provides a user interface for accessing various settings. The list is toggled by clicking a designated button (togglesettinglist) or pressing Alt + S. The list is animated with fade-in and fade-out effects. The settings list is hidden when clicking outside the list or pressing Alt + S again.
Example Usage
```javascript
// Example usage:
document.addEventListener("DOMContentLoaded", function() {
const toggleButton = document.getElementById("togglesettinglist");
const settingslist = document.getElementById("settingslist");
toggleButton.addEventListener("click", toggleSettingsList);
});
A loader is displayed during the initial page load, and content becomes visible after a set delay. The loader fades out, revealing the content after a certain period. This ensures a visually pleasing transition for the user.
// Example usage:
window.addEventListener("load", function() {
var loader = document.getElementById("loader");
var content = document.getElementById("content");
setTimeout(function() {
loader.style.transition = "opacity 1s";
loader.style.opacity = "0";
content.style.display = "block";
document.body.style.overflow = "auto";
}, 3500);
setTimeout(function() {
loader.style.display = "none";
}, 4500);
});
The time logic, fullscreen control, and settings list contribute to the user interface and overall user experience in DuckOS. Developers can customize these features to suit the specific requirements of their applications. The provided examples demonstrate how to integrate and utilize these functionalities effectively.