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

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

来自Rizline中文维基
第71行: 第71行:
     })
     })


function parseSongsFromWikitext(wikitext) {
    function parseSongsFromWikitext(wikitext) {
    const songs = []
        const songs = []
    console.log('wikitext内容:', wikitext)
        console.log('wikitext内容:', wikitext)


    // "|-"为行起点匹配整个表格行
        // 分割整个文本,按"|-"来分割每一行
    const rowRegex = /\|-\s*\n\|\s*\[\[文件:([^|\]\n]+)(?:\|[^]\n]*)?\]\]\s*\n\|\s*\[\[([^|\]\n]+)(?:\|[^]\n]*)?\]\]\s*\n\|\s*([^|\n]+)\s*\n\|\s*([^|\n]+)\s*\n\|\s*([^|\n]+)\s*\n\|\s*([^|\n]+)\s*\n\|\s*([^|\n]+)/g
        const rows = wikitext.split('|-')
        console.log('分割出的行数:', rows.length)


    let match
        for (let i = 1; i < rows.length; i++) { // 从1开始跳过表头
    let matchCount = 0
            const row = rows[i]
            console.log(`处理第 ${i} 行:`, row)


    while ((match = rowRegex.exec(wikitext)) !== null) {
            // 按换行符分割每一列
        matchCount++
            const columns = row.split('\n').filter(col => col.trim().startsWith('|'))
        console.log(`匹配 ${matchCount}:`, match)
            console.log(`${i} 行列数:`, columns.length)


        const song = {
            if (columns.length >= 7) {
            image: match[1].trim(),
                // 提取各列数据
            title: match[2].trim(),
                const imageMatch = columns[0].match(/\[\[文件:([^|\]]+)/)
            author: match[3].trim(),
                const titleMatch = columns[1].match(/\[\[([^|\]]+)/)
            duration: match[4].trim(),
 
            ez: match[5].trim(),
                if (imageMatch && titleMatch) {
            hd: match[6].trim(),
                    const song = {
            in: match[7].trim()
                        image: imageMatch[1].trim(),
        }
                        title: titleMatch[1].trim(),
                        author: columns[2].replace(/^\|/, '').trim(),
                        duration: columns[3].replace(/^\|/, '').trim(),
                        ez: columns[4].replace(/^\|/, '').trim(),
                        hd: columns[5].replace(/^\|/, '').trim(),
                        in: columns[6].replace(/^\|/, '').trim()
                    }


        console.log('解析出的曲目:', song)
                    console.log('解析出的曲目:', song)


            if (song.title) {
                    if (song.title) {
                if (song.title !== '') {
                        if (song.title !== '') {
                    if (song.title !== '?') {
                            if (song.title !== '?') {
                        songs.push(song);
                                songs.push(song);
                            }
                        }
                     }
                     }
                 }
                 }
第106行: 第116行:
         }
         }


    console.log('解析出的所有曲目:', songs)
        console.log('解析出的所有曲目:', songs)
    console.log('总共匹配到:', matchCount, '个曲目')
        console.log('总共匹配到:', songs.length, '个曲目')


    return songs
        return songs
}
    }


     function loadSongColors(song) {
     function loadSongColors(song) {

2025年10月19日 (日) 23:53的版本

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

神秘的随机挑战!


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

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