{% extends "base.html.twig" %} {% block metablock %} {% endblock %} {% block localstyle %}

{{user.pseudo}}

{% set qrCode = qr_code_result(absolute_url(path("app_home_user",{userpseudo:user.slug}))) %}
{% endblock %} {% block localjavascript %} var posImg=0 var tbimg=[] function shuffle(array) { let currentIndex = array.length, randomIndex; // While there remain elements to shuffle. while (currentIndex > 0) { // Pick a remaining element. randomIndex = Math.floor(Math.random() * currentIndex); currentIndex--; // And swap it with the current element. [array[currentIndex], array[randomIndex]] = [ array[randomIndex], array[currentIndex]]; } return array; } function resizeImage() { height=$(window).height()-35; $("#content").height($(window).height()-35); $("#illustration_illustration_img").css({height:height,width:'auto'}); width=$(window).width()-90; if($("#illustration_illustration_img").width()>width) $("#illustration_illustration_img").css({width:width,height:'auto'}); height=$("#illustration_illustration_img").height(); } $(document).ready(function() { {% for illustration in illustrations %} tbimg.push("{{illustration.illustration}}"); {% endfor %} tbimg=shuffle(tbimg); total=tbimg.length; console.log(total); $('body').imagesLoaded(function() { resizeImage(); $("#illustration_illustration_img").fadeIn(); }); var intervalId = window.setInterval(function(){ posImg++; if(posImg>=total) posImg=0; img=tbimg[posImg]; console.log(img); url="/{{ appAlias }}/uploads/illustration/xxx"; url=url.replace("xxx",img); $("#illustration_illustration_img").fadeOut(); $("#illustration_illustration_img").promise().done(function(){ $("#illustration_illustration_img").hide(); $("#illustration_illustration_img").attr("src",url); /* resizeImage(); $("#illustration_illustration_img").fadeIn(); */ }); }, 5000); }); $('#illustration_illustration_img').on("load",function() { resizeImage(); $("#illustration_illustration_img").fadeIn(); }); $(window).resize(function() { resizeImage(); }); {% endblock %}