{% extends 'base.html.twig' %}

{% block localstyle %}
    #page-wrapper {padding:0px;}
{% endblock %}

{% block pagewrapper %}
    {% set theme = app.session.get('theme') %}
    {% if theme is not empty %}
        {{ include('@Theme/'~theme~'/function.html.twig') }}
    {% endif %}
    {% set color = app.session.get('color') %}

    <div id="pageiframe">
        <iframe src="{{url|replace({'#color#':color['main']}) }}" id="frameContent" style="border:none;" width="100%" height="100%"></iframe>
    </div>
{% endblock %}

{% block localjavascript %}
    $(window).resize(function() {
        resizeFrame();
    });

    $('document').ready(function(){
        resizeFrame();
    });

    function resizeFrame() {
        console.log("pouet");
        $("body").css("overflow-y","hidden");
        $(".col-md-10").css("padding","0");

        var iFrame = document.getElementById('frameContent');

        var heightbody = $('html').height();
        var heightheader = $('.header').height();
        if($('.pagemenu').css("display")=="none")
            var heightmenu  = 0;
        else
            var heightmenu  = $('.pagemenu').height();
        

        var heightframe = heightbody-(heightheader?heightheader:0)-(heightmenu?heightmenu:0);
        
        if($("#frameContent").length>0) {
            $("#frameContent").height(heightframe);
        }
    }
{% endblock %}