跳到内容
折叠侧栏
搜索
创建账号
个人工具
创建账号
登录
导航
首页
最近更改
随机页面
维基项目
方针
指引
讨论版
格式手册
挂起清单
版本更新列表
玩法条目
游戏玩法
界面
机制
搭档
潜力值
世界模式
故事模式
段位挑战
解歌系统
成就系统
版本更新日志
列表条目
定数表
曲目列表
曲包列表
曲师列表
谱师列表
画师列表
背景列表
友情链接
Rotaeno中文维基
工具
链入页面
相关更改
特殊页面
页面信息
查看“Module:Sandbox/SongLink”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
更多
阅读
查看源代码
查看历史
←
Module:Sandbox/SongLink
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local getArgs = require('Module:Arguments').getArgs local songList = require("Module:LoadJson").Songlist()["songs"] local l = { ["#1f1e33"] = "#1f1e33", ["AI[UE]OON"] = "AI[UE]OON", ["Last | Eternity"] = "Last", ["Last | Moment"] = "Last" } local n = { ["Last | Eternity"] = "Last \| Eternity", ["Last | Moment"] = "Last \| Moment" } function p.fixLink(name) if l[name] then return l[name] else return name end end function p.fixDisplay(name) if n[name] then return n[name] else return name end end function p.link(frame) local args = getArgs(frame) local songName = args[1] -- 既可以是 id,也可以是曲名,甚至是 Beyond 曲名 local isBeyond = args[2] if (isBeyond == "") or (isBeyond == nil) then isBeyond = false else isBeyond = true end local song = nil local hasBeyondSpecialName = false for i,k in pairs(songList) do if k.id == songName then song = k break end if k.title_localized.en == songName then song = k break end if k.difficulties[4] and k.difficulties[4].title_localized and k.difficulties[4].title_localized.en == songName then hasBeyondSpecialName = true isBeyond = true song = k end end if not song then error("未找到歌曲") end if isBeyond and (not song.difficulties[4]) then error("曲目没有 Beyond 难度") end if isBeyond and song.difficulties[4].title_localized then hasBeyondSpecialName = true end local linkTo = p.fixLink(song.title_localized.en) local display = song.title_localized.en if hasBeyondSpecialName then display = song.difficulties[4].title_localized.en end local display_fixed = p.fixDisplay(display) local function fixTooltip(innerText, tooltip) if not tooltip then return "<span title=\"" .. innerText .."\">" .. innerText .. "</span>" else return "<span title=\"" .. tooltip .."\">" .. innerText .. "</span>" end end if not(display == linkTo) then if not (display_fixed == display) then display = fixTooltip(display_fixed, display) else display = fixTooltip(display) end end if not(linkTo == display) then return "[[" .. linkTo .. "|" .. display .. "]]" else return "[[" .. linkTo .. "]]" end end return p
本页使用的模板:
Module:Sandbox/SongLink/doc
(
查看源代码
)
返回
Module:Sandbox/SongLink
。