[SPIP] +2.1.12
[velocampus/web/www.git] / www / extensions / porte_plume / javascript / porte_plume_forcer_hauteur.js
1 function barre_forcer_hauteur () {
2 jQuery(".markItUpEditor").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 jQuery(this).height(hauteur);
18 }
19 });
20 }
21
22 jQuery(window).bind("load", function() {
23 barre_forcer_hauteur();
24 });