Clock figuccio

clock ore minuti secondi millesimi data

当前为 2020-07-10 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Clock figuccio
// @description clock ore minuti secondi millesimi data
// @version     2.2
// @include     *
// @noframes
// @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==
/* short long  true=ampm  false=24h lingua en-US ok am pm mezzogiorno 12:00 .lingua it mezzogiorno ampm 0:00  */
function updateClock() {
let data = new Date().toLocaleString('it', {'day':'2-digit','year':'numeric','month':'long','weekday':'long'});
document.getElementById('Clocktest').innerHTML =data
}
let node = document.createElement('div');
////////////
node.id = "Clocktest";

node.title = '2click time';

node.setAttribute("style","padding:4px;background:black;color:lime;font-family: Orbitron;letter-spacing: 2px;top:0;font-size:14px;position:fixed;text-align:center;z-index:999999;border-radius:10px;border:2px solid red;");
document.body.appendChild(node);
setInterval(() => updateClock(), 70);
////////////////////////////////////////////////
function Clock() {
  var date = new Date();
  var d = new Date();
  var mm;
  mm = d.getMilliseconds();
  var ore = date.toLocaleString('it',{
  hour:'2-digit',minute:'numeric',second:'numeric',
  });
 document.getElementById('b') .innerHTML = ore+":"+ mm;;
}
var node2 = document.createElement('div');
node2.id = "b";
node2.title = 'trascina time+2click data';
node2.setAttribute("style","cursor:move;padding:4px;background:black;color:lime;top:0px;font-family:sans-serif;font-size:14px;position:fixed;text-align:center;z-index:999999;border-radius:10px;border:2px solid yellow;");
document.body.appendChild(node2);
setInterval(() => Clock(), 70);
////////////////////////////
function Function149() {
  if (node.style.display === 'none') {
    node.style.display = 'block';
       node2.style.display = 'none';
  } else {
    node.style.display = 'none';
      node2.style.display = 'block';
  }
}
//GM_registerMenuCommand("mostra data /time",Function149);

//funziona cambia data-ora al click
node2.addEventListener("dblclick", Function149);
node.addEventListener("dblclick", Function149);
node.style.display = 'none';


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

////////////
//Make the DIV element draggagle:
dragElement(document.getElementById("b"));

function dragElement(elmnt) {
  var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  if (document.getElementById(elmnt.id + "header")) {
    /* if present, the header is where you move the DIV from:*/
    document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
  } else {
    /* otherwise, move the DIV from anywhere inside the DIV:*/
    elmnt.onmousedown = dragMouseDown;
  }

  function dragMouseDown(e) {
    e = e || window.event;
    e.preventDefault();
    // get the mouse cursor position at startup:
    pos3 = e.clientX;
    pos4 = e.clientY;
    document.onmouseup = closeDragElement;
    // call a function whenever the cursor moves:
    document.onmousemove = elementDrag;
  }

  function elementDrag(e) {
    e = e || window.event;
    e.preventDefault();
    // calculate the new cursor position:
    pos1 = pos3 - e.clientX;
    pos2 = pos4 - e.clientY;
    pos3 = e.clientX;
    pos4 = e.clientY;
    // set the element's new position:
    elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
    elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
  }

  function closeDragElement() {
    /* stop moving when mouse button is released:*/
    document.onmouseup = null;
    document.onmousemove = null;
  }
}