delayButtons
→ buttonDelay
in Zotero.Prompt
Too confusing to swap order of original flag
This commit is contained in:
parent
f9faa0415f
commit
92165cb9ed
1 changed files with 7 additions and 3 deletions
|
@ -53,12 +53,12 @@ Zotero.Prompt = {
|
||||||
* checkbox when this method is called and the final checked
|
* checkbox when this method is called and the final checked
|
||||||
* state after this method returns. Either {} or { value: true/false }.
|
* state after this method returns. Either {} or { value: true/false }.
|
||||||
* - {Number} defaultButton - The index of default button. 0 by default
|
* - {Number} defaultButton - The index of default button. 0 by default
|
||||||
* - {Boolean} delayButtons - Make the buttons initially disabled and enable them after some period
|
* - {Boolean} buttonDelay - Make the buttons initially disabled and enable them after some period
|
||||||
* so that the user doesn't click through the dialog without reading it.
|
* so that the user doesn't click through the dialog without reading it.
|
||||||
* @returns {Number} The index of the button pressed.
|
* @returns {Number} The index of the button pressed.
|
||||||
*/
|
*/
|
||||||
confirm(options = {}) {
|
confirm(options = {}) {
|
||||||
let { window: win, title, text, button0, button1, button2, checkLabel, checkbox, defaultButton, delayButtons } = options;
|
let { window: win, title, text, button0, button1, button2, checkLabel, checkbox, defaultButton, buttonDelay, delayButtons } = options;
|
||||||
if (!win) win = null;
|
if (!win) win = null;
|
||||||
if (!title) throw new Error('`title` is required');
|
if (!title) throw new Error('`title` is required');
|
||||||
if (!text) throw new Error('`text` is required');
|
if (!text) throw new Error('`text` is required');
|
||||||
|
@ -69,7 +69,11 @@ Zotero.Prompt = {
|
||||||
throw new Error('`checkLabel` provided without `checkbox` option');
|
throw new Error('`checkLabel` provided without `checkbox` option');
|
||||||
}
|
}
|
||||||
// Skip button delay in CI
|
// Skip button delay in CI
|
||||||
let flags = (delayButtons && !Zotero.automatedTest) ? Services.prompt.BUTTON_DELAY_ENABLE : 0;
|
if (delayButtons) {
|
||||||
|
Zotero.warn("Zotero.Prompt.confirm() option 'delayButtons' is deprecated -- use 'buttonDelay'");
|
||||||
|
buttonDelay = true;
|
||||||
|
}
|
||||||
|
let flags = (buttonDelay && !Zotero.automatedTest) ? Services.prompt.BUTTON_DELAY_ENABLE : 0;
|
||||||
if (typeof button0 == 'number') flags += Services.prompt.BUTTON_POS_0 * button0;
|
if (typeof button0 == 'number') flags += Services.prompt.BUTTON_POS_0 * button0;
|
||||||
else if (typeof button0 == 'string') flags += Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING;
|
else if (typeof button0 == 'string') flags += Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING;
|
||||||
if (typeof button1 == 'number') flags += Services.prompt.BUTTON_POS_1 * button1;
|
if (typeof button1 == 'number') flags += Services.prompt.BUTTON_POS_1 * button1;
|
||||||
|
|
Loading…
Reference in a new issue