Time Local Display (Main PC)

Показывает московское время только в главном окне, в правом нижнем углу, без повторов в iframe и всплывающих окнах.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Time Local Display (Main PC)
// @namespace    http://tampermonkey.net/
// @version      1.59
// @description  Показывает московское время только в главном окне, в правом нижнем углу, без повторов в iframe и всплывающих окнах.
// @author       Your Name
// @match        *://*/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Не выполняем скрипт во фреймах или всплывающих окнах
    if (window.top !== window.self) return;

    const timeDisplay = document.createElement('div');

    Object.assign(timeDisplay.style, {
        position: 'fixed',
        right: '20px',
        bottom: '20px',
        backgroundColor: 'rgba(0, 0, 0, 0.8)',
        color: 'white',
        padding: '10px',
        borderRadius: '8px',
        fontFamily: 'monospace',
        fontSize: '14px',
        boxShadow: '0 0 12px rgba(0, 0, 0, 0.5)',
        zIndex: '999999',
        pointerEvents: 'none',
        textAlign: 'center',
        minWidth: '180px'
    });

    document.body.appendChild(timeDisplay);

    function updateTime() {
        const now = new Date();
        const options = {
            timeZone: 'Europe/Moscow',
            hour: '2-digit',
            minute: '2-digit',
            second: '2-digit',
            year: 'numeric',
            month: '2-digit',
            day: '2-digit'
        };
        const moscowTime = now.toLocaleString('ru-RU', options).replace(',', ' -');
        timeDisplay.innerText = `${moscowTime}`;
    }

    updateTime();
    setInterval(updateTime, 1000);
})();