blob: 744901ce8f13395e47285e8499a99b2b9d3dafe1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
var clipboard = (function () {
var disabled = false;
var contentType = 'text/plain;charset=utf-8'
document.body.addEventListener('copy', function (e) {
if (disabled) { return }
if (e.clipboardData) {
e.preventDefault();
e.clipboardData.setData(contentType, canvas.ascii());
}
if (window.clipboardData) {
e.returnValue = false;
window.clipboardData.setData(contentType, canvas.ascii());
}
}, false);
return {
enable: function(){ disabled = false },
disable: function(){ disabled = true }
}
})()
|