showClock figuccio

Mostra un orologio dragabile

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name           showClock figuccio
// @namespace      https://greasyfork.org/users/237458
// @description    Mostra un orologio dragabile
// @match          *://*/*
// @license        MIT
// @version        1.0
// @grant          GM_setValue
// @grant          GM_getValue
// @grant          GM_registerMenuCommand
// @icon           https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @require        https://code.jquery.com/jquery-3.6.0.min.js
// @require        https://code.jquery.com/ui/1.12.1/jquery-ui.js
// ==/UserScript==
(function() {
    'use strict';

var $ = window.jQuery;
$(function() {
const clock = $('<div>', { id: 'clockDiv', title: 'Time', style: 'position:fixed;left:0;top:0;width:250px;text-align:center;font-family:arial;font-size:18px;z-index:99999999;background:red;color:white;border:2px solid blue;padding:2px;cursor:move;' }).appendTo('body');

setInterval(() => clock.html(new Date().toLocaleString('it', { weekday: 'short', month: '2-digit', day: '2-digit', year: 'numeric' }) + " " + new Date().toLocaleTimeString()+ ":" + new Date().getMilliseconds()), 70);


clock.draggable({ containment: 'window', stop: (_, ui) => GM_setValue('clockPosition', ui.position) });

GM_registerMenuCommand('Mostra/Nascondi Orologio', () => clock.toggle());

const savedPosition = GM_getValue('clockPosition'); if (savedPosition) clock.css(savedPosition);
});
})();