Clock figuccio

clock ore minuti secondi

目前为 2019-03-31 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Clock figuccio
  3. // @description clock ore minuti secondi
  4. // @version 1.0.9
  5. // @include *
  6. // @author figuccio
  7. // @grant GM_setValue
  8. // @grant GM_getValue
  9. // @grant GM_registerMenuCommand
  10. // @icon data:image/gif;base64,R0lGODlhEAAQAKECABEREe7u7v///////yH5BAEKAAIALAAAAAAQABAAAAIplI+py30Bo5wB2IvzrXDvaoFcCIBeeXaeSY4tibqxSWt2RuWRw/e+UQAAOw==
  11. // @namespace https://greasyfork.org/users/237458
  12. // ==/UserScript==
  13. function updateClock() {
  14. let date = new Date();
  15. // parametri per la lingua:
  16. // 'ITA' 'ING' 'FRA' 'TED' 'SPA' 'POR'
  17. // ITALIANO INGLESE FRANCESE TEDESCO SPAGNOLO PORTOGHESE
  18. let time = date.toLocaleString('ita', {
  19. hour:'numeric',minute:'numeric',second:'numeric',
  20. day:'numeric',year:'numeric',
  21. month:'long',weekday:'long',
  22. hour12: false
  23. });
  24. node.innerHTML = time;
  25. }
  26. let node = document.createElement('div');
  27. function setStyles(styles) {
  28. styles.forEach(style => node.style.setProperty(style.name, style.value));
  29. }
  30. setStyles([
  31. { name: 'position', value: 'fixed'},
  32. { name: 'bottom', value: '0' },
  33. { name: 'background-color', value: 'red' },
  34. { name: 'color', value: 'white' },
  35. { name: 'z-index', value: '99999' },//99999
  36. { name: 'font-size', value: '16px',},//dimensioni
  37. { name: 'padding', value: '2px 2px 2px 2px'},//piccolo miglioramento rispetto ha prima su alcuni siti2px 2px 2px 2px
  38. { name: 'border-radius', value: '10px' },/* bordi arrotondati */
  39. { name: 'border', value: '2px solid blue' },/* colore bordo */
  40. { name: 'margin',value: '20px 15px' },
  41. { name: 'font',value:'Arial'},
  42. { name: 'cursor', value: 'move' },
  43. ]);
  44. document.body.appendChild(node);
  45. setInterval(() => updateClock(), 1000);
  46. //effetti speciali
  47. node.addEventListener("mouseover", function( event ) {
  48. // evidenzia il bersaglio del mouseover
  49. event.target.style.color = "orange";
  50. event.target.style.background = "green";
  51. event.target.style.border= "solid black";
  52. // ripristinare il colore dopo un breve ritardo
  53. setTimeout(function() {
  54. event.target.style.color = "white";
  55. event.target.style.background = "red";
  56. event.target.style.border = "solid blue";
  57. }, 7000);
  58. }, false);
  59. //cambia posizione al orologio per 5secondi ottimizzato per youtube fullscreen
  60. node.addEventListener("click", function( event ) {
  61. event.target.style.margin= "730px 9cm";
  62. setTimeout(function() {
  63. event.target.style.margin = "20px 15px";
  64. },5000 );
  65. }, false);
  66.  
  67.