用户:RedDragon/Test2:修订间差异
来自Rizline中文维基
更多操作
小 |
小 |
||
| 第129行: | 第129行: | ||
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 => { | ||
| 第140行: | 第141行: | ||
const doc = parser.parseFromString(html, 'text/html') | const doc = parser.parseFromString(html, 'text/html') | ||
// 直接获取内联样式,不通过计算样式 | |||
const titleElem = doc.querySelector('.infobox-title') | const titleElem = doc.querySelector('.infobox-title') | ||
const headerElem = doc.querySelector('.infobox-header') | const headerElem = doc.querySelector('.infobox-header') | ||
const labelElem = doc.querySelector('.infobox-label') | const labelElem = doc.querySelector('.infobox-label') | ||
const titleStyle = titleElem ? | const titleStyle = titleElem ? titleElem.style.backgroundColor : null | ||
const headerStyle = headerElem ? | const headerStyle = headerElem ? headerElem.style.backgroundColor : null | ||
const labelStyle = labelElem ? | const labelStyle = labelElem ? labelElem.style.backgroundColor : null | ||
console.log('获取到的颜色:', { titleStyle, headerStyle, labelStyle }) | console.log('获取到的颜色:', { titleStyle, headerStyle, labelStyle }) | ||
| 第195行: | 第197行: | ||
const imageElement = document.getElementById('song-image') | const imageElement = document.getElementById('song-image') | ||
if (song.image) { | if (song.image) { | ||
imageElement.src = | let imageUrl = song.image | ||
if (imageUrl.startsWith('//')) { | |||
imageUrl = 'https:' + imageUrl | |||
} else if (imageUrl.startsWith('/')) { | |||
imageUrl = 'https://rizwiki.cn' + imageUrl | |||
} | |||
console.log('设置图片URL:', imageUrl) | |||
imageElement.src = imageUrl | |||
} else { | |||
console.log('未找到图片,使用默认图片') | |||
} | } | ||
| 第204行: | 第215行: | ||
}) | }) | ||
// 创建难度数组 | |||
window.difficultyArray = [ | window.difficultyArray = [ | ||
createDiffSpan("EZ", song.ez), | createDiffSpan("EZ", song.ez), | ||