Source de js/font_utils.js

minSz=50
maxSz=200
defSz=90
curSz=defSz
zI=20
function setActiveButtons(currentSize)
{
 setAFormButtons(currentSize,"")
 setAFormButtons(currentSize,"2")
}
function setAFormButtons(currentSize,idp)
{
 tmpFontSizeDown=getE("font-size-down"+idp)
 if(!tmpFontSizeDown) return
 tmpFontSizeUp=getE("font-size-up"+idp)
 if((currentSize-zI)<minSz) {
  tmpFontSizeDown.disabled="disabled"
  tmpFontSizeDown.className="disabled-button"
 } else {
  tmpFontSizeDown.disabled=null
  tmpFontSizeDown.className="submit-button"
 }
 if((currentSize+zI)>maxSz) {
  tmpFontSizeUp.disabled="disabled"
  tmpFontSizeUp.className="disabled-button"
 } else {
  tmpFontSizeUp.disabled=null
  tmpFontSizeUp.className="submit-button"
 }
}
function setFontSize(value)
{
 curSz=value
 document.body.style.fontSize=value+"%"
 if(!document.all) {
  e=getT(document,'body')
  e.parentNode.replaceChild(e,e)
 }
}
function textZoom(factor,id,idp)
{
 if(!factor) {
  newSz=defSz
  tBF=getE("font-size-default"+idp)
 } else {
  if(factor>0) tBF=getE("font-size-up"+idp)
  else tBF=getE("font-size-down"+idp)
  zoomDelta=factor*zI
  newSz=curSz+zoomDelta
 }
 if((newSz>=minSz) && (newSz<=maxSz)) {
  setFontSize(newSz)
  setActiveButtons(newSz)
  setCookie("fontSize",newSz)
  scrollTo(0,getTopOffset(getE(id)))
  tBF.focus()
 }
 return false
}
function textZoomKb(kbEvent,factor,id,idp)
{
 if(isVK(kbEvent,false)) return textZoom(factor,id,idp)
 else return true
}
function initZoom()
{
 userFontSize=getCookie("fontSize")
 if(userFontSize && (userFontSize!="")) {
  curSz=new Number(userFontSize)
  if((curSz>=minSz) && (curSz<=maxSz)) {
   setActiveButtons(curSz)
  }
 }
 fsc=getE("font-size-controls")
 if(fsc) fsc.style.display="block"
}
function writeFontSizeControls(tab1,tab2,tab3,idp,id)
{
 if(!hasDOM) return
 if(idp=="") prn('<div id="font-size-controls"><label>Taille du texte</label>')
 else prn('<fieldset><legend>Taille du texte<br /></legend>')
 prn('<input value="-" type="button" id="font-size-down'+idp+'" class="submit-button" onclick="return textZoom(-1,\''+id+'\',\''+idp+'\')" onkeypress="return textZoomKb(event,-1,\''+id+'\',\''+idp+'\')" tabindex="'+tab1+'" title="Diminuer la taille du texte" />')
 prn('<input value="Défaut" type="button" id="font-size-default'+idp+'" class="submit-button" onclick="return textZoom(0,\''+id+'\',\''+idp+'\')" onkeypress="return textZoomKb(event,\''+id+'\',\''+idp+'\')" tabindex="'+tab2+'" title="Rétablir la taille par défaut" />')
 prn('<input value="+" type="button" id="font-size-up'+idp+'" class="submit-button" onclick="return textZoom(+1,\''+id+'\',\''+idp+'\')" onkeypress="return textZoomKb(event,+1,\''+id+'\',\''+idp+'\')" tabindex="'+tab3+'" title="Augmenter la taille du texte" />')
 if(idp=="") prn('</div>')
 else prn('</fieldset>')
}