Clock h m s ms

clock ore minuti secondi millesimi

目前為 2022-07-04 提交的版本,檢視 最新版本

// ==UserScript==
// @name            Clock   h m s ms
// @description     clock ore minuti secondi millesimi
// @version         0.2
// @match           *://*/*
// @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
// @require         http://code.jquery.com/jquery-latest.js
// @require         https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @license                  MIT
// ==/UserScript==
/*  */
let $ = window.jQuery;
var j = $.noConflict();
const body=document.body;
function addZero(x, n) {
  while (x.toString().length < n) {
    x = "0" + x;
  }
  return x;
}
function myFunction() {
  var d = new Date();
  var x = document.getElementById("ciao");
  var h = addZero(d.getHours(), 2);
  var m = addZero(d.getMinutes(), 2);
  var s = addZero(d.getSeconds(), 2);
  var ms = addZero(d.getMilliseconds(), 3);
  x.innerHTML = h + ":" + m + ":" + s + ":" + ms;
}
let node = document.createElement('div');
////////////
node.id = "ciao";
node.title = 'trascina time';
node.setAttribute("style","cursor:move;padding:4px;background:red;color:lime;top:0;font-family:sans-serif;font-size:14px;position:fixed;text-align:center;z-index:999999;border-radius:10px;border:2px solid blue;");
document.body.appendChild(node);
setInterval(() => myFunction(), 70);
j(node).draggable();
body.append(node);