2014-01-22 10:12:51 +00:00
|
|
|
/**
|
|
|
|
* @name Modal Module
|
|
|
|
* @description Build, show and hide a modal.
|
|
|
|
* @author Tobias Reich
|
|
|
|
* @copyright 2014 by Tobias Reich
|
|
|
|
*/
|
|
|
|
|
|
|
|
modal = {
|
|
|
|
|
|
|
|
fns: null,
|
|
|
|
|
|
|
|
show: function(title, text, buttons, marginTop, closeButton) {
|
|
|
|
|
|
|
|
if (!buttons) {
|
2014-02-25 22:37:05 +00:00
|
|
|
buttons = [
|
2014-01-22 10:12:51 +00:00
|
|
|
["", function() {}],
|
|
|
|
["", function() {}]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
modal.fns = [buttons[0][1], buttons[1][1]];
|
|
|
|
$("body").append(build.modal(title, text, buttons, marginTop, closeButton));
|
2014-02-08 21:11:01 +00:00
|
|
|
$(".message input:first-child").focus().select();
|
2014-01-22 10:12:51 +00:00
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
close: function() {
|
|
|
|
|
|
|
|
modal.fns = null;
|
|
|
|
$(".message_overlay").removeClass("fadeIn").css("opacity", 0);
|
|
|
|
setTimeout(function() { $(".message_overlay").remove() }, 300);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-02-25 22:37:05 +00:00
|
|
|
};
|