打开/关闭搜索
搜索
打开/关闭菜单
549
7
12
2051
OGAS数据中枢
导航
首页
最近更改
随机页面
特殊页面
上传文件
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
查看“︁Module:GF utils”︁的源代码
来自OGAS数据中枢
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
Module:GF utils
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
管理员
您可以查看和复制此页面的源代码。
--[=[ 此模块包含[[少女前线]]相关模板使用的工具函数。 ]=] local ugsub = mw.ustring.gsub local format = string.format local utils = {} --- 为星级添加颜色。 function utils.colored_rarity(frame) local arg = assert(frame.args[1], '未提供参数') local rarity_color = { '#865c7d', '#777777', '#33566f', '#7b813f', '#a7753b', '#ad4229' } -- 3 -> '<span style="...">★★★</span>' -- 9 -> nil local function make_colored_rarity(rarity) local color = rarity_color[rarity] if not color then return nil end return format('<span style="color:%s">%s</span>', color, ('★'):rep(rarity)) end -- '3' -> <span style="...">★★★</span> -- '9' -> '9' local function colorize_number(str) return make_colored_rarity(tonumber(str)) or str end -- '★★★' -> <span style="...">★★★</span> -- '★★★★★★★★★' -> '★★★★★★★★★' local function colorize_star(start, str, stop) return make_colored_rarity(stop - start) or str end local out = arg:match('^%s*(.-)%s*$') -- 去首尾空白 out = out:gsub('%s*→%s*', ' → '):gsub('%s*->%s*', ' → ') -- 调整箭头 out = ugsub(out, '()(★+)()', colorize_star) out = out:gsub('%d+', colorize_number) return out end return utils
该页面嵌入的页面:
Module:GF utils/doc
(
查看源代码
)
返回
Module:GF utils
。
查看“︁Module:GF utils”︁的源代码
来自OGAS数据中枢