VimperatorでRequestPolicyを操作する

2011/05/10: いつの間にかrが動かなくなってたので修正

VimperatorからRequestPolicyのポップアップを表示したり、リダイレクト制御の許可をさせたりできるようにする。
マッピングは次の通りにしてある

リダイレクトのオプション gro
リダイレクトの許可 grr
操作用ポップアップ表示 r

.vimperatorrcに以下を追加

"" アドオンRequestPolicyの操作
" 操作用ポップアップ表示
" cf. chrome/requestpolicy.jar/content/overlay.js : openStatusbarPopup()と_attachPopupStatusbar()
javascript <<EOM
mappings.addUserMap(
  [modes.NORMAL],
  ["<Leader>r"],
  "Open RequestPolicy Popup",
  function(){
    requestpolicy.overlay.openStatusbarPopup(document.getElementById('status-bar'));
  }
);
EOM
" リダイレクトの時の許可ボタンをgrrで、オプションをgroで
nnoremap <silent> grr :js gBrowser.getNotificationBox().currentNotification.getElementsByAttribute('label', '許可')[0].click()<CR>
nnoremap <silent> gro :js gBrowser.getNotificationBox().currentNotification.getElementsByAttribute('label', 'オプション')[0].click()<CR>