modal.js 692 B

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