1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 10:47:59 +01:00

Add "c" extended hint mode to open the context menu.

This commit is contained in:
Doug Kearns
2009-05-23 22:54:59 +10:00
parent 955ee4185b
commit c7b48361ee
4 changed files with 22 additions and 5 deletions

View File

@@ -1255,6 +1255,18 @@ function Buffer() //{{{
.getInterface(Ci.nsISelectionDisplay)
.QueryInterface(Ci.nsISelectionController),
/**
* Opens the appropriate context menu for <b>elem</b>.
*
* @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.
*

View File

@@ -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);

View File

@@ -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

View File

@@ -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.