millesimisec Clock figuccio

Clock millisecondi con salvataggio posizione

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name            millesimisec Clock figuccio
// @description     Clock millisecondi con salvataggio posizione
// @match           *://*/*
// @version         9.3
// @author          figuccio
// @noframes
// @grant           GM_setValue
// @grant           GM_getValue
// @grant           GM_registerMenuCommand
// @namespace       https://greasyfork.org/users/237458
// @require         http://code.jquery.com/jquery-latest.js
// @require         https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @icon            data:image/gif;base64,R0lGODlhEAAQAKECABEREe7u7v///////yH5BAEKAAIALAAAAAAQABAAAAIplI+py30Bo5wB2IvzrXDvaoFcCIBeeXaeSY4tibqxSWt2RuWRw/e+UQAAOw==
// @license         MIT
// ==/UserScript==

var $ = window.jQuery;
var j = $.noConflict();
const body = document.body;
var box = document.createElement("div");
box.id = "milli";
box.title = 'trascina time';
box.setAttribute("style", "background:blue;color:red;cursor:move; font-family:sans-serif;width:310px; font-size:13pt; top:0px; line-height:21px; position:fixed; text-align:center; z-index:999999;");

// Recupera le coordinate salvate
var savedPosition = GM_getValue("widget_position");
if (savedPosition) {
    var [left, top] = savedPosition.split(",");
    box.style.left = left + "px";
    box.style.top = top + "px";
}

document.body.appendChild(box);
j(box).draggable({
    stop: function() {
        // Salva le nuove coordinate quando si smette di trascinare il widget
        var position = $(this).position();
        GM_setValue("widget_position", position.left + "," + position.top);
    }
});

function tick() {
    var today = new Date();
    var h = new Date().toLocaleTimeString();
    var ms = new Date().getMilliseconds();
    var date = new Date().toLocaleString('it', {'weekday': 'long', 'month': 'long', 'day': '2-digit','year':'numeric'});
    box.innerHTML = h + ":" + ms + " " + date;
}

tick();
setInterval(tick, 70);

//mostra nascondi time
function myFunction2() {
    box.style.display = ((box.style.display!='none') ? 'none' : 'block');
}
GM_registerMenuCommand("mostra/nascondi", myFunction2);