原创 - 哔哩哔哩 - 隐藏已看完的播放记录

将已看完的播放记录移除掉。

目前为 2024-02-12 提交的版本。查看 最新版本

// ==UserScript==
// @name         原创 - 哔哩哔哩 - 隐藏已看完的播放记录
// @name:en_US   Original - BiliBili - Hide watched playlists
// @description  将已看完的播放记录移除掉。
// @version      1.0.1
// @author       CPlayer
// @license      MulanPSL-2.0
// @namespace    https://www.gitlink.org.cn/CPlayerCHN
// @match        https://www.bilibili.com/account/history
// @icon         http://bilibili.com/favicon.ico
// @grant        GM_addStyle
// @noframes
// ==/UserScript==

(function() {
    'use strict';

    // 修改页面最小高度,让更多播放记录正常加载。
    GM_addStyle("body { min-height: 125vh }")

    // 定义「侦测器」变量。
    var observer = new MutationObserver((elms) => {
        // 遍历「播放记录」信息
        document.querySelectorAll('#history_list .history-record').forEach(elm => {
            // 如果带有「已看完」字样,就移除它
            if(/已看完/.test(elm.textContent)) {
                // elm.style.display = "none";
                elm.remove();
            }
        })
    });

    // 配置「侦测器」侦测目标节点
    observer.observe(document.querySelector('#history_list'), {
        childList: true
    });

})();