Welcome to mirror list, hosted at ThFree Co, Russian Federation.

feature_details.js « default « frontend « content - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 86a4b193751272d598c74e08883a08048a441f35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * Formats the feature details box
 */

document.addEventListener('DOMContentLoaded', () => {
  document.querySelectorAll('.admonition-wrapper.details').forEach((el) => {
    // Add a line break before availability labels
    el.querySelectorAll('strong').forEach((label, index) => {
      if (index > 0) {
        label.insertAdjacentHTML('beforebegin', '<br>');
      }
    });

    // Add a bottom margin if an accompanying "Version history" section is not present
    if (!el.nextElementSibling.classList.contains('introduced-in')) {
      el.classList.add('gl-mb-5');
    }
  });

  // Bold the "Version history" label if it's adjacent to a feature details box
  document.querySelectorAll('.introduced-in').forEach((el) => {
    if (el.previousElementSibling.classList.contains('details')) {
      el.querySelector('.version-label').classList.add('gl-font-weight-bold');
    }
  });
});