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();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|