Browse Source

Deplacer forcer_hauteur dans un fichier séparé, appelé uniquement dans l'espace privé.

2.1
arno@rezo.net 13 years ago
parent
commit
e598710cd7
  1. 1
      .gitattributes
  2. 24
      javascript/porte_plume_forcer_hauteur.js
  3. 6
      porte_plume_pipelines.php
  4. 24
      porte_plume_start.js.html

1
.gitattributes vendored

@ -45,6 +45,7 @@ inc/barre_outils.php -text
javascript/jquery.markitup.js -text
javascript/jquery.markitup_pour_spip.js -text
javascript/jquery.previsu_spip.js -text
javascript/porte_plume_forcer_hauteur.js -text
lang/barre_outils_ar.php -text
lang/barre_outils_en.php -text
lang/barre_outils_es.php -text

24
javascript/porte_plume_forcer_hauteur.js

@ -0,0 +1,24 @@
function barre_forcer_hauteur () {
$(".markItUpEditor").each(function() {
var hauteur_min = $(this).height();
var hauteur_max = parseInt($(window).height()) - 200;
var hauteur = hauteur_min;
var signes = $(this).val().length;
/* en gros: 400 signes donne 100 pixels de haut */
var hauteur_signes = Math.round(signes / 4) + 50;
if (hauteur_signes > hauteur_min && hauteur_signes < hauteur_max) hauteur = hauteur_signes;
else if (hauteur_signes > hauteur_max) hauteur = hauteur_max;
$(this).height(hauteur);
});
}
$(document).ready(function(){
barre_forcer_hauteur();
$(window).bind("resize", function() {
barre_forcer_hauteur();
});
});

6
porte_plume_pipelines.php

@ -22,7 +22,11 @@ function porte_plume_insert_head_public($flux){
}
function porte_plume_insert_head_prive($flux){
$flux = porte_plume_inserer_head($flux, $GLOBALS['spip_lang']);
$js = find_in_path('javascript/porte_plume_forcer_hauteur.js');
$flux = porte_plume_inserer_head($flux, $GLOBALS['spip_lang'])
. "<script type='text/javascript' src='$js'></script>\n";
return $flux;
}

24
porte_plume_start.js.html

@ -27,25 +27,6 @@ $.fn.barre_previsualisation = function(settings) {
.previsu_spip(options);
};
function barre_forcer_hauteur () {
$(".markItUpEditor").each(function() {
var hauteur_min = $(this).height();
var hauteur_max = parseInt($(window).height()) - 200;
var hauteur = hauteur_min;
var signes = $(this).val().length;
/* en gros: 400 signes donne 100 pixels de haut */
var hauteur_signes = Math.round(signes / 4) + 50;
if (hauteur_signes > hauteur_min && hauteur_signes < hauteur_max) hauteur = hauteur_signes;
else if (hauteur_signes > hauteur_max) hauteur = hauteur_max;
$(this).height(hauteur);
});
}
$(document).ready(function(){
// ajoute les barres d'outils markitup
function barrebouilles(){
@ -67,10 +48,5 @@ $(document).ready(function(){
barrebouilles();
onAjaxLoad(barrebouilles);
barre_forcer_hauteur();
$(window).bind("resize", function() {
barre_forcer_hauteur();
});
});
})(jQuery);

Loading…
Cancel
Save