Guest User

Untitled

a guest
Jul 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. /*
  2. * jalert jQuery JavaScript Plugin v0.0.1
  3. *
  4. * Copyright 2010, Eric Christensen
  5. *
  6. * Permission to use, copy, modify, and distribute this software and its
  7. * documentation for any purpose and without fee is hereby granted, provided
  8. * that the above copyright notice appear in all copies and that both that
  9. * copyright notice and this permission notice appear in supporting
  10. * documentation, and that the name of the copyright holder not be used in
  11. * advertising or publicity pertaining to distribution of the software
  12. * without specific, written prior permission. The copyright holder makes
  13. * no representations about the suitability of this software for any
  14. * purpose. It is provided "as is" without express or implied
  15. * warranty.
  16. *
  17. * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  18. * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  19. * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
  20. * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  21. * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  22. * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  23. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  24. *
  25. * Date: Mon Dec 20 2010 12:28:18 GMT-0700
  26. *
  27. */
  28.  
  29. (function($) {
  30.  
  31.  
  32. $.jalert = function(the_text, the_title, butts, close_butt) {
  33.  
  34. function Buttons(obj) {
  35. for(var key in obj) {
  36. this[key] = obj[key];
  37. }
  38. }
  39.  
  40. var new_butts = undefined;
  41. if (butts) {
  42. new_butts = new Buttons(butts);
  43. if (close_butt) {
  44. new_butts[close_butt] = function() {$(this).remove()};
  45. }
  46. }
  47. var time = (new Date()).getTime() + "";
  48. var id = "_jalert" + time;
  49. var sel = "#" + id;
  50. $("body").append("<div id=\"" + id + "\" style=\"font-size: 80%\"></div>");
  51. $(sel).dialog( {
  52. bgiframe: true,
  53. modal: true,
  54. width: 350,
  55. height: 250 });
  56. $(sel).text(the_text);
  57. $(sel).dialog("option", "title", the_title || "Notification");
  58. $(sel).dialog("option", "buttons", new_butts || { "Ok": function() { $(this).remove(); }});
  59. }
  60.  
  61. })(jQuery);
Add Comment
Please, Sign In to add comment