Created
April 27, 2019 18:58
-
-
Save spacemeowx2/6dba537464351d026c652ce3f883dcec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 显示B站弹幕发送时间 | |
// @namespace http://imspace.cn/ | |
// @version 0.1 | |
// @description 显示B站弹幕发送时间 | |
// @author Space | |
// @match https://live.bilibili.com/* | |
// @match http://live.bilibili.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function addTime(list) { | |
const contents = list.querySelectorAll('.danmaku-content') | |
for (const c of contents) { | |
const ts = parseInt(c.parentElement.getAttribute('data-ts')) | |
const txt = (new Date(ts * 1000)).toLocaleString() | |
c.setAttribute('title', txt) | |
} | |
} | |
function checkInited() { | |
const list = document.getElementById('chat-history-list') | |
if (list.children.length > 0) { | |
clearInterval(intervalId) | |
addTime(list) | |
} | |
} | |
let intervalId = setInterval(checkInited, 1000) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment