mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 16:32:27 +01:00
Allow argument to :w
This commit is contained in:
@@ -231,7 +231,7 @@ liberator.Buffer = function () //{{{
|
|||||||
{
|
{
|
||||||
consoleService.registerListener(listener);
|
consoleService.registerListener(listener);
|
||||||
if (testDoc.documentElement.firstChild)
|
if (testDoc.documentElement.firstChild)
|
||||||
testDoc.documentElement.removeChild(testDoc.documentElement.firstChild);
|
testDoc.documentElement.removeChild(testDoc.lastChild);
|
||||||
testDoc.documentElement.appendChild(util.xmlToDom(
|
testDoc.documentElement.appendChild(util.xmlToDom(
|
||||||
<html><head><link type="text/css" rel="stylesheet" href={uri}/></head></html>, testDoc));
|
<html><head><link type="text/css" rel="stylesheet" href={uri}/></head></html>, testDoc));
|
||||||
|
|
||||||
@@ -473,7 +473,7 @@ liberator.Buffer = function () //{{{
|
|||||||
{
|
{
|
||||||
if (liberator.mappings.repeat)
|
if (liberator.mappings.repeat)
|
||||||
{
|
{
|
||||||
for (let i in liberator.util.range(0, count || 1))
|
for (let i in liberator.util.rangeInterruptable(0, count || 1, 100))
|
||||||
liberator.mappings.repeat();
|
liberator.mappings.repeat();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -797,20 +797,29 @@ liberator.Buffer = function () //{{{
|
|||||||
"Save current document to disk",
|
"Save current document to disk",
|
||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
//var file = liberator.io.getFile(args || "");
|
let doc = window.content.document;
|
||||||
// we always want to save that link relative to the current working directory
|
let file = liberator.io.getFile(args || "");
|
||||||
|
if (args && file.exists() && !special)
|
||||||
|
return liberator.echoerr("E13: File exists (add ! to override)");
|
||||||
|
|
||||||
liberator.options.setPref("browser.download.lastDir", liberator.io.getCurrentDirectory());
|
liberator.options.setPref("browser.download.lastDir", liberator.io.getCurrentDirectory());
|
||||||
//if (args)
|
try
|
||||||
//{
|
{
|
||||||
// saveURL(liberator.buffer.URL, args, null, true, special, // special == skipPrompt
|
var contentDisposition = window.content
|
||||||
// makeURI(liberator.buffer.URL, content.document.characterSet));
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
//}
|
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||||
//else
|
.getDocumentMetadata("content-disposition");
|
||||||
saveDocument(window.content.document, special);
|
} catch (e) {}
|
||||||
|
|
||||||
|
internalSave(doc.location.href, doc, null, contentDisposition,
|
||||||
|
doc.contentType, false, null,
|
||||||
|
args && { file: file, uri: makeURI(doc.location.href, doc.characterSet) },
|
||||||
|
doc.referrer ? makeURI(doc.referrer) : null,
|
||||||
|
true);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "0",
|
bang: true,
|
||||||
bang: true
|
completer: function (filter) liberator.completion.file(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["st[op]"],
|
liberator.commands.add(["st[op]"],
|
||||||
|
|||||||
@@ -535,6 +535,27 @@ liberator.Events = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wrapListener(method)
|
||||||
|
{
|
||||||
|
return function (event)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
liberator.dump(event);
|
||||||
|
eventManager[method](event);
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
if (e.message == "Interrupted")
|
||||||
|
liberator.echoerr("Interrupted");
|
||||||
|
else
|
||||||
|
liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
|
||||||
|
if (Components.utils.reportError)
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// return true when load successful, or false otherwise
|
// return true when load successful, or false otherwise
|
||||||
function waitForPageLoaded()
|
function waitForPageLoaded()
|
||||||
{
|
{
|
||||||
@@ -1195,6 +1216,13 @@ liberator.Events = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key == "<C-c>")
|
||||||
|
liberator.interrupted = true;
|
||||||
|
|
||||||
|
// feedingKeys needs to be separate from interrupted so
|
||||||
|
// we can differentiate between a recorded <C-c>
|
||||||
|
// interrupting whatever it's started and a real <C-c>
|
||||||
|
// interrupting our playback.
|
||||||
if (liberator.events.feedingKeys)
|
if (liberator.events.feedingKeys)
|
||||||
{
|
{
|
||||||
if (key == "<C-c>" && !event.isMacro)
|
if (key == "<C-c>" && !event.isMacro)
|
||||||
@@ -1207,9 +1235,6 @@ liberator.Events = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == "<C-c>")
|
|
||||||
liberator.interrupted = true;
|
|
||||||
|
|
||||||
var stop = true; // set to false if we should NOT consume this event but let Firefox handle it
|
var stop = true; // set to false if we should NOT consume this event but let Firefox handle it
|
||||||
|
|
||||||
var win = document.commandDispatcher.focusedWindow;
|
var win = document.commandDispatcher.focusedWindow;
|
||||||
@@ -1611,9 +1636,9 @@ liberator.Events = function () //{{{
|
|||||||
eventManager.prefObserver.unregister();
|
eventManager.prefObserver.unregister();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("keypress", eventManager.onKeyPress, true);
|
window.addEventListener("keypress", wrapListener("onKeyPress"), true);
|
||||||
window.addEventListener("keydown", eventManager.onKeyUpOrDown, true);
|
window.addEventListener("keydown", wrapListener("onKeyUpOrDown"), true);
|
||||||
window.addEventListener("keyup", eventManager.onKeyUpOrDown, true);
|
window.addEventListener("keyup", wrapListener("onKeyUpOrDown"), true);
|
||||||
|
|
||||||
return eventManager;
|
return eventManager;
|
||||||
|
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
liberator.echoerr(e.toString());
|
liberator.echoerr(e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -269,12 +269,11 @@ ________________________________________________________________________________
|
|||||||
section:Writing[writing,save-file]
|
section:Writing[writing,save-file]
|
||||||
|
|
||||||
|:w| |:write| |:sav| |:saveas| +
|
|:w| |:write| |:sav| |:saveas| +
|
||||||
||:sav[eas]||
|
||:sav[eas][!] [file]||
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
Save current web page to disk. Opens the original Firefox "Save page as..."
|
Save current web page to disk. If [file] is omitted, save to the page's
|
||||||
dialog. There, you can save the current web page to disk with various
|
default filename. Existing documents will only be overwritten if [!] is
|
||||||
options. Use [!] to save the file with a default filename to the current working
|
given.
|
||||||
directory, skipping the "Save as..." prompt
|
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
section:Quitting[quitting,save-session]
|
section:Quitting[quitting,save-session]
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
padding: 0 .5ex;
|
padding: 0 .5ex;
|
||||||
}
|
}
|
||||||
.compitem-td-span { height: 1.5em; display: block; min-height: 16px; }
|
.compitem-td-span { height: 1.5em; line-height: 1.5em !important; display: block; min-height: 16px; }
|
||||||
|
|
||||||
.compitem[selected=true] { background-color: yellow; }
|
.compitem[selected=true] { background-color: yellow; }
|
||||||
.compitem > .favicon { width: 16px; }
|
.compitem > .favicon { width: 16px; }
|
||||||
|
|||||||
Reference in New Issue
Block a user