移除网站内容复制小尾巴

支持 CSDN/哔哩哔哩(bilibili、b站)/知乎

当前为 2022-08-14 提交的版本,查看 最新版本

// ==UserScript==
// @name         移除网站内容复制小尾巴
// @namespace    love_sagiri
// @version      0.7
// @description  支持 CSDN/哔哩哔哩(bilibili、b站)/知乎
// @author       六天°
// @match        *://www.bilibili.com/read/*
// @match        *://blog.csdn.net/*/article/details/*
// @match        *://www.zhihu.com/question/*
// @require      https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js
// @icon         https://lh1.hetaousercontent.com/img/e2f8995d845f666d.png
// @grant        GM_setClipboard
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    $(document).ready(function(){
        console.log(location.host)
        let read;
        if (location.host.includes('blog.csdn.net')){
            read = $('#js_content');
        } else if (location.host.includes('bilibili')) {
            read = $('#read-article-holder');
        } else if (location.host.includes('zhihu')){
            read = $('.List-item')
        }
        read.bind('copy',function(e){
            // 获取选中内容
            let text = window.getSelection().toString();
            // 复制到剪切板
            GM_setClipboard(text);
            // 停止事件冒泡
            return false;
        })
    })

})();