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

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

来自Rizline中文维基
第127行: 第127行:


     function loadSongColors(song) {
     function loadSongColors(song) {
         console.log('正在获取曲目颜色:', song.title)
         console.log('正在获取曲目颜色和图片:', song.title);


        // 获取曲目页面颜色
         fetch(`https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`)
         fetch(`https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`)
             .then(response => {
             .then(response => {
第141行: 第140行:
                 const doc = parser.parseFromString(html, 'text/html')
                 const doc = parser.parseFromString(html, 'text/html')


                // 直接获取内联样式,不通过计算样式
                 const titleElem = doc.querySelector('.infobox-title th')
                 const titleElem = doc.querySelector('.infobox-title')
                 const headerElem = doc.querySelector('.infobox-header th')
                 const headerElem = doc.querySelector('.infobox-header')
                 const labelElem = doc.querySelector('.infobox-label')
                 const labelElem = doc.querySelector('.infobox-label')


                 const titleStyle = titleElem ? titleElem.style.backgroundColor : null
                 const titleStyle = titleElem ? titleElem.style.background : null
                 const headerStyle = headerElem ? headerElem.style.backgroundColor : null
                 const headerStyle = headerElem ? headerElem.style.background : null
                 const labelStyle = labelElem ? labelElem.style.backgroundColor : null
                 const labelStyle = labelElem ? labelElem.style.background : null


                 console.log('获取到的颜色:', { titleStyle, headerStyle, labelStyle })
                 console.log('获取到的颜色:', { titleStyle, headerStyle, labelStyle })
                const imgElem = doc.querySelector('.infobox img')
                let imageUrl = null
                if (imgElem) {
                    imageUrl = imgElem.src || imgElem.getAttribute('data-src')
                    if (imageUrl && imageUrl.startsWith('/')) {
                        imageUrl = 'https://rizwiki.cn' + imageUrl
                    }
                }


                 updateSongInfo(song, {
                 updateSongInfo(song, {
                     titleStyle: titleStyle || '#94E1FF',
                     titleStyle: titleStyle || '#94E1FF',
                     headerStyle: headerStyle || '#A3E5FF',
                     headerStyle: headerStyle || '#A3E5FF',
                     labelStyle: labelStyle || '#B2E9FE'
                     labelStyle: labelStyle || '#B2E9FE',
                    imageUrl: imageUrl,
                    pageUrl: `https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`
                 })
                 })
             })
             })
第163行: 第172行:
                     titleStyle: '#94E1FF',
                     titleStyle: '#94E1FF',
                     headerStyle: '#A3E5FF',
                     headerStyle: '#A3E5FF',
                     labelStyle: '#B2E9FE'
                     labelStyle: '#B2E9FE',
                    imageUrl: null,
                    pageUrl: `https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`
                 })
                 })
             })
             })
第190行: 第201行:
     }
     }


     function updateSongInfo(song, styles) {
     function updateSongInfo(song, data) {
         const titleElement = document.querySelector('.infobox-title th')
         const titleElement = document.querySelector('.infobox-title th')
         titleElement.textContent = song.title
         titleElement.textContent = song.title
         titleElement.style.background = styles.titleStyle
         titleElement.style.background = data.titleStyle
 
        const imageContainer = document.querySelector('.infobox td[colspan="2"]')
        let imageElement = document.getElementById('song-image')


         const imageElement = document.getElementById('song-image')
         if (!imageElement || data.imageUrl) {
        if (song.image) {
            imageContainer.innerHTML = ''
             let imageUrl = song.image
 
             if (imageUrl.startsWith('//')) {
            const imageLink = document.createElement('a')
                 imageUrl = 'https:' + imageUrl
            imageLink.href = data.pageUrl
             } else if (imageUrl.startsWith('/')) {
            imageLink.target = '_blank'
                 imageUrl = 'https://rizwiki.cn' + imageUrl
 
            imageElement = document.createElement('img')
            imageElement.id = 'song-image'
            imageElement.width = 200
             imageElement.height = 200
 
             if (data.imageUrl) {
                console.log('设置图片URL:', data.imageUrl)
                 imageElement.src = data.imageUrl
             } else {
                console.log('未找到图片,使用默认图片')
                 imageElement.src = '/images/thumb/4/41/%E6%8F%92%E7%94%BB%E5%9B%BE%E6%A0%87.png/200px-%E6%8F%92%E7%94%BB%E5%9B%BE%E6%A0%87.png'
             }
             }
             console.log('设置图片URL:', imageUrl)
 
             imageElement.src = imageUrl
             imageLink.appendChild(imageElement)
        } else {
             imageContainer.appendChild(imageLink)
            console.log('未找到图片,使用默认图片')
         }
         }


         document.querySelector('.infobox-header th').style.background = styles.headerStyle
         document.querySelector('.infobox-header th').style.background = data.headerStyle
         const labelElements = document.querySelectorAll('.infobox-label')
         const labelElements = document.querySelectorAll('.infobox-label')
         labelElements.forEach(label => {
         labelElements.forEach(label => {
             label.style.background = styles.labelStyle
             label.style.background = data.labelStyle
         })
         })


        // 创建难度数组
         window.difficultyArray = [
         window.difficultyArray = [
             createDiffSpan("EZ", song.ez),
             createDiffSpan("EZ", song.ez),

2025年10月19日 (日) 17:43的版本

曲目
限制
难度 a
流速 b
MOD c
其他 d

神秘的随机挑战!


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