Skip to content

Instantly share code, notes, and snippets.

@shinnya
Created July 4, 2010 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinnya/463159 to your computer and use it in GitHub Desktop.
Save shinnya/463159 to your computer and use it in GitHub Desktop.
[KeySnail] Copy URL to clipboard
key.setViewKey('M-u', function (ev, arg) \
{
display.echoStatusBar("Copy URL to clipboard");
command.setClipboardText(getBrowser().contentDocument.URL);
}, 'Copy URL to clipboard');
@mooz
Copy link

mooz commented Jul 4, 2010

KeySnail の初期化ファイル, プラグインは KeySnail.modules というコンテキストの元で評価されるので, this.modules は省くことが可能 (推奨) です.

  key.setViewKey('M-u', function (ev, arg)
  {
      display.echoStatusBar("Copy URL to clipboard");
      command.setClipboardText(getBrowser().contentDocument.URL);
  }, 'Copy URL to clipboard');

@shinnya
Copy link
Author

shinnya commented Jul 4, 2010

おぉ、そうなんですか。以後気を付けます。

@knoajp
Copy link

knoajp commented Aug 17, 2017

現行のFirefoxで動かなくなってるようなので、こちらで。
(下記も57で動かなくなるのかもしれないけど)

function (ev, arg) {
    command.setClipboardText(gBrowser.currentURI.spec);
    display.echoStatusBar("Copy URL to clipboard");
}

function (ev, arg) {
    command.setClipboardText(gBrowser.contentTitle + '\n' + gBrowser.currentURI.spec);
    display.echoStatusBar("Copied Title and URL");
}

@shinnya
Copy link
Author

shinnya commented Oct 16, 2017

レスポンス遅いですが、ご丁寧にどうもありがとうございます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment