Greasy Fork

Greasy Fork is available in English.

bilibili toothbrush

牙刷科技

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        bilibili toothbrush
// @namespace   http://www.icycat.com
// @description 牙刷科技
// @author      冻猫
// @include     *www.bilibili.tv/*
// @include     *www.bilibili.com/*
// @include     *bangumi.bilibili.com/*
// @include     *bilibili.kankanews.com/*
// @version     6.6
// @run-at      document-end
// ==/UserScript==

(function() {

    if (window.top !== window.self) {
        return;
    }

    function init() {
        console.log('bilibili toothbrush 初始化');
        setTimeout(function() {
            var playerArea = document.getElementsByClassName('player-wrapper')[0];
            if (playerArea) {
                window.scrollTo(0, getRect(playerArea).pageY);
            }
        }, 500);
    }

    function getRect(element) {
        var rect = element.getBoundingClientRect();
        var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        return {
            pageX: rect.left + scrollLeft,
            pageY: rect.top + scrollTop
        };
    }

    init();

})();