From 684715730414a26a8177d65730908acc0440158a Mon Sep 17 00:00:00 2001 From: ilya Date: Sun, 3 Jan 2010 23:27:08 -0800 Subject: Implement 'y' -- yank (copy) the current tab's url to the clipboard. --- lib/clipboard.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/clipboard.js (limited to 'lib') diff --git a/lib/clipboard.js b/lib/clipboard.js new file mode 100644 index 00000000..1d414892 --- /dev/null +++ b/lib/clipboard.js @@ -0,0 +1,14 @@ +var Clipboard = { + // http://groups.google.com/group/chromium-extensions/browse_thread/thread/49027e7f3b04f68/f6ab2457dee5bf55 + copy: function(data) { + var textArea = document.createElement("textarea"); + textArea.style.position = "absolute"; + textArea.style.left = "-100%"; + textArea.value = data; + + document.body.appendChild(textArea); + textArea.select(); + document.execCommand("Copy"); + document.body.removeChild(textArea); + } +}; -- cgit v1.2.3