clock ore minuti secondi
目前為
// ==UserScript==
// @name Clock figuccio
// @description clock ore minuti secondi
// @version 1.1.0
// @include *
// @author figuccio
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @icon data:image/gif;base64,R0lGODlhEAAQAKECABEREe7u7v///////yH5BAEKAAIALAAAAAAQABAAAAIplI+py30Bo5wB2IvzrXDvaoFcCIBeeXaeSY4tibqxSWt2RuWRw/e+UQAAOw==
// @namespace https://greasyfork.org/users/237458
// ==/UserScript==
function updateClock() {
let date = new Date();
// parametri per la lingua:
// 'ITA' 'ING' 'FRA' 'TED' 'SPA' 'POR'
// ITALIANO INGLESE FRANCESE TEDESCO SPAGNOLO PORTOGHESE
let time = date.toLocaleString('ita', {
hour:'numeric',minute:'numeric',second:'numeric',
day:'numeric',year:'numeric',
month:'long',weekday:'long',
hour12: false
});
node.innerHTML = time;
}
let node = document.createElement('div');
function setStyles(styles) {
styles.forEach(style => node.style.setProperty(style.name, style.value));
}
setStyles([
{ name: 'position', value: 'fixed'},
{ name: 'bottom', value: '' },
{ name: 'top', value: '0' },
{ name: 'background-color', value: 'red' },
{ name: 'color', value: 'white' },
{ name: 'z-index', value: '99999' },//99999
{ name: 'font-size', value: '16px',},//dimensioni
{ name: 'padding', value: '2px 2px 2px 2px'},//miglioramento su alcuni siti2px 2px 2px 2px
{ name: 'border-radius', value: '10px' },/* bordi arrotondati */
{ name: 'border', value: '2px solid blue' },/* colore bordo */
{ name: 'margin',value: '0px 9cm' },
{ name: 'font',value:'Arial'},
{ name: 'cursor', value: 'move' },
]);
document.body.appendChild(node);
setInterval(() => updateClock(), 1000);
//effetti speciali
node.addEventListener("mouseover", function( event ) {
// evidenzia il bersaglio del mouseover
event.target.style.color = "orange";
event.target.style.background = "green";
event.target.style.border= "solid black";
// ripristinare il colore dopo un breve ritardo
setTimeout(function() {
event.target.style.color = "white";
event.target.style.background = "red";
event.target.style.border = "solid blue";
}, 7000);
}, false);
//nasconde orario al passaggio mouse per 2secondi
node.addEventListener("click", function( event ) {
event.target.style.visibility= "hidden";
setTimeout(function() {
event.target.style.visibility = "";
}, 5000);
}, false);