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

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

来自Rizline中文维基
第138行: 第138行:
                     }
                     }
                     const wikitext = pages[pageId].revisions[0]['*']
                     const wikitext = pages[pageId].revisions[0]['*']
                    console.log('=== 曲目页面wikitext ===')
                    console.log(wikitext.substring(0, 500)) // 只看前500字符
                    console.log('=== wikitext结束 ===')
                     const styles = parseStylesFromWikitext(wikitext)
                     const styles = parseStylesFromWikitext(wikitext)
                     const imageUrl = parseImageFromWikitext(wikitext)
                     const imageUrl = parseImageFromWikitext(wikitext)
                    console.log('提取的图片URL:', imageUrl)


                     updateSongInfo(song, {
                     updateSongInfo(song, {
第191行: 第193行:


     function parseImageFromWikitext(wikitext) {
     function parseImageFromWikitext(wikitext) {
         const fileMatch = wikitext.match(/\[\[文件:(.*?)\]\]/)
        console.log('曲目页面wikitext:', wikitext)
         if (fileMatch) {
 
             const fileName = fileMatch[1]
        // 尝试多种匹配模式
            return `https://rizwiki.cn/images/thumb/${fileName.substring(0, 1)}/${fileName.substring(0, 2)}/${fileName}/300px-${fileName}`
         const patterns = [
            /\[\[文件:([^|\]\n]+)(?:\|[^]\n]*)?\]\]/,  // [[文件:xxx.png]]
            /\[\[File:([^|\]\n]+)(?:\|[^]\n]*)?\]\]/,  // [[File:xxx.png]]
            /src="([^"]+\.(?:png|jpg|jpeg|gif))"/i,    // src="xxx.png"
            /src='([^']+\.(?:png|jpg|jpeg|gif))'/i    // src='xxx.png'
         ]
 
        for (const pattern of patterns) {
             const match = wikitext.match(pattern)
            if (match) {
                console.log('匹配到的图片:', match[1])
                let fileName = match[1].trim()
 
                // 如果是文件名,构造图片URL
                if (fileName.includes('.')) {
                    fileName = encodeURIComponent(fileName)
                    return `https://rizwiki.cn/images/thumb/?file=${fileName}&width=300`
                }
                return match[1]
            }
         }
         }
         return null
         return null
     }
     }

2025年10月20日 (一) 00:12的版本

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

神秘的随机挑战!


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

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