1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 21:37:58 +01:00

:about command added

This commit is contained in:
Marco Candrian
2007-11-18 14:09:33 +00:00
parent 5b4b6fe3d2
commit a91285b927
2 changed files with 74 additions and 0 deletions

View File

@@ -656,6 +656,45 @@ vimperator.Commands = function () //{{{
completer: function (filter) { return vimperator.completion.get_buffer_completions(filter); }
}
));
commandManager.add(new vimperator.Command(["dia[log]"],
function (args, special)
{
var openAt = special ? vimperator.NEW_TAB: vimperator.NEW_WINDOW;
switch (args)
{
case "about": openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); break;
case "addbookmark": PlacesCommandHook.bookmarkCurrentPage(true, PlacesUtils.bookmarksRootId); break;
case "addons": BrowserOpenAddonsMgr(); break;
case "bookmarks": openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); break;
case "console": toJavaScriptConsole(); break;
case "customizetoolbar": BrowserCustomizeToolbar(); break;
case "downloads": toOpenWindowByType('Download:Manager', 'chrome://mozapps/content/downloads/downloads.xul', 'chrome,dialog=no,resizable'); break;
case "history": openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); break;
case "import": BrowserImport(); break;
case "openfile": BrowserOpenFileWindow(); break;
case "pageinfo": BrowserPageInfo(); break;
case "pagesource": BrowserViewSourceOfDocument(content.document); break;
case "places": PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS); break;
case "preferences": openPreferences(); break;
// XXX what are onEnter.. and onExit...?
case "printpreview": PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview); break;
case "print": PrintUtils.print(); break;
case "printsetup": PrintUtils.showPageSetup(); break;
case "saveframe": saveFrameDocument(); break;
case "savepage": saveDocument(window.content.document); break;
case "searchengines": openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); break;
// TODO add viewPartialSource('selection'); ...
case "": vimperator.echoerr("E474: Invalid Argument"); break;
default: vimperator.echoerr("Dialog: '" + args + "' is not available");
}
},
{
usage: ["dia[log] [firefox-dialog]"],
short_help: "Open a firefox-dialog",
help: "Available dialogs: use completion on <code class=\"command\">:dialog</code> &lt;tab&gt;",
completer: function (filter) { return vimperator.completion.dialog(filter); }
}
));
commandManager.add(new vimperator.Command(["buffers", "files", "ls", "tabs"],
function (args, special)
{

View File

@@ -123,6 +123,41 @@ vimperator.Completion = function () // {{{
return longest;
}, //}}}
dialog: function (filter) //{{{
{
g_substrings = [];
var nodes = [
["about", "About Firefox"],
["addbookmark", "Add bookmarks for the current page"],
["addons", "Manage Add-ons"],
["bookmarks", "List your bookmarks"],
["console", "JavaScript console"],
["customizetoolbar", "Customize the Toolbar"],
["downloads", "Manage Downloads"],
["history", "List your history"],
["import", "Import Preferences, Bookmarks, History, etc. from other browsers"],
["openfile", "Open the file selector dialog"],
["pageinfo", "Show information about the current page"],
["pagesource", "View page source"],
["places", "Places Organizer: Manage your bookmarks and history"],
["preferences", "Show Firefox preferences dialog"],
["printpreview", "Preview the page before printing"],
["printsetup", "Setup the page size and orientation before printing"],
["print", "Show print dialog"],
["saveframe", "Save frame to disk"],
["savepage", "Save page to disk"],
["searchengines", "Manage installed search engines"]]
if (!filter)
return nodes;
var mapped = nodes.map(function (node) {
return [[node[0]], node[1]];
});
return build_longest_common_substring(mapped, filter);
}, //}}}
/*
* filter a list of urls
*