B站导航栏添加 '稍后再看'

B站导航栏添加 '稍后再看' 链接

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         B站导航栏添加 '稍后再看'
// @namespace    http://asjun.net/
// @version      0.2
// @description  B站导航栏添加 '稍后再看' 链接
// @author       Asjun
// @match        https://*.bilibili.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var time = setInterval(function() {
        var signinNode = document.getElementsByClassName('signin')[0];
        if (signinNode != undefined &&
            signinNode.getElementsByClassName('watchlater')[0] == undefined) {
            signinNode.append(createWatchlater());
        } else {
            clearInterval(time);
        }
    }, 1000);



})();

function createWatchlater() {
    var span = document.createElement('span');
    span.classList.add('name');
    span.innerText = '稍后再看';

    var link = document.createElement('a');
    link.href = 'https://www.bilibili.com/watchlater/#/list';
    link.append(span);

    var node = document.createElement('div');
    node.classList.add('item');
    node.classList.add('watchlater');
    node.append(link);

    return node;
}