(function ($) { $.fn.bootstrapToastWrapper = function (content) { var type = { 'primary': '#084298', 'secondary': '#41464b', 'success': '#0f5132', 'danger': '#842029', 'warning': '#664d03', 'info': '#055160', 'light': '#636464', 'dark': '#141619' } var toastContent = "
{{type}} {{title}}
{{body}}
"; var rect = ''; rect = rect.replace('{{type}}', type[content['type']]); toastContent = toastContent.replace('{{type}}', rect); for(key in content){ toastContent = toastContent.replace('{{'+key+'}}', content[key] ); } var a = $(this).append(toastContent).children("div:last-child");; if(content.timeout){ setTimeout(function(){ $(a).remove(); }, content.timeout); } } })(jQuery);