diff options
Diffstat (limited to 'layouts/partials/head/scripts.html')
-rw-r--r-- | layouts/partials/head/scripts.html | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html index 19e2ec0..ec2514f 100644 --- a/layouts/partials/head/scripts.html +++ b/layouts/partials/head/scripts.html @@ -105,6 +105,74 @@ // ============================================================ + // ======================== markdown table ==================== + var tables = document.querySelectorAll('.single__contents > table'); + for (let i = 0; i < tables.length; i++) { + var table = tables[i]; + var wrapper = document.createElement('div'); + wrapper.className = 'table-wrapper'; + table.parentElement.replaceChild(wrapper, table); + wrapper.appendChild(table); + } + // ============================================================ + + + // ========================== foot notes ====================== + var footNoteRefs = document.querySelectorAll('.footnote-ref'); + var footNoteBackRefs = document.querySelectorAll('.footnote-backref'); + + footNoteRefs ? + footNoteRefs.forEach(function(elem, idx) { + elem.onmouseenter = function () { + if (navbar.classList.contains('scrolling')) { + navbar.classList.remove('scrolling'); + } + } + + elem.onmouseleave = function () { + if (!navbar.classList.contains('scrolling')) { + setTimeout(function () { + navbar.classList.add('scrolling'); + }, 100); + } + } + + elem.onclick = function () { + if (!navbar.classList.contains('scrolling')) { + navbar.classList.remove('navbar--show'); + navbar.classList.remove('navbar--hide'); + navbar.classList.add('navbar--hide'); + } + } + }) : null; + + footNoteBackRefs ? + footNoteBackRefs.forEach(function(elem, idx) { + elem.onmouseenter = function () { + if (navbar.classList.contains('scrolling')) { + navbar.classList.remove('scrolling'); + } + } + + elem.onmouseleave = function () { + if (!navbar.classList.contains('scrolling')) { + setTimeout(function() { + navbar.classList.add('scrolling'); + }, 100); + } + } + + elem.onclick = function () { + if (!navbar.classList.contains('scrolling')) { + navbar.classList.remove('navbar--show'); + navbar.classList.remove('navbar--hide'); + navbar.classList.add('navbar--hide'); + } + } + }) : null; + // ============================================================ + + // =================== search-result desktop ================== var summaryContainer = document.querySelector('.summary__container'); var searchResult = document.querySelector('.search-result'); |