Greasy Fork is available in English.

ac21542826跳转脚本

try to take over the world!

// ==UserScript==
// @name         ac21542826跳转脚本
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  try to take over the world!
// @author       You
// @match        https://www.acfun.cn/v/ac21542826
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function init() {
        const nodes = document.querySelectorAll('u')
        for(let item of nodes) {
            let html = item.innerHTML
            if (html.indexOf(':') !== -1) {
                let timeArr = html.split(':')
                let time
                if (timeArr.length === 2) {
                    time = parseInt(html.split(':')[0])*60 + parseInt(html.split(':')[1])
                } else {
                    time = parseInt(html.split(':')[0])*3600 + parseInt(html.split(':')[1])*60 + parseInt(html.split(':')[2])
                }
                item.addEventListener('click', ()=> {
                    document.querySelector('video').currentTime = time
                })
            }
        }
    }
    let interval = setInterval(()=>{
        if (document.querySelector('.ac-comment-list')) {
            clearInterval(interval)
            setTimeout(()=>{
                init()
            }, 3000)
        }
    }, 500)
    })();