You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

/*!
* remark (http://getbootstrapadmin.com/remark)
* Copyright 2016 amazingsurge
* Licensed under the Themeforest Standard Licenses
*/
$.components.register("toastr", {
mode: "api",
api: function() {
if (typeof toastr === "undefined") return;
var defaults = $.components.getDefaults("toastr");
$(document).on('click.site.toastr', '[data-plugin="toastr"]', function(e) {
e.preventDefault();
var $this = $(this);
var options = $.extend(true, {}, defaults, $this.data());
var message = options.message || '';
var type = options.type || "info";
var title = options.title || undefined;
switch (type) {
case "success":
toastr.success(message, title, options);
break;
case "warning":
toastr.warning(message, title, options);
break;
case "error":
toastr.error(message, title, options);
break;
case "info":
toastr.info(message, title, options);
break;
default:
toastr.info(message, title, options);
}
});
}
});