在theme/butterfly/source/js/main.js的160行左右的createEle函数中进行修改:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| const createEle = (lang, item) => { const fragment = document.createDocumentFragment() + let isClose = false + if (item.querySelector('figcaption>span')?.textContent.includes('hider')) { + isClose = true + let hider = item.querySelector('figcaption>span') + if (hider) + hider.style.display = 'none' + }
if (isShowTool) { const hlTools = document.createElement('div') - hlTools.className = `highlight-tools ${highlightShrinkClass}` + hlTools.className = `highlight-tools ${isClose?"closed":highlightShrinkClass}` hlTools.innerHTML = highlightMacStyleEle + highlightShrinkEle + lang + highlightCopyEle + highlightFullpageEle btf.addEventListenerPjax(hlTools, 'click', highlightToolsFn) fragment.appendChild(hlTools) }
|