Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. (function(c){var b={inEffect:{opacity:"show"},inEffectDuration:600,stayTime:5000,text:"",sticky:false,type:"notice",position:"top-right",closeText:"",close:null};
  2. var a={init:function(d){if(d){c.extend(b,d)
  3. }},showToast:function(f){var g={};
  4. c.extend(g,b,f);
  5. var j,e,d,i,h;
  6. j=(!c(".toast-container").length)?c("<div></div>").addClass("toast-container").addClass("toast-position-"+g.position).appendTo("body"):c(".toast-container");
  7. e=c("<div></div>").addClass("toast-item-wrapper");
  8. d=c("<div></div>").hide().addClass("toast-item toast-type-"+g.type).appendTo(j).html(c("<p>").append(g.text)).animate(g.inEffect,g.inEffectDuration).wrap(e);
  9. i=c("<div></div>").addClass("toast-item-close").prependTo(d).html(g.closeText).click(function(){c().toastmessage("removeToast",d,g)
  10. });
  11. h=c("<div></div>").addClass("toast-item-image").addClass("toast-item-image-"+g.type).prependTo(d);
  12. if(navigator.userAgent.match(/MSIE 6/i)){j.css({top:document.documentElement.scrollTop})
  13. }if(!g.sticky){setTimeout(function(){c().toastmessage("removeToast",d,g)
  14. },g.stayTime)
  15. }return d
  16. },showNoticeToast:function(e){var d={text:e,type:"notice"};
  17. return c().toastmessage("showToast",d)
  18. },showSuccessToast:function(e){var d={text:e,type:"success"};
  19. return c().toastmessage("showToast",d)
  20. },showErrorToast:function(e){var d={text:e,type:"error"};
  21. return c().toastmessage("showToast",d)
  22. },showWarningToast:function(e){var d={text:e,type:"warning"};
  23. return c().toastmessage("showToast",d)
  24. },removeToast:function(e,d){e.animate({opacity:"0"},600,function(){e.parent().animate({height:"0px"},300,function(){e.parent().remove()
  25. })
  26. });
  27. if(d&&d.close!==null){d.close()
  28. }}};
  29. c.fn.toastmessage=function(d){if(a[d]){return a[d].apply(this,Array.prototype.slice.call(arguments,1))
  30. }else{if(typeof d==="object"||!d){return a.init.apply(this,arguments)
  31. }else{c.error("Method "+d+" does not exist on jQuery.toastmessage")
  32. }}}
  33. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement