lychee/assets/js/modal.js

35 lines
689 B
JavaScript
Raw Normal View History

/**
* @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 = [
["", 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();
},
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
};