User:Hexasoft/vector.js

From Wikipedia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/**
 * Ajout d'un sous-titre
 *
 * Fonction utilisée par [[Modèle:Sous-titre]]
 *
 * La fonction cherche un élément de la forme
 * <span id="sous_titre_h1">Sous-titre</span>
 *
 * Doit être exécutée après les fonctions d'icônes de titre
 */
 
function sousTitreH1() {
  var span= document.getElementById('sous_titre_h1');
  var title=document.getElementById('firstHeading');
  if(!title) title = document.getElementsByTagName('h1')[0]; // Nostalgia, Standard
  if (span && title) {
      var subtitle=span.cloneNode(true);
      title.appendChild(document.createTextNode(' '));
      title.appendChild(subtitle);
      span.parentNode.removeChild(span);
  }
}
$(sousTitreH1);