1
0
Fork 0
mirror of https://github.com/xevidos/codiad.git synced 2025-03-16 13:28:13 +01:00
codiad/assets/js/message.js

52 lines
1.1 KiB
JavaScript
Raw Normal View History

( function( global, $ ) {
// Define core
let codiad = global.codiad,
scripts = document.getElementsByTagName( 'script' ),
path = scripts[scripts.length-1].src.split( '?' )[0],
curpath = path.split( '/' ).slice( 0, -1 ).join( '/' ) + '/';
//////////////////////////////////////////////////////////////////////
// User Alerts / Messages
//////////////////////////////////////////////////////////////////////
codiad.message = {
init: function() {},
show_message: function( toastType, message, options ) {
options = options || {};
options.text = message;
options.type = toastType
$().toastmessage( 'showToast', options );
},
success: function( m, options ) {
this.show_message( 'success', m, options );
},
error: function( m, options ) {
this.show_message( 'error', m, options );
},
warning: function( m, options ) {
this.show_message( 'warning', m, options );
},
notice: function( m, options ) {
this.show_message( 'notice', m, options );
},
hide: function() {
$(".toast-item-wrapper").remove();
}
};
})( this, jQuery );