CSDN免登陆复制并去除版权声明
目前為
// ==UserScript==
// @name CSDN复制
// @namespace http://tampermonkey.net/
// @version 0.1.2
// @description CSDN免登陆复制并去除版权声明
// @author You
// @match https://blog.csdn.net/*/article/details/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Your code here...
const pre = document.getElementsByTagName('pre')
const code = document.getElementsByTagName('code')
for (let i = 0; i < pre.length; i++) {
pre[i].setAttribute("style","user-select: auto !important")
}
for (let i = 0; i < code.length; i++) {
code[i].setAttribute("style","user-select: auto !important")
}
window.addEventListener("copy", function (e) {
let val = (window.getSelection().toString());
e.preventDefault();
e.clipboardData.setData("text/plain", val)
});
})();