// ==UserScript== // @name KeepTime // @namespace http://tampermonkey.net/ // @version 0.1 // @description Keep time on the stream // @author Chenbobo // @match https://www.fenbi.com/spa/pwa/record/ // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // ==/UserScript== (function() { // Your code here... window.onload = function () { const body = document.getElementsByTagName('body'); setInterval(() => { var date = new Date(); nowStr = date.toLocaleTimeString(); console.log(nowStr); const timespan = document.getElementById('timeshow') if (timespan) { console.log(1); document.querySelector('#timeshow').innerHTML = nowStr; timespan.style.color = 'red' timespan.style.position = 'fixed' timespan.style.bottom = 0; timespan.style.right = 0 timespan.style.fontSize = '2rem' timespan.style.zIndex = '999999' } else { console.log(0); var span = document.createElement('span'); var timeStr = `${nowStr}`; span.innerHTML = timeStr; body[0].appendChild(span); } /*var span = document.createElement('span'); var timeStr = `${nowStr}`; span.innerHTML = timeStr; body[0].appendChild(span);*/ }, 1000); } })();