mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 12:07:57 +01:00
Add :private command.
This commit is contained in:
@@ -1002,12 +1002,18 @@ var CommandLine = Module("commandline", {
|
|||||||
save: function save() {
|
save: function save() {
|
||||||
if (events.feedingKeys)
|
if (events.feedingKeys)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let str = this.input.value;
|
let str = this.input.value;
|
||||||
if (/^\s*$/.test(str))
|
if (/^\s*$/.test(str))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
let privateData = this.checkPrivate(str);
|
||||||
|
if (privateData == "never-save")
|
||||||
|
return;
|
||||||
|
|
||||||
this.store = this.store.filter(function (line) (line.value || line) != str);
|
this.store = this.store.filter(function (line) (line.value || line) != str);
|
||||||
dactyl.trapErrors(function () {
|
dactyl.trapErrors(function () {
|
||||||
this.store.push({ value: str, timestamp: Date.now()*1000, privateData: this.checkPrivate(str) });
|
this.store.push({ value: str, timestamp: Date.now()*1000, privateData: privateData });
|
||||||
}, this);
|
}, this);
|
||||||
this.store = this.store.slice(Math.max(0, this.store.length - options["history"]));
|
this.store = this.store.slice(Math.max(0, this.store.length - options["history"]));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
NEW_WINDOW: "window",
|
NEW_WINDOW: "window",
|
||||||
|
|
||||||
forceBackground: null,
|
forceBackground: null,
|
||||||
|
forcePrivate: null,
|
||||||
forceTarget: null,
|
forceTarget: null,
|
||||||
|
|
||||||
get forceOpen() ({ background: this.forceBackground,
|
get forceOpen() ({ background: this.forceBackground,
|
||||||
@@ -955,7 +956,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
case dactyl.NEW_WINDOW:
|
case dactyl.NEW_WINDOW:
|
||||||
let win = window.openDialog(document.documentURI, "_blank", "chrome,all,dialog=no");
|
let options = ["chrome", "all", "dialog=no"];
|
||||||
|
if (dactyl.forcePrivate)
|
||||||
|
options.push("private");
|
||||||
|
|
||||||
|
let win = window.openDialog(document.documentURI, "_blank", options.join(","));
|
||||||
util.waitFor(function () win.document.readyState === "complete");
|
util.waitFor(function () win.document.readyState === "complete");
|
||||||
browser = win.dactyl && win.dactyl.modules.config.tabbrowser || win.getBrowser();
|
browser = win.dactyl && win.dactyl.modules.config.tabbrowser || win.getBrowser();
|
||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
@@ -1560,6 +1565,21 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
literal: 0
|
literal: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
commands.add(["pr[ivate]", "pr0n", "porn"],
|
||||||
|
"Enable privacy features of a command, when applicable, and do not save the invocation in command history",
|
||||||
|
function (args) {
|
||||||
|
dactyl.withSavedValues(["forcePrivate"], function () {
|
||||||
|
this.forcePrivate = true;
|
||||||
|
dactyl.execute(args[0], null, true);
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
argCount: "1",
|
||||||
|
completer: function (context) completion.ex(context),
|
||||||
|
literal: 0,
|
||||||
|
privateData: "never-save",
|
||||||
|
subCommand: 0
|
||||||
|
});
|
||||||
|
|
||||||
commands.add(["exit", "x"],
|
commands.add(["exit", "x"],
|
||||||
"Quit " + config.appName,
|
"Quit " + config.appName,
|
||||||
function (args) {
|
function (args) {
|
||||||
|
|||||||
@@ -143,6 +143,10 @@
|
|||||||
Like <ex>:tabopen</ex>, but all arguments are opened in
|
Like <ex>:tabopen</ex>, but all arguments are opened in
|
||||||
a single new window.
|
a single new window.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
When called via <ex>:private</ex>, the new window is a
|
||||||
|
private browsing window.
|
||||||
|
</p>
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,19 @@
|
|||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags>:private :pr</tags>
|
||||||
|
<tags>:pr0n :porn</tags>
|
||||||
|
<strut/>
|
||||||
|
<spec>:pr<oa>ivate</oa> <a>cmd</a></spec>
|
||||||
|
<description>
|
||||||
|
<p>
|
||||||
|
Execute <a>cmd</a> with privacy features enabled, and
|
||||||
|
do not save the invocation in command history.
|
||||||
|
</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
<h2 tag="cookie-settings">Cookie settings</h2>
|
<h2 tag="cookie-settings">Cookie settings</h2>
|
||||||
<item>
|
<item>
|
||||||
<tags>:cookies :ck</tags>
|
<tags>:cookies :ck</tags>
|
||||||
|
|||||||
@@ -915,7 +915,8 @@ var Commands = Module("commands", {
|
|||||||
hasPrivateData: function hasPrivateData(command) {
|
hasPrivateData: function hasPrivateData(command) {
|
||||||
for (let [cmd, args] in this.subCommands(command))
|
for (let [cmd, args] in this.subCommands(command))
|
||||||
if (cmd.privateData)
|
if (cmd.privateData)
|
||||||
return !callable(cmd.privateData) || cmd.privateData(args);
|
return !callable(cmd.privateData) ? cmd.privateData
|
||||||
|
: cmd.privateData(args);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
all Vim related files.
|
all Vim related files.
|
||||||
- Vimball packages are no longer available.
|
- Vimball packages are no longer available.
|
||||||
• Removed <F1> and <A-F1> mappings.
|
• Removed <F1> and <A-F1> mappings.
|
||||||
|
• Add :private command.
|
||||||
|
• Better per-window private browsing support.
|
||||||
|
|
||||||
1.0:
|
1.0:
|
||||||
• Extensive Firefox 4 support, including:
|
• Extensive Firefox 4 support, including:
|
||||||
|
|||||||
Reference in New Issue
Block a user