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

Fix contents of the Places toolbar when toggled via :tbt or 'go'.

This commit is contained in:
Kris Maglione
2011-01-13 21:02:21 -05:00
parent d62371042c
commit 3e4fa31139

View File

@@ -1063,6 +1063,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
get plugins() plugins, get plugins() plugins,
setNodeVisible: function setNodeVisible(node, visible) {
if (window.setToolbarVisibility && node.localName == "toolbar")
window.setToolbarVisibility(node, visible);
else
node.collapsed = !visible;
},
/** /**
* Quit the host application, no matter how many tabs/windows are open. * Quit the host application, no matter how many tabs/windows are open.
* *
@@ -1315,7 +1322,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
ids.map(function (id) document.getElementById(id)) ids.map(function (id) document.getElementById(id))
.forEach(function (elem) { .forEach(function (elem) {
if (elem) if (elem)
elem.collapsed = (opts.indexOf(opt) == -1); dactyl.setNodeVisible(elem, opts.indexOf(opt) >= 0);
}); });
} }
} }
@@ -1915,13 +1922,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}; };
toolbarCommand(["toolbars[how]", "tbs[how]"], "Show the named toolbar", toolbarCommand(["toolbars[how]", "tbs[how]"], "Show the named toolbar",
function (toolbar) toolbar.collapsed = false, function (toolbar) dactyl.setNodeVisible(toolbar, true),
function (item) item.item.collapsed); function (item) item.item.collapsed);
toolbarCommand(["toolbarh[ide]", "tbh[ide]"], "Hide the named toolbar", toolbarCommand(["toolbarh[ide]", "tbh[ide]"], "Hide the named toolbar",
function (toolbar) toolbar.collapsed = true, function (toolbar) dactyl.setNodeVisible(toolbar, false),
function (item) !item.item.collapsed); function (item) !item.item.collapsed);
toolbarCommand(["toolbart[oggle]", "tbt[oggle]"], "Toggle the named toolbar", toolbarCommand(["toolbart[oggle]", "tbt[oggle]"], "Toggle the named toolbar",
function (toolbar) toolbar.collapsed = !toolbar.collapsed); function (toolbar) dactyl.setNodeVisible(toolbar, toolbar.collapsed));
} }
commands.add(["time"], commands.add(["time"],