diff chromeless-browsing/chromeless.js @ 16:426e9c04c6f9

Executing the 'where-am-i' command now copies the current URL to your clipboard.
author Atul Varma <varmaa@toolness.com>
date Wed, 01 Apr 2009 12:25:48 -0700
parents 8e00d50976d9
children
line wrap: on
line diff
--- a/chromeless-browsing/chromeless.js	Wed Apr 01 09:21:54 2009 -0700
+++ b/chromeless-browsing/chromeless.js	Wed Apr 01 12:25:48 2009 -0700
@@ -93,6 +93,14 @@
   preview: function(pblock, dobj) {
     var loc = CmdUtils.getWindow().location;
     pblock.innerHTML = ("Your current URL is <tt>" +
-                        Utils.escapeHtml(loc.href) + "</tt>.");
+                        Utils.escapeHtml(loc.href) + "</tt>." +
+                        "<p>Press enter to copy this URL to " +
+                        "your clipboard.</p>");
+  },
+  execute: function() {
+    var loc = CmdUtils.getWindow().location;
+    var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
+                    getService(Ci.nsIClipboardHelper);
+    clipboard.copyString(loc.href);
   }
 });