', {
class: 'badge-display badge-' + badgeClass,
text: badge,
});
};
var template = function(title, badges) {
let container = $('
', {
class: 'badges-drop',
'data-toggle': 'tooltip',
'data-placement': 'top',
'target': '_blank',
title: title,
href: 'https://about.gitlab.com/pricing/?glm_source=docs.gitlab.com&glm_content=badges-docs'
});
if (isContributorDocs()) {
container.attr({href: "https://docs.gitlab.com/ee/development/"})
}
container.append($('').append(badges));
return container;
};
var tags = [];
if (small) {
tags.push(smallBadgeTag(BADGES_MAPPING[badgeType].join(' | ')));
} else {
$.each(BADGES_MAPPING[badgeType], function(i, badge) {
tags.push(largeBadgeTag(badge, BADGES_CLASS[badge]));
});
}
$badge.append($(template(BADGES_TITLES[badgeType], tags)));
}
// Get the badge type from a specific list of expected values in element class
function retrieveBadgeType($badge) {
const classType = $badge.attr('class').split(' ');
const match = classes.filter(matchingClass => classType.includes(matchingClass));
if (match) {
return match.pop();
}
}
// When badge is not in a HTML header, we use the small version
function isSmall($badge) {
return !$badge
.parent()
.prop('tagName')
.match(/H1|H2|H3|H4|H5/);
}
$(function() {
init();
});
})();