Waze Editor Clock with Decoration

Display a stylish clock at the bottom center of Waze Editor page

当前为 2024-05-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         Waze Editor Clock with Decoration
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  Display a stylish clock at the bottom center of Waze Editor page
// @author       Your Name
// @match        https://www.waze.com/*/editor/*
// @include      https://www.waze.com/editor*
// @include      https://www.waze.com/*/editor*
// @include      https://beta.waze.com/editor*
// @include      https://beta.waze.com/*/editor*
// @exclude      https://www.waze.com/user/*
// @exclude      https://www.waze.com/*/user/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Create a clock element
    var clock = document.createElement('div');
    clock.style.position = 'fixed';
    clock.style.bottom = '20px'; // Adjust the position as needed
    clock.style.left = '50%';
    clock.style.transform = 'translateX(-50%)';
    clock.style.color = 'white';
    clock.style.fontSize = '20px';
    clock.style.fontFamily = 'Arial, sans-serif';
    clock.style.zIndex = '9999';
    clock.style.padding = '10px 15px'; // Add padding for decoration
    clock.style.borderRadius = '10px'; // Add border radius for decoration
    clock.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; // Add background color for decoration
    clock.style.boxShadow = '0 2px 5px rgba(0, 0, 0, 0.5)'; // Add shadow for decoration

    // Function to update the clock
    function updateClock() {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var timeString = ('0' + hours).slice(-2) + ':' + ('0' + minutes).slice(-2);
        clock.textContent = timeString;
    }

    // Initial update
    updateClock();

    // Update the clock every minute
    setInterval(updateClock, 60000);

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