mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 22:47:59 +01:00
Add [c]:toolbaropen[c], [c]:toolbarclose[c], and [c]:toolbartoggle[c].
This commit is contained in:
@@ -321,6 +321,8 @@ const liberator = (function () //{{{
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
var toolbox;
|
||||
|
||||
registerObserver("load_commands", function () {
|
||||
|
||||
commands.add(["addo[ns]"],
|
||||
@@ -644,6 +646,45 @@ const liberator = (function () //{{{
|
||||
function () { liberator.restart(); },
|
||||
{ argCount: "0" });
|
||||
|
||||
toolbox = document.getElementById("navigator-toolbox");
|
||||
if (toolbox)
|
||||
{
|
||||
function findToolbar(name) buffer.evaluateXPath(
|
||||
"./*[@toolbarname=" + util.escapeString(name, "'") + "]",
|
||||
document, toolbox).snapshotItem(0);
|
||||
|
||||
let tbcmd = function (names, desc, action, filter)
|
||||
{
|
||||
commands.add(names, desc,
|
||||
function (args)
|
||||
{
|
||||
let toolbar = findToolbar(args[0]);
|
||||
if (!toolbar)
|
||||
return void liberator.echoerr("E474: Invalid argument");
|
||||
action(toolbar);
|
||||
},
|
||||
{
|
||||
argcount: "1",
|
||||
completer: function (context)
|
||||
{
|
||||
completion.toolbar(context)
|
||||
if (filter)
|
||||
context.filters.push(filter);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
}
|
||||
|
||||
tbcmd(["toolbarshow", "tbshow"], "Show the named toolbar",
|
||||
function (toolbar) toolbar.collapsed = false,
|
||||
function (item) item.item.collapsed);
|
||||
tbcmd(["toolbarhide", "tbhide"], "Hide the named toolbar",
|
||||
function (toolbar) toolbar.collapsed = true,
|
||||
function (item) !item.item.collapsed);
|
||||
tbcmd(["toolbartoggle", "tbtoggle"], "Toggle the named toolbar",
|
||||
function (toolbar) toolbar.collapsed = !toolbar.collapsed);
|
||||
}
|
||||
|
||||
commands.add(["time"],
|
||||
"Profile a piece of code or run a command multiple times",
|
||||
function (args)
|
||||
@@ -805,6 +846,12 @@ const liberator = (function () //{{{
|
||||
context.keys = { text: "fullMenuPath", description: function (item) item.getAttribute("label") };
|
||||
context.completions = liberator.menuItems;
|
||||
};
|
||||
|
||||
completion.toolbar = function toolbar(context) {
|
||||
context.title = ["Toolbar"];
|
||||
context.keys = { text: function (item) item.getAttribute("toolbarname"), description: function () "" };
|
||||
context.completions = buffer.evaluateXPath("./*[@toolbarname]", document, toolbox);
|
||||
}
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
|
||||
@@ -463,7 +463,7 @@ const util = { //{{{
|
||||
[XHTML, 'html'],
|
||||
[XUL, 'xul']
|
||||
]);
|
||||
if (object instanceof Node && !(object instanceof Document))
|
||||
if (object instanceof Element)
|
||||
{
|
||||
let elem = object;
|
||||
if (elem.nodeType == elem.TEXT_NODE)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* IMPORTANT: shifted key notation now matches Vim's behaviour. E.g. <C-a>
|
||||
and <C-A> are equivalent, to map the uppercase character use <C-S-A>.
|
||||
|
||||
* add [c]:toolbaropen[c], [c]:toolbarclose[c], and [c]:toolbartoggle[c]
|
||||
* make [c]:open[c] behavior match that of [c]:tabopen[c] and [c]:winopen[c]
|
||||
when no argument is specified
|
||||
* add extension related commands - [c]:extadd[c], [c]:extdelete[c],
|
||||
|
||||
@@ -140,4 +140,23 @@ standard Firefox View->Sidebar menu. Add-ons, Preferences and Downloads are
|
||||
also available in the sidebar.
|
||||
________________________________________________________________________________
|
||||
|
||||
|:tbshow| |:toolbarshow| +
|
||||
||:toolbarshow {name}||
|
||||
________________________________________________________________________________
|
||||
Shows the named toolbar.
|
||||
________________________________________________________________________________
|
||||
|
||||
|:tbhide| |:toolbarhide| +
|
||||
||:toolbarhide {name}||
|
||||
________________________________________________________________________________
|
||||
Hides the named toolbar.
|
||||
________________________________________________________________________________
|
||||
|
||||
|:tbtoggle| |:toolbartoggle| +
|
||||
||:toolbartoggle {name}||
|
||||
________________________________________________________________________________
|
||||
Toggles the named toolbar.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
// vim: set filetype=asciidoc:
|
||||
|
||||
@@ -258,6 +258,9 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
|
||||
||[c]:tabprevious[c]|| Switch to the previous tab or go [count] tabs back +
|
||||
||[c]:tabrewind[c]|| Switch to the first tab +
|
||||
||[c]:time[c]|| Profile a piece of code or run a command multiple times +
|
||||
||[c]toolbarshow[c]|| Show the named toolbar +
|
||||
||[c]toolbarhide[c]|| Hide the named toolbar +
|
||||
||[c]toolbartoggle[c]|| Toggle the named toolbar +
|
||||
||[c]:unabbreviate[c]|| Remove an abbreviation +
|
||||
||[c]:undo[c]|| Undo closing of a tab +
|
||||
||[c]:undoall[c]|| Undo closing of all closed tabs +
|
||||
|
||||
Reference in New Issue
Block a user