<script>
(function (window, document, $, undefined) {
$(function () {
$('#{{ _htmlId }}').on('click', '.meta-event-attachment-link', function (e) {
var $target = $(e.currentTarget);
var p = $.ajax({
url: $target.attr('data-ajax'),
});
p.done(function (resp) {
$(resp)
.appendTo($('body'))
.modal({
show: false
})
.on('show.bs.modal', function () {
$(this).css('display', 'block');
var $d = $(this).find('.modal-dialog'),
o = ($(window).height() - $d.height()) / 2,
bm = parseInt($d.css('marginBottom'), 10);
o = Math.max(o, bm);
$d.css('margin-top', o);
})
.on('hidden.bs.modal', function () {
$(this).remove();
})
.modal('show');
});
e.preventDefault();
});
});
})(window, document, jQuery);
</script>