LiteyukiBot-TriM/docs/.vuepress/public/js/style.js

22 lines
929 B
JavaScript
Raw Normal View History

2024-06-26 13:52:04 +08:00
function applyStyle() {
let lineNumbers = document.body.querySelectorAll('[class^="language-"].line-numbers-mode')
lineNumbers.forEach((item) => {
// 插入现成的html文本
let title = item.getAttribute('data-title')
let tabStr =
2024-07-19 02:04:47 +08:00
"<div class='tab' style='display: flex; background-color: #32383D'>" +
2024-06-26 13:52:04 +08:00
" <div class='tab-buttons'>" +
" <div class='tab-button' style='background-color: #FF5F57'></div>" +
" <div class='tab-button' style='background-color: #FFBD2E'></div>" +
" <div class='tab-button' style='background-color: #27C93F'></div>" +
" </div>" +
` <div class='tab-title'>${title}</div>` +
" <div style='flex: 1'></div>" +
"</div>"
// 在代码块前插入选项卡
item.insertAdjacentHTML('beforebegin', tabStr);
})
}
applyStyle()