Utilisateur:Delhovlyn/changerTailleTextbox.js

Un article de Wikipédia, l'encyclopédie libre.

Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.

function changertaille(diff) {
  if (document.getElementById("toolbar") == null) return;  // Teste si on est en cours de modification : si oui, OK ; si non, stop.
 
  if(diff != 0) {
  document.getElementById('wpTextbox1').rows = document.getElementById('wpTextbox1').rows + diff;
  } else {
  document.getElementById('wpTextbox1').rows = window.prompt('Nombre de lignes pour la zone d\'édition ?', '10');
  }
}
 
function init_boutonstaille() {
  if (document.getElementById("toolbar") == null) return;  // Teste si on est en cours de modification : si oui, OK ; si non, stop.
  var barredoutils = document.getElementById("toolbar");
  barredoutils.innerHTML = '<div style="display:inline; border:grey solid 1px; padding:2px; background-color:#E9E9E9; border-bottom:none; border-right:none;">&nbsp;'
                           + '<a href="javascript:changertaille(-1);">–</a>&nbsp;&nbsp;&nbsp;<a href="javascript:changertaille(1);">+</a>&nbsp;&nbsp;&nbsp;<a href="javascript:changertaille(0);">?</a>'
                           + ' </div>' + barredoutils.innerHTML;
}
addOnloadHook(init_boutonstaille);