Mint: A Fresh Look at your Site Minted
  1. 1 (function($) {
  2. 2 $.extend({
  3. 3 toast: function(obj) {
  4. 4 if ($("#daftplugPublicToastMessage").length) {
  5. 5 return
  6. 6 }
  7. 7 var title = obj.title;
  8. 8 var showTime = obj.duration || 2000;
  9. 9 var width = obj.width || "auto";
  10. 10 var height = obj.height || "20px";
  11. 11 var position = obj.position || '';
  12. 12 var backgroundColor = obj.backgroundColor || 'rgba(0, 0, 0, .7)';
  13. 13 var textColor = obj.textColor || '#fff';
  14. 14 var flag = obj.flag || !0;
  15. 15 var lineheight = obj.lineheight || height;
  16. 16 if (position == 'bottom') {
  17. 17 position = "bottom: 50px;"
  18. 18 } else if (position == 'middle') {
  19. 19 position = "top: calc(45% - 15px);"
  20. 20 } else if (position == 'top') {
  21. 21 position = "top: 0px;"
  22. 22 } else if (position === '') {
  23. 23 position = "top: 80%;"
  24. 24 } else {}
  25. 25 if (flag) {
  26. 26 var content = "<div id='daftplugPublicToastMessage' style='position: fixed;display: none; z-index:999;font-size: 18px; " + position + ";left: 0;width:100%; height: " + height + "; text-align: center'>"
  27. 27 } else {
  28. 28 var content = "<div id='daftplugPublicToastMessage' style='position: fixed; display: none;z-index:999; top: 0; left: 0;width:100%; height:100%; text-align: center'>"
  29. 29 }
  30. 30 content += '<div id="toast-content" style="display: inline-block; width: ' + width + ';min-height: ' + height + ';padding: 8px 14px;background-color: ' + backgroundColor + ';text-align: center;line-height: ' + lineheight + ';border-radius: 15px;color: ' + textColor + ';">' + title + '</div>';
  31. 31 content += '</div>';
  32. 32 $("body").append(content);
  33. 33 $("#daftplugPublicToastMessage").fadeIn(200);
  34. 34 setTimeout(function() {
  35. 35 $("#daftplugPublicToastMessage").fadeOut(200)
  36. 36 }, showTime);
  37. 37 setTimeout(function() {
  38. 38 $("#daftplugPublicToastMessage").remove()
  39. 39 }, showTime + 300)
  40. 40 }
  41. 41 })
  42. 42 })(jQuery)
Bookmark: javascript:location='http://shauninman.com/vs/?url='+escape(location)