Greasy Fork

Greasy Fork is available in English.

哔哩哔哩小助手

该脚本是为了使在哔哩哔哩网页端拥有更好的体检,减少用户操作,提高用户体验。目前拥有自动网页宽屏、自动点赞功能,自动点赞默认关闭。

当前为 2021-04-14 提交的版本,查看 最新版本

// ==UserScript==
// @name         哔哩哔哩小助手
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  该脚本是为了使在哔哩哔哩网页端拥有更好的体检,减少用户操作,提高用户体验。目前拥有自动网页宽屏、自动点赞功能,自动点赞默认关闭。
// @author       木羊羽
// @match        https://www.bilibili.com/video/*
// @match        https://www.bilibili.com/bangumi/play/*
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

// 更新日志
// v0.1 自动点击宽屏、点赞按钮,点赞默认为关闭
// v0.2 新增自动调节页面至合适位置

const widescreenFunction = true
const likeFunction = false

if (widescreenFunction) {
    let widescreen_id = setInterval(function() {

        let widescreen = document.querySelector('.bilibili-player-video-btn-widescreen')
        if (widescreen === null) {
            console.log('未找到宽屏button!')
        } else if (widescreen.className.includes('closed') === false) {
            widescreen.click()
            scrollTo(0, 145)
            clearInterval(widescreen_id)
        } else {
            console.log('当期已经是宽屏模式')
            clearInterval(widescreen_id)
        }
    }, 3000)
}

if (likeFunction) {
    let like_id = setInterval(function() {
        let like = document.querySelector("#arc_toolbar_report > div.ops > span.like")
        if (like === null) {
            console.log('未找到点赞button!')
        } else if (like.className.includes('on') === false) {
            like.click()
            clearInterval(like_id)
        } else {
            console.log('当前视频已经点赞')
            clearInterval(like_id)
        }
    }, 3000)
}