Greasy Fork

Greasy Fork is available in English.

bilibili 评论时间戳

先把评论加载出来,按t就能在评论区插入时间戳,并接着输入内容了。

当前为 2022-01-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         bilibili 评论时间戳
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  先把评论加载出来,按t就能在评论区插入时间戳,并接着输入内容了。
// @author       You
// @match        https://www.bilibili.com/video/*
// @icon         https://www.google.com/s2/favicons?domain=bilibili.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    document.addEventListener('keypress', function(e){
        console.log(e);
        if(e.keyCode === 116) {
            e.preventDefault();
            console.log(e.target.value);
            var time = document.querySelectorAll('.bilibili-player-video-time-now')[0].innerHTML;
            var comment = document.querySelectorAll('.ipt-txt')[0];
            comment.value = time + ' ';
            comment.focus();
        }
    })
    // Your code here...
})();