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

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

来自Rizline中文维基
第36行: 第36行:
<script>
<script>
     document.addEventListener('DOMContentLoaded', () => {
     document.addEventListener('DOMContentLoaded', () => {
        const CORS_PROXY = 'https://corsproxy.io/?'
         fetch('https://rizwiki.cn/api.php?action=query&titles=曲目列表&prop=revisions&rvprop=content&format=json')
         fetch(CORS_PROXY + encodeURIComponent('https://rizwiki.cn/api.php?action=query&titles=曲目列表&prop=revisions&rvprop=content&format=json'))
             .then(r => r.json())
             .then(r => r.ok ? r.json() : Promise.reject('网络错误'))
             .then(data => {
             .then(data => {
                 const pages = data.query.pages
                 const pages = data.query.pages
第57行: 第56行:
     function parseSongsFromWikitext(wikitext) {
     function parseSongsFromWikitext(wikitext) {
         const songs = []
         const songs = []
         const rowRegex = /\{\|.*?\|\}(.*?)\|\}/gs
         const rowRegex = /\|\[\[文件:(.*?)\]\]\s*\|\|\s*\[\[(.*?)\]\]\s*\|\|\s*(.*?)\s*\|\|\s*(.*?)\s*\|\|\s*(\d+.*?)\s*\|\|\s*(\d+.*?)\s*\|\|\s*(\d+.*?)(?=\s*\||\s*\|-|\s*\})/g
        const lineRegex = /\|\[\[文件:(.*?)\]\]\s*\|\|\s*\[\[(.*?)\]\]\s*\|\|\s*(.*?)\s*\|\|\s*(.*?)\s*\|\|\s*(\d+)\s*\|\|\s*(\d+)\s*\|\|\s*(\d+)/g


         let match
         let match
         while ((match = lineRegex.exec(wikitext)) !== null) {
         while ((match = rowRegex.exec(wikitext)) !== null) {
             const song = {
             const song = {
                 image: match[1],
                 image: match[1],
第71行: 第69行:
                 in: match[7]
                 in: match[7]
             }
             }
             if (song.title) songs.push(song)
             if (song.title && song.title !== '') {
                songs.push(song)
            }
         }
         }
         return songs
         return songs
第77行: 第77行:


     function loadSongColors(song) {
     function loadSongColors(song) {
         fetch(`https://rizwiki.cn/api.php?action=query&titles=${encodeURIComponent(song.title)}&prop=revisions&rvprop=content&format=json&origin=*`)
         fetch(`https://rizwiki.cn/api.php?action=query&titles=${encodeURIComponent(song.title)}&prop=revisions&rvprop=content&format=json`)
             .then(r => r.ok ? r.json() : Promise.reject('页面不存在'))
             .then(r => r.json())
             .then(data => {
             .then(data => {
                 const pages = data.query.pages
                 const pages = data.query.pages
                 const pageId = Object.keys(pages)[0]
                 const pageId = Object.keys(pages)[0]
                if (!pages[pageId].revisions) {
                    throw new Error('页面不存在')
                }
                 const wikitext = pages[pageId].revisions[0]['*']
                 const wikitext = pages[pageId].revisions[0]['*']
                 const styles = parseStylesFromWikitext(wikitext)
                 const styles = parseStylesFromWikitext(wikitext)
                const imageUrl = parseImageFromWikitext(wikitext)


                 updateSongInfo(song, {
                 updateSongInfo(song, {
第90行: 第92行:
                     headerStyle: styles.header || '#A3E5FF',
                     headerStyle: styles.header || '#A3E5FF',
                     labelStyle: styles.label || '#B2E9FE',
                     labelStyle: styles.label || '#B2E9FE',
                     imageUrl: imageUrl,
                     imageUrl: `https://rizwiki.cn/images/thumb/${song.image.substring(0, 1)}/${song.image.substring(0, 2)}/${song.image}/300px-${song.image}`,
                     pageUrl: `https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`
                     pageUrl: `https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`
                 })
                 })
第100行: 第102行:
                     headerStyle: '#A3E5FF',
                     headerStyle: '#A3E5FF',
                     labelStyle: '#B2E9FE',
                     labelStyle: '#B2E9FE',
                     imageUrl: null,
                     imageUrl: `https://rizwiki.cn/images/thumb/${song.image.substring(0, 1)}/${song.image.substring(0, 2)}/${song.image}/300px-${song.image}`,
                     pageUrl: `https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`
                     pageUrl: `https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}`
                 })
                 })
第110行: 第112行:
         const titleMatch = wikitext.match(/infobox-title.*?background:(#[0-9a-fA-F]+)/)
         const titleMatch = wikitext.match(/infobox-title.*?background:(#[0-9a-fA-F]+)/)
         if (titleMatch) styles.title = titleMatch[1]
         if (titleMatch) styles.title = titleMatch[1]
         const headerMatch = wikitext.match(/infobox-header.*?background:(#[0-9a-fA-F]+)/)
         const headerMatch = wikitext.match(/infobox-header.*?background:(#[0-9a-fA-F]+)/)
         if (headerMatch) styles.header = headerMatch[1]
         if (headerMatch) styles.header = headerMatch[1]
         const labelMatch = wikitext.match(/infobox-label.*?background:(#[0-9a-fA-F]+)/)
         const labelMatch = wikitext.match(/infobox-label.*?background:(#[0-9a-fA-F]+)/)
         if (labelMatch) styles.label = labelMatch[1]
         if (labelMatch) styles.label = labelMatch[1]

2025年10月19日 (日) 21:57的版本

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

神秘的随机挑战!


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

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