Show time drag
当前为
// ==UserScript==
// @name Clock2
// @description Show time drag
// @author figuccio
// @version 0.3
// @namespace https://greasyfork.org/users/237458
// @match *://*/*
// @grant GM_setValue
// @grant GM_getValue
// @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;
if( top.location != location ) return;
Number.prototype.pad = function(size) {
if( typeof(size) !== "number" ) {
size = 2;
}
var s = String(this);
while (s.length < size) {
s = "0" + s;
}
return s;
}
var tod = document.createElement("div");
tod.id = "todClock";
tod.setAttribute(
"style",
"top:0;" +
"color:black;" +
"font-family:droid sans mono;" +
"font-size:16pt;" +
"line-height:20px;" +
"position:fixed;" +
"text-align:center;" +
"z-index:99999999999;" +
" background-color:green;"+
"-moz-user-select:none;"+
"cursor:move;"
);
function tick() {
var d = new Date();
var Y = d.getFullYear();
var M = (d.getMonth()+1).pad();
var D = d.getDate().pad();
var h = d.getHours().pad();
var m = d.getMinutes().pad();
var s = d.getSeconds().pad();
tod.innerHTML = h + ":" + m + ":" + s+ "*"+D + "/" + M + "/" + Y;
}
j(tod).draggable();
body.append(tod);
tick();
setInterval(tick, 1000);
$('html body').append(tod);