1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/components/prompt/nativeprompt.js

28 lines
599 B
JavaScript
Raw Normal View History

define([], function () {
'use strict';
2018-10-23 01:05:09 +03:00
function replaceAll(str, find, replace) {
return str.split(find).join(replace);
2018-10-23 01:05:09 +03:00
}
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);
}
};
2018-10-23 01:05:09 +03:00
});