diff options
| author | Julie Lala <jules@okfoc.us> | 2014-11-27 00:56:17 -0500 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-11-27 00:56:17 -0500 |
| commit | cebe1340f8c83bfceaca01fae923bc7d5fb2bff3 (patch) | |
| tree | ca1caea52783acfb80e2481dfc639d39f2cb19a7 /js/copy.js | |
| parent | 8354e3f29c5eed2837cb6993b0c4fa7274962cbc (diff) | |
split out copy code, add img to color code thing
Diffstat (limited to 'js/copy.js')
| -rw-r--r-- | js/copy.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/copy.js b/js/copy.js new file mode 100644 index 0000000..d1ae716 --- /dev/null +++ b/js/copy.js @@ -0,0 +1,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 } + } + +})()
\ No newline at end of file |
