jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/confirm/nativeconfirm.js

26 lines
546 B
JavaScript
Raw Normal View History

2016-02-22 11:25:45 -07:00
define([], function () {
2016-02-22 21:20:13 -07:00
function replaceAll(str, find, replace) {
return str.split(find).join(replace);
}
2016-02-22 11:25:45 -07:00
return function (options) {
if (typeof options === 'string') {
options = {
title: '',
text: options
};
}
2016-02-22 21:20:13 -07:00
var text = replaceAll(options.text || '', '<br/>', '\n');
var result = confirm(text);
2016-02-22 11:25:45 -07:00
if (result) {
return Promise.resolve();
} else {
return Promise.reject();
}
};
});