// ==UserScript==
// @name Show me now time
// @namespace Show me now time
// @version 0.0.2
// @author 稻米鼠
// @description 在打开每个网页的时候显示一下当前时间,以及今天已经过去的百分比
// @match *://*/*
// @grant none
// @run-at document-idle
// @noframes
// @downloadURL https://update.greasyfork.icu/scripts/379870/Show%20me%20now%20time.user.js
// @updateURL https://update.greasyfork.icu/scripts/379870/Show%20me%20now%20time.meta.js
// ==/UserScript==
const oldLoadFun = window.onload
window.onload=function(){
oldLoadFun && oldLoadFun()
const nowTime = new Date()
const hours = nowTime.getHours()
const minutes = nowTime.getMinutes()<10 ? '0'+nowTime.getMinutes() : nowTime.getMinutes()
const progress = (nowTime.getTime()-nowTime.getTimezoneOffset()*60000)%(24*3600*1000)/(24*3600*1000)
console.log(progress)
const progressToShow = (progress*100).toFixed(1)<10 ? '0'+(progress*100).toFixed(1) : (progress*100).toFixed(1)
const timer = document.createElement("div")
timer.id = 'please-show-me-now-time'
const perLong = window.innerHeight > window.innerWidth ? window.innerWidth/100 : window.innerHeight/100
const progressLong = Math.PI * 28 * perLong * progress
const progressLongLast = Math.PI * 28 * perLong * (1-progress)
const timerStyle = `
`
timer.innerHTML = timerStyle + `
`
document.body.appendChild(timer)
timer.style.left = (document.body.offsetWidth - timer.offsetWidth)/2 + 'px'
window.setTimeout(()=>{
timer.style.top = 0
}, 100)
window.setTimeout(()=>{
timer.style.top = 'calc(-40vmin - 42px)'
}, 3100)
window.setTimeout(()=>{
document.body.removeChild(timer)
}, 5000)
}