1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/confirm/nativeconfirm.js

27 lines
564 B
JavaScript
Raw Normal View History

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