modal.js 699 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * @name modal.js
  3. * @author Philipp Maurer
  4. * @author Tobias Reich
  5. * @copyright 2013 by Philipp Maurer, Tobias Reich
  6. *
  7. * Modal Module
  8. * Build, show and hide a modal.
  9. */
  10. modal = {
  11. fns: null,
  12. show: function(title, text, buttons) {
  13. if (!buttons) {
  14. var buttons = [];
  15. buttons[0] = ["", function() {}];
  16. buttons[1] = ["", function() {}];
  17. }
  18. modal.fns = [buttons[0][1], buttons[1][1]];
  19. $("body").append(build.modal(title, text, buttons));
  20. $(".message input").focus();
  21. },
  22. close: function() {
  23. modal.fns = null;
  24. $(".message_overlay").removeClass("fadeIn").css("opacity", 0);
  25. setTimeout(function() { $(".message_overlay").remove() }, 300);
  26. }
  27. }