: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* This was created inspired by the toastr. Thanks to developers of toastr.
* CodeSeven/toastr: http://johnpapa.net <https://github.com/CodeSeven/toastr>
jQuery.fn.elfindertoast = function(opts, fm) {
var defOpts = Object.assign({
mode: 'success', // or 'info', 'warning' and 'error'
showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
showEasing: 'swing', //swing and linear are built into jQuery
}, jQuery.isPlainObject(fm.options.uiOptions.toast.defaults)? fm.options.uiOptions.toast.defaults : {});
return this.each(function() {
opts = Object.assign({}, defOpts, opts || {});
duration: opts.showDuration,
opts.onShown && opts.onShown();
if (!notm && opts.timeOut) {
rmTm = setTimeout(rm, opts.timeOut);
duration: opts.hideDuration,
opts.onHidden && opts.onHidden();
self.on('click', function(e) {
rmTm && clearTimeout(rmTm);
opts.onHidden && opts.onHidden();
}).on('mouseenter mouseleave', function(e) {
rmTm && clearTimeout(rmTm);
if (e.type === 'mouseenter') {
rmTm = setTimeout(rm, opts.timeOut);
}).hide().addClass('toast-' + opts.mode).append(jQuery('<div class="elfinder-toast-msg"></div>').html(opts.msg.replace(/%([a-zA-Z0-9]+)%/g, function(m, m1) {
self.append(opts.extNode);
jQuery('<button class="ui-button ui-widget ui-state-default ui-corner-all elfinder-tabstop"></button>')
.append(jQuery('<span class="ui-button-text"></span>').text(fm.i18n(opts.button.text)))
.on('mouseenter mouseleave', function(e) {
jQuery(this).toggleClass('ui-state-hover', e.type == 'mouseenter');
.on('click', opts.button.click || function(){})
self.css('max-width', opts.width);