用户:RedDragon/Test2:修订间差异
来自Rizline中文维基
更多操作
小 |
小 |
||
| 第36行: | 第36行: | ||
<script> | <script> | ||
document.addEventListener('DOMContentLoaded', () => { | document.addEventListener('DOMContentLoaded', () => { | ||
fetch('https://rizwiki.cn/api.php?action=query&titles= | fetch('https://rizwiki.cn/api.php?action=query&titles=曲目列表&prop=revisions&rvprop=content&format=json') | ||
.then(r => r.text()) | |||
.then(text => { | |||
if (text.trim().startsWith('{')) { | |||
return JSON.parse(text) | |||
} else { | |||
const match = text.match(/{.*}/s) | |||
if (match) { | |||
return JSON.parse(match[0]) | |||
} else { | |||
throw new Error('无法解析API响应') | |||
} | |||
} | |||
}) | |||
.then(data => { | .then(data => { | ||
if (data.error) { | |||
throw new Error(data.error.info || 'API错误') | |||
} | |||
const pages = data.query.pages | const pages = data.query.pages | ||
const pageId = Object.keys(pages)[0] | const pageId = Object.keys(pages)[0] | ||
| 第88行: | 第95行: | ||
function loadSongColors(song) { | function loadSongColors(song) { | ||
fetch(`https://rizwiki.cn/api.php?action=query&titles=${encodeURIComponent(song.title)}&prop=revisions&rvprop=content&format=json`) | fetch(`https://rizwiki.cn/api.php?action=query&titles=${encodeURIComponent(song.title)}&prop=revisions&rvprop=content&format=json`) | ||
.then(r => r. | .then(r => r.text()) | ||
.then(data = | .then(text => { | ||
let data | |||
if (text.trim().startsWith('{')) { | |||
data = JSON.parse(text) | |||
} else { | |||
const match = text.match(/{.*}/s) | |||
data = match ? JSON.parse(match[0]) : {} | |||
} | |||
if (data.error) throw new Error(data.error.info || 'API错误') | |||
const pages = data.query.pages | const pages = data.query.pages | ||
const pageId = Object.keys(pages)[0] | const pageId = Object.keys(pages)[0] | ||
2025年10月19日 (日) 22:07的版本
| 曲目 | |
|---|---|
|
|
|
| 限制 | |
| 难度 | a |
| 流速 | b |
| MOD | c |
| 其他 | d |
神秘的随机挑战!
| 曲目 | |
|---|---|
|
| |
| 限制 | |
| 难度 | a |
| 流速 | b |
| MOD | c |
| 其他 | d |
User:RedDragon/Test User:RedDragon/Test1 User:RedDragon/Test2