System Clock and Calendar

Display the system clock and calendar at the bottom right corner of the site in Chrome browser.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         System Clock and Calendar
// @description  Display the system clock and calendar at the bottom right corner of the site in Chrome browser.
// @namespace    https://github.com/Rainman69/
// @version      1.0
// @author       https://t.me/TheErfon
// @match        *://*/*
// @grant        none
// @license      CC BY-NC-ND 4.0
// @licenseURL   https://github.com/Rainman69/live-Time-date-for-browser/blob/main/LICENSE
// ==/UserScript==

(function() {
    'use strict';

    var systemDateDiv = document.createElement('div');
    systemDateDiv.style.position = 'fixed';
    systemDateDiv.style.bottom = '0';
    systemDateDiv.style.right = '0';
    systemDateDiv.style.width = '40%';
    systemDateDiv.style.padding = '5px';
    systemDateDiv.style.fontFamily = 'digital-7 (mono)';
    systemDateDiv.style.fontSize = '12px';
    systemDateDiv.style.textAlign = 'center';
    systemDateDiv.style.zIndex = '9999';
    systemDateDiv.style.textShadow = '0px -2px 4px rgba(0, 0, 0, 0.3)';
    systemDateDiv.style.transition = 'opacity 0.5s ease-in-out';

    function updateTime() {
        var currentDate = new Date();
        var options = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true };
        var formattedDate = currentDate.toLocaleString('en-US', options);

        systemDateDiv.textContent = formattedDate;
    }

    function handleScroll() {
        if (isScrolling) {
            clearTimeout(scrollingTimer);
        } else {
            systemDateDiv.style.opacity = '0';
        }

        isScrolling = true;

        scrollingTimer = setTimeout(function() {
            isScrolling = false;
            systemDateDiv.style.opacity = '1';
        }, 1000);
    }

    var isScrolling = false;
    var scrollingTimer;

    updateTime();

    window.addEventListener('scroll', handleScroll);

    document.body.appendChild(systemDateDiv);

    // Update the time every second
    setInterval(updateTime, 1000);
})();