/** * Theme: Moltran Admin Template * Author: Coderthemes * Notification */ !function($) { "use strict"; var Notification = function() {}; //simple notificaiton Notification.prototype.notify = function(style,position, title, text) { var icon = 'fa fa-adjust'; if(style == "error"){ icon = "fa fa-exclamation"; }else if(style == "warning"){ icon = "fa fa-warning"; }else if(style == "success"){ icon = "fa fa-check"; }else if(style == "info"){ icon = "fa fa-question"; }else{ icon = "fa fa-adjust"; } $.notify({ title: title, text: text, image: "" }, { style: 'metro', className: style, globalPosition:position, showAnimation: "show", showDuration: 0, hideDuration: 0, autoHide: false, clickToHide: true }); }, //auto hide notification Notification.prototype.autoHideNotify = function (style,position, title, text) { var icon = "fa fa-adjust"; if(style == "error"){ icon = "fa fa-exclamation"; }else if(style == "warning"){ icon = "fa fa-warning"; }else if(style == "success"){ icon = "fa fa-check"; }else if(style == "info"){ icon = "fa fa-question"; }else{ icon = "fa fa-adjust"; } $.notify({ title: title, text: text, image: "" }, { style: 'metro', className: style, globalPosition:position, showAnimation: "show", showDuration: 0, hideDuration: 0, autoHideDelay: 5000, autoHide: true, clickToHide: true }); }, //confirmation notification Notification.prototype.confirm = function(style,position, title) { var icon = "fa fa-adjust"; if(style == "error"){ icon = "fa fa-exclamation"; }else if(style == "warning"){ icon = "fa fa-warning"; }else if(style == "success"){ icon = "fa fa-check"; }else if(style == "info"){ icon = "fa fa-question"; }else{ icon = "fa fa-adjust"; } $.notify({ title: title, text: 'Are you sure you want to do nothing?

Yes No', image: "" }, { style: 'metro', className: style, globalPosition:position, showAnimation: "show", showDuration: 0, hideDuration: 0, autoHide: false, clickToHide: false }); //listen for click events from this style $(document).on('click', '.notifyjs-metro-base .no', function() { //programmatically trigger propogating hide event $(this).trigger('notify-hide'); }); $(document).on('click', '.notifyjs-metro-base .yes', function() { //show button text alert($(this).text() + " clicked!"); //hide notification $(this).trigger('notify-hide'); }); }, //init - examples Notification.prototype.init = function() { }, //init $.Notification = new Notification, $.Notification.Constructor = Notification }(window.jQuery), //initializing function($) { "use strict"; $.Notification.init() }(window.jQuery);