-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy.js
More file actions
24 lines (21 loc) · 721 Bytes
/
Copy pathcopy.js
File metadata and controls
24 lines (21 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function() {
document.addEventListener('keydown', function(e) {
if (e.altKey) {
e.preventDefault();
if (e.which === 67) {
var s = document.$.selection();
if (s.length) {
s = s.replace(/\u00A0/g, ' ');
console.log("copy", s);
}
GM_setClipboard(s, {type: 'text', mimetype: 'text/plain'});
} else if (e.which === 82) {
// console.log('reload window');
window.location.reload();
} else if (e.which == 87) {
// console.log('close window');
window.close();
}
}
});
})();