ВРЕМЯ

07.02.2025, 11:21:16

目前为 2025-02-15 提交的版本。查看 最新版本

// ==UserScript==
// @name        ВРЕМЯ
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @grant       none
// @version     1.0
// @author      DELFION
// @license MIT
// @description 07.02.2025, 11:21:16
// ==/UserScript==


(function () {
    "use strict";

//// Модуль времени
    const timeModule = (() => {
        const timeElement = document.createElement("div");
        timeElement.classList.add("time-element");

        const hoursSpan = document.createElement("span");
        const minutesSpan = document.createElement("span");
        const dayOfWeekSpan = document.createElement("span");

        timeElement.append(hoursSpan, minutesSpan, dayOfWeekSpan);

        const style = document.createElement("style");
        style.textContent = `
            .time-element {
                position: fixed;
                bottom: 3px;
                left: 77px;
                padding: 3px;
                font-size: 34px;
                font-weight: bold;
                z-index: 1000;
                color: black; /* Убедитесь, что цвет виден на фоне */
                text-shadow: 1px 1px 2px white; /* Добавление тени для лучшей читаемости */
            }
            .time-element span {
                transition: color 1s ease;
            }
        `;
        document.head.appendChild(style);

        function updateDisplayTime() {
            const now = new Date();
            const hours = now.getHours().toString().padStart(2, "0");
            const minutes = now.getMinutes().toString().padStart(2, "0");
            const dayOfWeek = new Intl.DateTimeFormat("ru-RU", { weekday: "short" }).format(now);
            const color = getRandomColor();

            hoursSpan.style.color = color;
            minutesSpan.style.color = color;
            hoursSpan.textContent = `${hours}:`;
            minutesSpan.textContent = minutes;
            dayOfWeekSpan.textContent = dayOfWeek;
        }

        function getRandomColor() {
            return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`;
        }

        function init() {
            document.body.appendChild(timeElement);
            console.log("Time module initialized:", timeElement); // Отладочное сообщение
            updateDisplayTime();
            setInterval(updateDisplayTime, 3000);
        }

        return { init };
    })();

//// Инициализация модуля времени
    timeModule.init(); // Добавил вызов инициализации модуля
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址