Bilibili 笔记小助手

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

目前为 2022-01-31 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Bilibili 笔记小助手
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 提取笔记专栏的手机可点链接,和B站自动生成的评论说再见
  6. // @author as042971
  7. // @include *://www.bilibili.com/read/cv*
  8. // @license MIT
  9. // @grant none
  10. // @esversion 8
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. let toolbar = document.querySelector('.side-toolbar');
  17. let copyLinkBtn = document.createElement('div');
  18. copyLinkBtn.setAttribute('class', 'toolbar-item');
  19. copyLinkBtn.setAttribute('data-v-79113dbb', '');
  20. copyLinkBtn.innerHTML = '<i data-v-79113dbb="" class="iconfont icon-tag"></i><span class="toolbar-item__num" data-v-79113dbb="">评论链接</span>';
  21.  
  22. copyLinkBtn.onclick = () => {
  23. let rawPath = window.location.pathname;
  24. let url = 'https://www.bilibili.com/h5/note-app/view?cvid=' + rawPath.substr(rawPath.length - 8, 8) + '&pagefrom=comment';
  25.  
  26. let aux = document.createElement("input");
  27. aux.setAttribute("value", url);
  28. document.body.appendChild(aux);
  29. aux.select();
  30. document.execCommand("copy");
  31. document.body.removeChild(aux);
  32. };
  33. toolbar.insertBefore(copyLinkBtn, toolbar.childNodes[0]);
  34. })();

QingJ © 2025

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