打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

用户:RedDragon/Test1:修订间差异

来自Rizline中文维基
第139行: 第139行:
<script>
<script>
     document.addEventListener('DOMContentLoaded', addColorBorders)
     document.addEventListener('DOMContentLoaded', addColorBorders)
   
 
     const hexColorRegex = /#([A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})\b/g
     const hexColorRegex = /#([A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})\b/g


第150行: 第150行:
         )
         )


         const textNodes = []
         const nodesToProcess = []
         let node
         let node
         while (node = walker.nextNode()) {
         while (node = walker.nextNode()) {
             textNodes.push(node)
             if (node.parentNode.nodeName === 'SCRIPT' || node.parentNode.nodeName === 'STYLE') continue
 
            const testRegex = new RegExp(hexColorRegex.source, 'g')
            if (testRegex.test(node.textContent)) {
                nodesToProcess.push(node)
            }
         }
         }


         textNodes.forEach(textNode => {
         nodesToProcess.forEach(textNode => {
             const parent = textNode.parentNode
             const parent = textNode.parentNode
            if (parent.nodeName === 'SCRIPT' || parent.nodeName === 'STYLE') {
                return
            }
             const text = textNode.textContent
             const text = textNode.textContent
             const matches = [...text.matchAll(hexColorRegex)]
             const matches = [...text.matchAll(hexColorRegex)]


             if (matches.length > 0) {
             const fragment = document.createDocumentFragment()
                const fragment = document.createDocumentFragment()
            let lastIndex = 0
                let lastIndex = 0
 
            matches.forEach(match => {
                const [hexColor, index] = [match[0], match.index]


                 matches.forEach(match => {
                 if (index > lastIndex) {
                     const matchIndex = match.index
                     fragment.appendChild(document.createTextNode(text.substring(lastIndex, index)))
                    const hexColor = match[0]
                }


                    if (matchIndex > lastIndex) {
                const colorSpan = document.createElement('span')
                        fragment.appendChild(
                Object.assign(colorSpan.style, {
                            document.createTextNode(text.substring(lastIndex, matchIndex))
                    display: 'inline-block',
                        )
                    padding: '0',
                    }
                    margin: '0',
                    border: '4px solid',
                    borderRadius: '0',
                    fontWeight: 'bold',
                    background: 'transparent',
                    lineHeight: '1',
                    verticalAlign: 'baseline',
                    boxSizing: 'border-box',
                    width: 'fit-content',
                    letterSpacing: '0'
                })
                colorSpan.textContent = hexColor
                colorSpan.style.borderColor = hexColor
 
                fragment.appendChild(colorSpan)
                lastIndex = index + hexColor.length
            })


                    const colorSpan = document.createElement('span')
            if (lastIndex < text.length) {
                    colorSpan.style.display = 'inline-block'
                fragment.appendChild(document.createTextNode(text.substring(lastIndex)))
                    colorSpan.style.padding = '0'
            }
                    colorSpan.style.margin = '0'
                    colorSpan.style.border = '4px solid'
                    colorSpan.style.borderRadius = '0'
                    colorSpan.style.fontWeight = 'bold'
                    colorSpan.style.background = 'transparent'
                    colorSpan.style.lineHeight = '1'
                    colorSpan.style.verticalAlign = 'baseline'
                    colorSpan.style.boxSizing = 'border-box'
                    colorSpan.style.minWidth = 'fit-content'
                    colorSpan.textContent = hexColor
                    colorSpan.style.borderColor = hexColor


                    fragment.appendChild(colorSpan)
            parent.replaceChild(fragment, textNode)
                    lastIndex = matchIndex + hexColor.length
                })


                 if (lastIndex < text.length) {
            let tdParent = parent
                     fragment.appendChild(
            while (tdParent) {
                         document.createTextNode(text.substring(lastIndex))
                 if (tdParent.nodeType === Node.ELEMENT_NODE) {
                     )
                     if (tdParent.tagName === 'TD') {
                         if (new RegExp(hexColorRegex.source, 'g').test(tdParent.textContent)) {
                            tdParent.style.padding = '0'
                            break
                        }
                     }
                 }
                 }
 
                 tdParent = tdParent.parentNode
                 parent.replaceChild(fragment, textNode)
             }
             }
         })
         })

2025年10月28日 (二) 20:02的版本

加入社区

avataravataravataravatar
avataravataravataravatar
avatar

Rizline Original[1]
详细信息
Riztime时间 112.29s-142.29s
主题颜色
常规主题 #D2CDDDFF
#A2BFD8FF
#A29BCDFF
Riztime主题1 #ADB9D4FF
#9F84B7FF
#6574ABFF
谱面信息
Tap/Drag/Hold
EZ 4 70/43/43
HD 6 203/164/48
IN 12 393/233/84
线条数
EZ 4 197
HD 6 222
IN 12 1020


User:RedDragon/Test User:RedDragon/Test1 User:RedDragon/Test2