1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-23 16:33:33 +01:00

:dia selectionsource added

This commit is contained in:
Marco Candrian
2008-01-14 12:51:36 +00:00
parent 9ecacc94c8
commit b2bdf6edca
2 changed files with 23 additions and 2 deletions

View File

@@ -701,6 +701,26 @@ vimperator.Commands = function () //{{{
commandManager.add(new vimperator.Command(["dia[log]"], commandManager.add(new vimperator.Command(["dia[log]"],
function (args, special) function (args, special)
{ {
function viewPartialSource()
{
// copied (and tuned somebit) from browser.jar -> nsContextMenu.js
var focusedWindow = document.commandDispatcher.focusedWindow;
if (focusedWindow == window)
focusedWindow = content;
var docCharset = null;
if (focusedWindow)
docCharset = "charset=" + focusedWindow.document.characterSet;
var reference = null;
reference = focusedWindow.getSelection();
var docUrl = null;
window.openDialog("chrome://global/content/viewPartialSource.xul",
"_blank", "scrollbars,resizable,chrome,dialog=no",
docUrl, docCharset, reference, "selection");
}
try try
{ {
switch (args) switch (args)
@@ -728,7 +748,7 @@ vimperator.Commands = function () //{{{
case "saveframe": saveFrameDocument(); break; case "saveframe": saveFrameDocument(); break;
case "savepage": saveDocument(window.content.document); break; case "savepage": saveDocument(window.content.document); break;
case "searchengines": openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); break; case "searchengines": openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); break;
// TODO add viewPartialSource('selection'); ... case "selectionsource": viewPartialSource(); break;
case "": vimperator.echoerr("E474: Invalid argument"); break; case "": vimperator.echoerr("E474: Invalid argument"); break;
default: vimperator.echoerr("Dialog '" + args + "' not available"); default: vimperator.echoerr("Dialog '" + args + "' not available");
} }

View File

@@ -171,7 +171,8 @@ vimperator.Completion = function () //{{{
["print", "Show print dialog"], ["print", "Show print dialog"],
["saveframe", "Save frame to disk"], ["saveframe", "Save frame to disk"],
["savepage", "Save page to disk"], ["savepage", "Save page to disk"],
["searchengines", "Manage installed search engines"] ["searchengines", "Manage installed search engines"],
["selectionsource", "View selection source"]
]; ];
if (!filter) if (!filter)