diff --git a/common/content/buffer.js b/common/content/buffer.js index f51b6fff..8cea0ca3 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1255,6 +1255,18 @@ function Buffer() //{{{ .getInterface(Ci.nsISelectionDisplay) .QueryInterface(Ci.nsISelectionController), + /** + * Opens the appropriate context menu for elem. + * + * @param {Node} elem The context element. + */ + openContextMenu: function (elem) + { + document.popupNode = elem; + let menu = document.getElementById("contentAreaContextMenu"); + menu.showPopup(elem, -1, -1, "context", "bottomleft", "topleft"); + }, + /** * Saves a page link to disk. * diff --git a/common/content/hints.js b/common/content/hints.js index 85caf3ac..e3768e87 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -73,22 +73,25 @@ function Hints() //{{{ t: Mode("Follow hint in a new tab", function (elem) buffer.followLink(elem, liberator.NEW_TAB)), b: Mode("Follow hint in a background tab", function (elem) buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB)), w: Mode("Follow hint in a new window", function (elem) buffer.followLink(elem, liberator.NEW_WINDOW), extended), - F: Mode("Open multiple hints in tabs", hintAction_F), + F: Mode("Open multiple hints in tabs", followAndReshow), O: Mode("Generate an ':open URL' using hint", function (elem, loc) commandline.open(":", "open " + loc, modes.EX)), T: Mode("Generate a ':tabopen URL' using hint",function (elem, loc) commandline.open(":", "tabopen " + loc, modes.EX)), W: Mode("Generate a ':winopen URL' using hint",function (elem, loc) commandline.open(":", "winopen " + loc, modes.EX)), v: Mode("View hint source", function (elem, loc) buffer.viewSource(loc, false), extended), V: Mode("View hint source in external editor", function (elem, loc) buffer.viewSource(loc, true), extended), y: Mode("Yank hint location", function (elem, loc) util.copyToClipboard(loc, true)), - Y: Mode("Yank hint description", function (elem) util.copyToClipboard(elem.textContent || "", true), extended) + Y: Mode("Yank hint description", function (elem) util.copyToClipboard(elem.textContent || "", true), extended), + c: Mode("Open context menu", function (elem) buffer.openContextMenu(elem), extended) + }; /** - * Used to open multiple hints. + * Follows the specified hint and then reshows all hints. Used to open + * multiple hints in succession. * - * @param {node} elem The previously selected hint. + * @param {Node} elem The selected hint. */ - function hintAction_F(elem) + function followAndReshow(elem) { buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); diff --git a/vimperator/NEWS b/vimperator/NEWS index 3edd04b7..88b2621b 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -2,6 +2,7 @@ * version 2.2a1pre * add @: mapping - repeat the last Ex command * add \ mapping - toggle between rendered and source view + * add ;c extended hint mode - open the context menu 2009-05-21: * version 2.1 diff --git a/vimperator/locale/en-US/hints.txt b/vimperator/locale/en-US/hints.txt index 057c8b5a..6b105f4e 100644 --- a/vimperator/locale/en-US/hints.txt +++ b/vimperator/locale/en-US/hints.txt @@ -64,6 +64,7 @@ hint mode. Then press [a]24[a] to copy the hint location. * |;V| [m]V[m] to view its destination source in the external editor * |;y| [m]y[m] to yank its destination location * |;Y| [m]Y[m] to yank its text description +* |;c| [m]c[m] to open its context menu Hintable elements for all extended hint modes can be set in the 'extendedhinttags' XPath string.