Passer au contenu principal

Lister les nouveautés de GitLab-CE

En construction.png

{
  const version = document.querySelector('h1').textContent;
  const wishesSections = ['top-feature', 'primary-features', 'secondary-features'];
  const availableData = '[data-original-title="Available in GitLab self-managed Free"]'
  const [topFeatures, primaryFeatures, secondaryFeatures] = Array.from(document.querySelectorAll('.content > section')).filter(el => wishesSections.includes(el.id));
  
  const nestedElement = (el, overload, linkEl = 'previousElementSibling') => {
    const paths = overload.split(".");
    let result = el.parentNode.parentNode.parentNode;
    const doc = result.parentNode.lastElementChild.firstElementChild.firstElementChild.href;
    const docLink = doc ? `[_(doc)_](${doc})` : '';
    console.log(result.parentNode.lastElementChild.firstElementChild.firstElementChild.href);
    for (path of paths) {
      result = result[path];
    }
    const link = result[linkEl];
    return [`- [${result.textContent}](${link.href}) ${docLink}`];
  };
  
  const primaryAvailable = Array.from(primaryFeatures.querySelectorAll(availableData)).map(el => nestedElement(el, 'parentNode.parentNode.previousElementSibling.firstElementChild.lastElementChild'));
  
  const secondaryAvailable = Array.from(secondaryFeatures.querySelectorAll(availableData)).map(el => nestedElement(el, 'previousElementSibling.lastElementChild'));
  
  const finalResult = [].concat(version,primaryAvailable,secondaryAvailable).join('\n');
 
  console.log(finalResult)
  alert(finalResult);
  
}

Résultat

GitLab 16.0 Release