Add loadPrefPane(paneName) support function
E.g., loadPrefPane('sync') to open the prefs and select the 'zotero-pane-sync' pane
This commit is contained in:
parent
b732a82d55
commit
640aaa1557
1 changed files with 16 additions and 0 deletions
|
@ -58,6 +58,22 @@ var loadZoteroPane = Zotero.Promise.coroutine(function* (win) {
|
||||||
return win;
|
return win;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var loadPrefPane = Zotero.Promise.coroutine(function* (paneName) {
|
||||||
|
var id = 'zotero-prefpane-' + paneName;
|
||||||
|
var win = yield loadWindow("chrome://zotero/content/preferences/preferences.xul", {
|
||||||
|
pane: id
|
||||||
|
});
|
||||||
|
var doc = win.document;
|
||||||
|
var defer = Zotero.Promise.defer();
|
||||||
|
var pane = doc.getElementById(id);
|
||||||
|
if (!pane.loaded) {
|
||||||
|
pane.addEventListener('paneload', () => defer.resolve());
|
||||||
|
yield defer.promise;
|
||||||
|
}
|
||||||
|
return win;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for a window with a specific URL to open. Returns a promise for the window, and
|
* Waits for a window with a specific URL to open. Returns a promise for the window, and
|
||||||
* optionally passes the window to a callback immediately for use with modal dialogs,
|
* optionally passes the window to a callback immediately for use with modal dialogs,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue