Waze Editor Clock

Displays a clock in the Waze Editor

目前為 2024-05-07 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Waze Editor Clock
// @namespace   waze-editor-clock
// @version     1.2
// @description Displays a clock in the Waze Editor
// @author      Bard
// @match       https://www.waze.com/ja/editor?env=row
// @grant       none
// ==/UserScript==

(function() {
  'use strict';

  // Clock element
  const clockElement = document.createElement('div');
  clockElement.id = 'waze-editor-clock';
  clockElement.style.cssText = `
    position: fixed;
    bottom: 20px;
    left: 51%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: #fff;
    padding: 10px;
    border: 1px solid #ccc;
    font-size: 23px;
  `;

  // Update clock every second
  setInterval(() => {
    const date = new Date();
    const hours = date.getHours().toString().padStart(2, '0');
    const minutes = date.getMinutes().toString().padStart(2, '0');
    // Remove seconds from the clock display
    clockElement.textContent = `${hours}:${minutes}`;
  }, 1000);

  // Append clock element to the body
  document.body.appendChild(clockElement);
})();