{% load sekizai_tags %}
{% addtoblock "js" %}
<script type="text/javascript" src="{{ STATIC_URL }}wiki/js/jqueryui/jquery-ui-1.10.0.custom.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_URL }}wiki/js/jqueryui/jquery-ui-1.10.0.custom.min.css" type="text/css" />
{% endaddtoblock %}
