Clock figuccio

clock ore minuti secondi

目前為 2019-03-31 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Clock figuccio
// @description clock ore minuti secondi
// @version     1.0.9
// @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: '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'},//piccolo miglioramento rispetto ha prima su alcuni siti2px 2px 2px 2px
  { name: 'border-radius', value: '10px' },/* bordi arrotondati */
  { name: 'border', value: '2px solid blue' },/* colore bordo */
  { name: 'margin',value: '20px  15px' },
  { 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);
         //cambia posizione al orologio per 5secondi  ottimizzato per youtube fullscreen
node.addEventListener("click", function( event ) {
event.target.style.margin= "730px 9cm";
setTimeout(function() {
event.target.style.margin = "20px 15px";
    },5000 );
  }, false);