We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Verified Commit 65a0b8af authored by Camil Staps's avatar Camil Staps 🚀

Collapsable enhancements

parent d08d0aa5
Pipeline #14657 failed with stage
in 55 seconds
......@@ -40,7 +40,6 @@ function highlightCallback(span, cls, str) {
};
if (typeof abbrs[cls] != 'undefined') {
console.log(abbrs[cls]);
if (document.getElementById(abbrs[cls] + '-' + str) != null) {
return '<a class="hidden" href="#' + abbrs[cls] + '-' + str + '">' + span + '</a>';
} else {
......@@ -64,10 +63,18 @@ function highlightCallback(span, cls, str) {
let collapsables = document.getElementsByClassName('collapsable');
for (let i = 0; i < collapsables.length; i++) {
let elem = collapsables[i];
elem.collapsableOpen = function() {
this.classList.add('uncollapsed');
}
let head = elem.querySelector('.collapsable-head');
head.onclick = function () {
elem.classList.toggle('uncollapsed');
};
let link = head.querySelector('.collapsable-link');
if (link != null)
link.onclick = function (e) { e.stopPropagation(); };
}
/* Open collapsable of hashtag in url */
......@@ -76,8 +83,7 @@ function highlightCallback(span, cls, str) {
let id = window.location.hash.substring(1);
let elem = document.getElementById(id);
if (elem.classList.contains('collapsable')) {
let head = elem.querySelector('.collapsable-head');
head.onclick();
elem.collapsableOpen();
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment