aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/templates/wiki/includes/modals.html
blob: b86d4f65333a91cafee97bfcb5149be982c1bc20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{% 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 %}