forked from dodying/UserJs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopyModify.user.js
More file actions
29 lines (28 loc) · 844 Bytes
/
Copy pathcopyModify.user.js
File metadata and controls
29 lines (28 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// ==UserScript==
// @name copyModify
// @description copyModify
// @include *
// @version 1.0.5
// @created 2020-12-05 15:44:53
// @modified 2020/12/5 15:48:39
// @author dodying
// @namespace https://github.com/dodying/UserJs
// @supportURL https://github.com/dodying/UserJs/issues
// @icon https://cdn.jsdelivr.net/gh/dodying/UserJs@master/Logo.png
// @run-at document-end
// @grant none
// @noframes
// ==/UserScript==
/* eslint-disable no-debugger */
(function () {
'use strict';
document.addEventListener('copy', function (e) {
const text = window.getSelection().toString().trim();
if (text) {
// GM_setClipboard(text);
e.clipboardData.setData('text/plain', text);
e.clipboardData.setData('text/html', text);
}
e.preventDefault();
}, false);
})();