AF Clock

adds a PST clock to art fight's navbar

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         AF Clock
// @namespace    artfight
// @version      2025-06-23
// @description  adds a PST clock to art fight's navbar
// @author       three
// @match        *://artfight.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=artfight.net
// @grant        none
// @noframes
// ==/UserScript==

var clock = document.createElement('li');
clock.id = 'clock';
clock.className = "nav-link";
let navbar = document.querySelectorAll("ul.ml-auto")[0];
navbar.insertBefore(clock, navbar.firstChild);

function updateClock(){
    //get date in PST
        var currentTime = new Date(new Date().toLocaleString("en-US", {timeZone: "US/Pacific"}));
        var hours = currentTime.getHours();
        var minutes = currentTime.getMinutes();
    //format time with leading 0s
        minutes = minutes < 10 ? '0' + minutes : minutes;
        hours = hours < 10 ? '0' + hours : hours;

    // Update clock
    //console.log("update");
        clock.textContent = hours + ':' + minutes + " PST";
}

// Update clock every second
    setInterval(updateClock, 1000);