{% load sekizai_tags static %}
{% addtoblock "js" %}
<script type="text/javascript" src="{% static "wiki/js/jquery-ui-1.12.1.custom/jquery-ui.min.js" %}"></script>
<script type="text/javascript">
$(document).ready(function() {
  $(".modal-content").on("resizestart", function(event, ui) {
    $(ui.element).find(".modal-body, iframe").each(function() {
      elem = $(this);
      elem.data("resizeoriginalheight", elem.height());
    });
  });

  $(".modal-content").on("resize", function(event, ui) {
      ui.element.parents('.modal-dialog').css("margin-left", -ui.size.width/2);
      ui.element.parents('.modal-dialog').css("margin-top", -ui.size.height/2);
      ui.element.parents('.modal-dialog').css("top", "50%");
      ui.element.parents('.modal-dialog').css("left", "50%");

      $(ui.element).find(".modal-body,iframe").each(function() {
        elem = $(this);
        $(this).css("min-height", elem.data("resizeoriginalheight") + ui.size.height - ui.originalSize.height);
      });
  });

  $(".modal-content").resizable();
});
</script>
{% endaddtoblock %}
{% addtoblock "css" %}
<link rel="stylesheet" href="{% static "wiki/js/jquery-ui-1.12.1.custom/jquery-ui.min.css" %}" type="text/css" />
{% endaddtoblock %}
