Bilibili专栏剪贴板复制净化

去除B站专栏剪贴板复制时被额外添加的字符

// ==UserScript==
// @name         Bilibili专栏剪贴板复制净化
// @namespace    https://greasyfork.org/users/236434
// @version      0.1
// @description  去除B站专栏剪贴板复制时被额外添加的字符
// @author       You
// @match        https://www.bilibili.com/read/*
// @icon         https://www.bilibili.com/favicon.ico
// @license      MIT
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function interceptListener(target) {
        target.prototype.oldaddEventListener = target.prototype.addEventListener;
        target.prototype.addEventListener = function(event, handler, placeholder) {
            if (event === 'copy') return;
            // console.log("allowing listener", event, handler, placeholder);
            if (arguments.length < 3) {
                this.oldaddEventListener(event, handler, false);
            } else {
                this.oldaddEventListener(event, handler, placeholder);
            }
        }
    }

    if (window.EventTarget && EventTarget.prototype.addEventListener) {
        interceptListener(EventTarget);
    } else {
        interceptListener(Element);
    }
})();