Firefox userChrome.js greasemonkeyスクリプトスレ 9 at SOFTWARE
[2ch|▼Menu]
55:名無しさん@お腹いっぱい。
09/07/17 11:35:31 3Qo/1dbe0
["searchbar", "urlbar"].forEach(function(aId) {
  document.getElementById(aId).addEventListener("popupshowing", function(aEvent) {
    var menupopup = aEvent.originalTarget;
    var refChild = menupopup.getElementsByAttribute("cmd", "cmd_paste")[0];
    if (!refChild) return;
    var canPaste = refChild.getAttribute("disabled") == "true";
    var menuitem = document.getElementById(this.id + "-pasteand");
    if (!menuitem) {
      var bar = this;
      function pasteAndDo(aEvent) {
        // paste
        goDoCommand("cmd_paste");
        // and search/go
        bar.id == "searchbar" ? bar.handleSearchCommand(aEvent)
                              : handleURLBarCommand(aEvent);
        // close popup
        menupopup.hidePopup();
      }
      menuitem = document.createElementNS("URLリンク(www.mozilla.org)", "xul:menuitem");
      menuitem.id = this.id + "-pasteand"
      menuitem.setAttribute("label", "\u8cbc\u308a\u4ed8\u3051\u3066" +
                                     (this.id == "searchbar" ? "\u691c\u7d22" : "\u79fb\u52d5"));
      menuitem.setAttribute("accesskey", "e");
      menuitem.addEventListener("command", pasteAndDo, false);
      menupopup.insertBefore(menuitem, refChild.nextSibling);
    }
    menuitem.setAttribute("disabled", canPaste.toString());
  }, false);
});


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

5495日前に更新/314 KB
担当:undef