mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-10 08:04:15 +01:00
Merge default.
--HG-- branch : mode-refactoring
This commit is contained in:
@@ -1025,6 +1025,25 @@ const Dactyl = Module("dactyl", {
|
||||
}
|
||||
},
|
||||
|
||||
wrapCallback: function (callback, self) {
|
||||
self = self || this;
|
||||
let save = ["forceNewTab", "forceNewWindow"];
|
||||
let saved = save.map(function (p) dactyl[p]);
|
||||
return function wrappedCallback() {
|
||||
let vals = save.map(function (p) dactyl[p]);
|
||||
saved.forEach(function (p, i) dactyl[save[i]] = p);
|
||||
try {
|
||||
return callback.apply(self, arguments);
|
||||
}
|
||||
catch (e) {
|
||||
dactyl.reportError(e, true);
|
||||
}
|
||||
finally {
|
||||
vals.forEach(function (p, i) dactyl[save[i]] = p);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {Window[]} Returns an array of all the host application's
|
||||
* open windows.
|
||||
@@ -1415,6 +1434,34 @@ const Dactyl = Module("dactyl", {
|
||||
onInstallFailed: listener("installation", "failed")
|
||||
};
|
||||
|
||||
const updateAddons = Class("UpgradeListener", {
|
||||
init: function init(addons) {
|
||||
this.remaining = addons;
|
||||
this.upgrade = [];
|
||||
dactyl.echomsg("Checking updates for addons: " + addons.map(function (a) a.name).join(", "));
|
||||
for (let addon in values(addons))
|
||||
addon.findUpdates(this, AddonManager.UPDATE_WHEN_USER_REQUESTED, null, null);
|
||||
},
|
||||
addonListener: {
|
||||
__proto__: addonListener,
|
||||
onDownloadStarted: function () {},
|
||||
onDownloadEnded: function () {}
|
||||
},
|
||||
onUpdateAvailable: function (addon, install) {
|
||||
this.upgrade.push(addon);
|
||||
install.addListener(this.addonListener);
|
||||
install.install();
|
||||
},
|
||||
onUpdateFinished: function (addon, error) {
|
||||
this.remaining = this.remaining.filter(function (a) a != addon);
|
||||
if (!this.remaining.length)
|
||||
dactyl.echomsg(
|
||||
this.upgrade.length
|
||||
? "Installing updates for addons: " + this.upgrade.map(function (i) i.name).join(", ")
|
||||
: "No addon updates found");
|
||||
}
|
||||
});
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function callResult(method) {
|
||||
@@ -1470,6 +1517,13 @@ const Dactyl = Module("dactyl", {
|
||||
action: function (addon) addon.userDisabled = true,
|
||||
filter: function ({ item }) !item.userDisabled,
|
||||
perm: "disable"
|
||||
},
|
||||
{
|
||||
name: "extu[update]",
|
||||
description: "Update an extension",
|
||||
actions: updateAddons,
|
||||
filter: function ({ item }) !item.userDisabled,
|
||||
perm: "upgrade"
|
||||
}
|
||||
].forEach(function (command) {
|
||||
let perm = AddonManager["PERM_CAN_" + command.perm.toUpperCase()];
|
||||
@@ -1483,13 +1537,16 @@ const Dactyl = Module("dactyl", {
|
||||
else
|
||||
dactyl.assert(name, "E471: Argument required");
|
||||
|
||||
AddonManager.getAddonsByTypes(["extension"], function (list) {
|
||||
AddonManager.getAddonsByTypes(["extension"], dactyl.wrapCallback(function (list) {
|
||||
if (!args.bang)
|
||||
list = list.filter(function (extension) extension.name == name);
|
||||
if (!args.bang && !list.every(ok))
|
||||
return dactyl.echoerr("Permission denied");
|
||||
list.forEach(command.action);
|
||||
});
|
||||
if (command.actions)
|
||||
command.actions(list);
|
||||
else
|
||||
list.forEach(command.action);
|
||||
}));
|
||||
}, {
|
||||
argCount: "?", // FIXME: should be "1"
|
||||
bang: true,
|
||||
@@ -1506,16 +1563,15 @@ const Dactyl = Module("dactyl", {
|
||||
commands.add(["exto[ptions]", "extp[references]"],
|
||||
"Open an extension's preference dialog",
|
||||
function (args) {
|
||||
let tab = dactyl.forceNewTab;
|
||||
AddonManager.getAddonsByTypes(["extension"], function (list) {
|
||||
AddonManager.getAddonsByTypes(["extension"], dactyl.wrapCallback(function (list) {
|
||||
list = list.filter(function (extension) extension.name == args[0]);
|
||||
if (!list.length || !list[0].optionsURL)
|
||||
dactyl.echoerr("E474: Invalid argument");
|
||||
else if (args.bang)
|
||||
window.openDialog(list[0].optionsURL, "_blank", "chrome");
|
||||
else
|
||||
dactyl.open(list[0].optionsURL, { from: "extoptions", where: tab && dactyl.NEW_TAB });
|
||||
});
|
||||
dactyl.open(list[0].optionsURL, { from: "extoptions" });
|
||||
}));
|
||||
}, {
|
||||
argCount: "1",
|
||||
bang: true,
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
<item>
|
||||
<tags>:exta :extadd</tags>
|
||||
<spec>:exta<oa>dd</oa> <a>file|url</a></spec>
|
||||
<strut/>
|
||||
<description>
|
||||
<p>
|
||||
Install an extension. <a>file|uri</a> must be the local file
|
||||
@@ -93,6 +94,7 @@
|
||||
<tags>:extde :extdelete</tags>
|
||||
<spec>:extde<oa>lete</oa> <a>extension</a></spec>
|
||||
<spec>:extde<oa>lete</oa>!</spec>
|
||||
<strut/>
|
||||
<description>
|
||||
<p>
|
||||
Uninstall an extension. <a>extension</a> is the extension's name. When <oa>!</oa> is given
|
||||
@@ -105,6 +107,7 @@
|
||||
<tags>:extd :extdisable</tags>
|
||||
<spec>:extd<oa>isable</oa> <a>extension</a></spec>
|
||||
<spec>:extd<oa>isable</oa>!</spec>
|
||||
<strut/>
|
||||
<description>
|
||||
<p>
|
||||
Disable an extension. <a>extension</a> is the extension's name. When <oa>!</oa> is given
|
||||
@@ -117,6 +120,7 @@
|
||||
<tags>:exte :extenable</tags>
|
||||
<spec>:exte<oa>nable</oa> <a>extension</a></spec>
|
||||
<spec>:exte<oa>nable</oa>!</spec>
|
||||
<strut/>
|
||||
<description>
|
||||
<p>
|
||||
Enable an extension. <a>extension</a> is the extension's name. When <oa>!</oa> is given all
|
||||
@@ -129,6 +133,7 @@
|
||||
<tags>:exts :extens :extensions</tags>
|
||||
<spec>:extens<oa>ions</oa></spec>
|
||||
<spec>:exts</spec>
|
||||
<strut/>
|
||||
<description>
|
||||
<p>List all installed extensions.</p>
|
||||
</description>
|
||||
@@ -147,6 +152,17 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>:extu :extupdate</tags>
|
||||
<spec>:extu<oa>pdate</oa><oa>!</oa> <a>extension</a></spec>
|
||||
<description>
|
||||
<p>
|
||||
Update an extension. When <oa>!</oa> is given, update all
|
||||
extensions.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<h2 tag="sidebar">Sidebar</h2>
|
||||
|
||||
<item>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
* Added BookmarkChange, BookmarkRemove autocommands.
|
||||
* Added -keyword, -tags, -title to :delbmarks.
|
||||
* Added "passwords" and "venkman" dialogs to :dialog.
|
||||
* Added :extupdate command
|
||||
* Added 'hintkeys' option.
|
||||
* Added "transliterated" option to 'hintmatching'.
|
||||
* Replaced 'focuscontent' with 'strictfocus'.
|
||||
|
||||
@@ -6,10 +6,25 @@
|
||||
em:name="Pentadactyl"
|
||||
em:version="1.0b3pre"
|
||||
em:description="Firefox for Vim and Links addicts"
|
||||
em:creator="Kris Maglione"
|
||||
em:homepageURL="http://dactyl.sourceforge.net/pentadactyl"
|
||||
em:iconURL="chrome://pentadactyl/skin/icon.png"
|
||||
em:optionsURL="chrome://dactyl/content/preferences.xul">
|
||||
|
||||
<em:creator>Kris Maglione, Doug Kearns</em:creator>
|
||||
<em:developer>Štěpán Němec</em:developer>
|
||||
|
||||
<em:contributor>anekos</em:contributor>
|
||||
<em:contributor>teramako</em:contributor>
|
||||
<em:contributor>Viktor Kojouharov (Виктор Кожухаров)</em:contributor>
|
||||
<em:contributor>Marco Candrian</em:contributor>
|
||||
<em:contributor>Daniel Bainton</em:contributor>
|
||||
<em:contributor>Konstantin Stepanov</em:contributor>
|
||||
<em:contributor>Tim Hammerquist</em:contributor>
|
||||
<em:contributor>Ted Pavlic</em:contributor>
|
||||
<em:contributor>janus_wel</em:contributor>
|
||||
<em:contributor>Martin Stubenschrott</em:contributor>
|
||||
<em:contributor>Conrad Irwin</em:contributor>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description
|
||||
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
||||
|
||||
Reference in New Issue
Block a user