|
|
@ -11,12 +11,21 @@ module.exports = { |
|
|
|
alert: function (text) { |
|
|
|
alert: function (text) { |
|
|
|
modal('', yo`<div>${text}</div>`, null, { label: null }) |
|
|
|
modal('', yo`<div>${text}</div>`, null, { label: null }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
prompt: function ({ title, text, inputValue, multiline }, ok, cancel) { |
|
|
|
prompt: function (title, text, inputValue, ok, cancel) { |
|
|
|
if (!inputValue) inputValue = '' |
|
|
|
if (!inputValue) inputValue = '' |
|
|
|
var input = multiline |
|
|
|
var input = yo`<input type='text' name='prompt_text' id='prompt_text' class="${css['prompt_text']}" value='${inputValue}' >` |
|
|
|
? yo`<textarea id="prompt_text" class=${css.prompt_text} rows="4" cols="50"></textarea>` |
|
|
|
modal(title, yo`<div>${text}<div>${input}</div></div>`, |
|
|
|
: yo`<input type='text' name='prompt_text' id='prompt_text' class="${css['prompt_text']}" value='${inputValue}' >` |
|
|
|
{ |
|
|
|
|
|
|
|
fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) } |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fn: () => { if (typeof cancel === 'function') cancel() } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
promptMulti: function ({ title, text, inputValue }, ok, cancel) { |
|
|
|
|
|
|
|
if (!inputValue) inputValue = '' |
|
|
|
|
|
|
|
var input =yo`<textarea id="prompt_text" class=${css.prompt_text} rows="4" cols="50"></textarea>` |
|
|
|
modal(title, yo`<div>${text}<div>${input}</div></div>`, |
|
|
|
modal(title, yo`<div>${text}<div>${input}</div></div>`, |
|
|
|
{ |
|
|
|
{ |
|
|
|
fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) } |
|
|
|
fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) } |
|
|
|