mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-01 09:53:37 +02:00
Check for the existence of certain dialogs. Closes issue #129.
This commit is contained in:
@@ -1319,6 +1319,8 @@ const Dactyl = Module("dactyl", {
|
|||||||
let dialog = args[0];
|
let dialog = args[0];
|
||||||
|
|
||||||
dactyl.assert(dialog in config.dialogs, "E475: Invalid argument: " + dialog);
|
dactyl.assert(dialog in config.dialogs, "E475: Invalid argument: " + dialog);
|
||||||
|
dactyl.assert(!config.dialogs[dialog][2] || config.dialogs[dialog][2](),
|
||||||
|
"Dialog " + dialog + " not available");
|
||||||
try {
|
try {
|
||||||
config.dialogs[dialog][1]();
|
config.dialogs[dialog][1]();
|
||||||
}
|
}
|
||||||
@@ -1916,7 +1918,8 @@ const Dactyl = Module("dactyl", {
|
|||||||
completion: function () {
|
completion: function () {
|
||||||
completion.dialog = function dialog(context) {
|
completion.dialog = function dialog(context) {
|
||||||
context.title = ["Dialog"];
|
context.title = ["Dialog"];
|
||||||
context.completions = [[k, v[0]] for ([k, v] in Iterator(config.dialogs))];
|
context.filters.push(function ({ item }) !item[2] || item[2]());
|
||||||
|
context.completions = [[k, v[0], v[2]] for ([k, v] in Iterator(config.dialogs))];
|
||||||
};
|
};
|
||||||
|
|
||||||
completion.extension = function extension(context) {
|
completion.extension = function extension(context) {
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ const Config = Module("config", ConfigBase, {
|
|||||||
bookmarks: ["List your bookmarks",
|
bookmarks: ["List your bookmarks",
|
||||||
function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
|
function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
|
||||||
checkupdates: ["Check for updates",
|
checkupdates: ["Check for updates",
|
||||||
function () { window.checkForUpdates(); }],
|
function () { window.checkForUpdates(); },
|
||||||
|
function () "checkForUpdates" in window],
|
||||||
cleardata: ["Clear private data",
|
cleardata: ["Clear private data",
|
||||||
function () { Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue).sanitize(window || null); }],
|
function () { Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue).sanitize(window || null); }],
|
||||||
cookies: ["List your cookies",
|
cookies: ["List your cookies",
|
||||||
@@ -56,7 +57,8 @@ const Config = Module("config", ConfigBase, {
|
|||||||
customizetoolbar: ["Customize the Toolbar",
|
customizetoolbar: ["Customize the Toolbar",
|
||||||
function () { window.BrowserCustomizeToolbar(); }],
|
function () { window.BrowserCustomizeToolbar(); }],
|
||||||
dominspector: ["DOM Inspector",
|
dominspector: ["DOM Inspector",
|
||||||
function () { try { window.inspectDOMDocument(content.document); } catch (e) { dactyl.echoerr("DOM Inspector extension not installed"); } }],
|
function () { window.inspectDOMDocument(content.document); },
|
||||||
|
function () "inspectDOMDocument" in window],
|
||||||
downloads: ["Manage Downloads",
|
downloads: ["Manage Downloads",
|
||||||
function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
|
function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
|
||||||
history: ["List your history",
|
history: ["List your history",
|
||||||
@@ -90,7 +92,8 @@ const Config = Module("config", ConfigBase, {
|
|||||||
selectionsource: ["View selection source",
|
selectionsource: ["View selection source",
|
||||||
function () { buffer.viewSelectionSource(); }],
|
function () { buffer.viewSelectionSource(); }],
|
||||||
venkman: ["The JavaScript debugger",
|
venkman: ["The JavaScript debugger",
|
||||||
function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); start_venkman() }]
|
function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); start_venkman() },
|
||||||
|
function () "start_venkman" in window]
|
||||||
},
|
},
|
||||||
|
|
||||||
features: [
|
features: [
|
||||||
|
|||||||
Reference in New Issue
Block a user