mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-08 12:35:46 +01:00
@@ -746,6 +746,7 @@ var Hints = Module("hints", {
|
||||
this.modes = {};
|
||||
this.addMode(";", "Focus hint", buffer.closure.focusElement);
|
||||
this.addMode("?", "Show information for hint", function (elem) buffer.showElementInfo(elem));
|
||||
// TODO: allow for ! override to overwrite existing paths -- where? --djk
|
||||
this.addMode("s", "Save hint", function (elem) buffer.saveLink(elem, false));
|
||||
this.addMode("f", "Focus frame", function (elem) dactyl.focus(elem.ownerDocument.defaultView));
|
||||
this.addMode("F", "Focus frame or pseudo-frame", buffer.closure.focusElement, isScrollable);
|
||||
|
||||
@@ -207,6 +207,8 @@ io.eNotDir = Not a directory
|
||||
io.eNotDir-1 = Not a directory %S
|
||||
io.exists = File exists (add ! to override)
|
||||
io.exists-1 = File %S exists (add ! to override)
|
||||
# XXX
|
||||
io.existsNoOverride-1 = File %S exists
|
||||
io.noCommand-1 = Command not found: %S
|
||||
io.noPrevDir = E186: No previous directory
|
||||
io.noSuchDir-1 = E344: Can't find directory %S
|
||||
|
||||
@@ -585,8 +585,9 @@ var Buffer = Module("Buffer", {
|
||||
* Saves a page link to disk.
|
||||
*
|
||||
* @param {HTMLAnchorElement} elem The page link to save.
|
||||
* @param {boolean} overwrite If true, overwrite any existing file.
|
||||
*/
|
||||
saveLink: function saveLink(elem) {
|
||||
saveLink: function saveLink(elem, overwrite) {
|
||||
let { completion, dactyl, io } = this.modules;
|
||||
|
||||
let self = this;
|
||||
@@ -604,6 +605,8 @@ var Buffer = Module("Buffer", {
|
||||
if (file.exists() && file.isDirectory())
|
||||
file.append(Buffer.getDefaultNames(elem)[0][0]);
|
||||
|
||||
util.assert(!file.exists() || overwrite, _("io.existsNoOverride", file.path));
|
||||
|
||||
try {
|
||||
if (!file.exists())
|
||||
file.create(File.NORMAL_FILE_TYPE, octal(644));
|
||||
|
||||
Reference in New Issue
Block a user