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: 34c97ae196190451666d663763ebc87435412547 (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
/**
 * Adds line breaks and links to feature details boxes
 */

const TIER_LINK =
  'https://about.gitlab.com/pricing/?glm_source=docs.gitlab.com&glm_content=badges-docs';
const STATUS_LINK = 'https://docs.gitlab.com/ee/policy/experiment-beta-support.html';

document.addEventListener('DOMContentLoaded', () => {
  document.querySelectorAll('.alert-details').forEach((el) => {
    el.querySelectorAll('.alert-details .alert-body strong').forEach((label, index) => {
      // Add a line break before labels after the first one
      if (index > 0) {
        label.insertAdjacentHTML('beforebegin', '<br>');
      }

      // Wrap labels in links
      if (label.textContent.trim() === 'Tier:') {
        label.innerHTML = `<a href="${TIER_LINK}">Tier:</a>`; // eslint-disable-line no-param-reassign
      }
      if (label.textContent.trim() === 'Status:') {
        label.innerHTML = `<a href="${STATUS_LINK}">Status:</a>`; // eslint-disable-line no-param-reassign
      }
    });
  });
});