X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fplugins-dist%2Fporte_plume%2Fjavascript%2Fporte_plume_forcer_hauteur.js;h=b5d455bd7dfe5c1214c62324b1a793ce96b3d176;hb=4f443dce95ff6f8221c189880a70c74ce1c1f238;hp=299cc3f1a15cb23dcd5758ccfb8e669339c7d03b;hpb=4a628e9b277d3617535f99d663ca79fa2e891177;p=lhc%2Fweb%2Fwww.git diff --git a/www/plugins-dist/porte_plume/javascript/porte_plume_forcer_hauteur.js b/www/plugins-dist/porte_plume/javascript/porte_plume_forcer_hauteur.js index 299cc3f1..b5d455bd 100644 --- a/www/plugins-dist/porte_plume/javascript/porte_plume_forcer_hauteur.js +++ b/www/plugins-dist/porte_plume/javascript/porte_plume_forcer_hauteur.js @@ -1,24 +1,27 @@ function barre_forcer_hauteur () { - jQuery(".markItUpEditor").each(function() { + jQuery(".markItUpEditor", this == window ? null : this).each(function() { var hauteur_min = jQuery(this).height(); var hauteur_max = parseInt(jQuery(window).height()) - 200; var hauteur = hauteur_min; - + var signes = jQuery(this).val().length; if (signes){ /* en gros: 400 signes donnent 100 pixels de haut */ var hauteur_signes = Math.round(signes / 4) + 50; - if (hauteur_signes > hauteur_min && hauteur_signes < hauteur_max) + if (hauteur_signes > hauteur_min && hauteur_signes < hauteur_max) { hauteur = hauteur_signes; - else - if (hauteur_signes > hauteur_max) + } else { + if (hauteur_signes > hauteur_max) { hauteur = hauteur_max; - + } + } + jQuery(this).height(hauteur); } }); } -jQuery(window).bind("load", function() { +jQuery(window).on("load", function() { barre_forcer_hauteur(); + onAjaxLoad(barre_forcer_hauteur); });