Bilibili 笔记小助手

提取笔记专栏的手机可点链接,和B站自动生成的评论说再见

当前为 2022-01-31 提交的版本,查看 最新版本

// ==UserScript==
// @name         Bilibili 笔记小助手
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  提取笔记专栏的手机可点链接,和B站自动生成的评论说再见
// @author       as042971
// @include      *://www.bilibili.com/read/cv*
// @license MIT
// @grant        none
// @esversion    8
// ==/UserScript==

(function() {
    'use strict';

    let toolbar = document.querySelector('.side-toolbar');
    let copyLinkBtn = document.createElement('div');
    copyLinkBtn.setAttribute('class', 'toolbar-item');
    copyLinkBtn.setAttribute('data-v-79113dbb', '');
    copyLinkBtn.innerHTML = '<i data-v-79113dbb="" class="iconfont icon-tag"></i><span class="toolbar-item__num" data-v-79113dbb="">评论链接</span>';

    copyLinkBtn.onclick = () => {
        let rawPath = window.location.pathname;
        let url = 'https://www.bilibili.com/h5/note-app/view?cvid=' + rawPath.substr(rawPath.length - 8, 8) + '&pagefrom=comment';

        let aux = document.createElement("input");
        aux.setAttribute("value", url);
        document.body.appendChild(aux);
        aux.select();
        document.execCommand("copy");
        document.body.removeChild(aux);
    };
    toolbar.insertBefore(copyLinkBtn, toolbar.childNodes[0]);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址