mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
28 lines
599 B
JavaScript
28 lines
599 B
JavaScript
define([], function () {
|
|
'use strict';
|
|
|
|
function replaceAll(str, find, replace) {
|
|
|
|
return str.split(find).join(replace);
|
|
}
|
|
|
|
return function (options) {
|
|
|
|
if (typeof options === 'string') {
|
|
options = {
|
|
label: '',
|
|
text: options
|
|
};
|
|
}
|
|
|
|
var label = replaceAll(options.label || '', '<br/>', '\n');
|
|
|
|
var result = prompt(label, options.text || '');
|
|
|
|
if (result) {
|
|
return Promise.resolve(result);
|
|
} else {
|
|
return Promise.reject(result);
|
|
}
|
|
};
|
|
}); |