Greasy Fork is available in English.

高考倒计时

2021高考倒计时

Verze ze dne 22. 11. 2020. Zobrazit nejnovější verzi.

// ==UserScript==
// @name         高考倒计时
// @namespace    http://czqu.cc/
// @version      1.0
// @description  2021高考倒计时
// @author       czqu
// @match        http*://*/*
// @grant        none
// ==/UserScript==

let dom = creatDom(`<div id="haato-countdown" style="position: fixed; top: 100px;
  right: 0;  margin-right: 10px;display: flex; justify-content: center; align-items: center;color:rgba(40, 82, 181, 0.5); font-size: 1vw;pointer-events:none;z-index:9999"></div>`.trim())
document.querySelector('body').appendChild(dom)

function creatDom(str) {
  let wrapper = document.createElement('div')
  wrapper.innerHTML = str
  return wrapper.childNodes[0]
}

let nextDay = new Date(2021, 5, 7, 8)
setInterval(() => {
  let diff = parseInt((nextDay - Date.now()) / 1000)
  let day = parseInt(diff / 3600/24)
  document.querySelector('#haato-countdown').innerHTML = `距离高考还有 ${day} 天`
}, 1000)