[SPIP] v3.2.12 -> v3.2.12 - Reinstallation avec le spip_loader
[lhc/web/www.git] / www / plugins-dist / porte_plume / javascript / porte_plume_forcer_hauteur.js
1 function barre_forcer_hauteur () {
2 jQuery(".markItUpEditor", this == window ? null : this).each(function() {
3 var hauteur_min = jQuery(this).height();
4 var hauteur_max = parseInt(jQuery(window).height()) - 200;
5 var hauteur = hauteur_min;
6
7 var signes = jQuery(this).val().length;
8 if (signes){
9 /* en gros: 400 signes donnent 100 pixels de haut */
10 var hauteur_signes = Math.round(signes / 4) + 50;
11 if (hauteur_signes > hauteur_min && hauteur_signes < hauteur_max) {
12 hauteur = hauteur_signes;
13 } else {
14 if (hauteur_signes > hauteur_max) {
15 hauteur = hauteur_max;
16 }
17 }
18
19 jQuery(this).height(hauteur);
20 }
21 });
22 }
23
24 jQuery(window).on("load", function() {
25 barre_forcer_hauteur();
26 onAjaxLoad(barre_forcer_hauteur);
27 });