打开/关闭搜索
搜索
打开/关闭菜单
1.2万
1.8万
100
8.1万
导航
首页
最近更改
特殊页面
上传文件
随机页面
随机页面
随机歌曲
随机P主
编辑相关
帮助
讨论版
公共沙盒
待修改页面
批量上传文件
友情链接
VCPedia
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
登录后可编辑和发表评论。
user-interface-preferences
个人工具
创建账号
登录
欢迎加入
本站官方QQ群
!
查看“︁Module:沙盒”︁的源代码
来自Vocawiki
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
Module:沙盒
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local SITE = "https://voca.wiki" local BASE_ICON_STYLE = "-webkit-mask-repeat:no-repeat;" .. "-webkit-mask-position:center;" .. "-webkit-mask-size:contain;" -- 自定义图标 local function buildIconStyle(icon) if not icon or icon == "" then return "" end icon = mw.text.trim(tostring(icon)) if not icon:match("^[%w%-%_ %.]+%.svg$") then return "" end local filename = icon:gsub(" ", "_") local encoded = mw.uri.encode(filename, "PATH") local url = SITE .. "/Special:Redirect/file/" .. encoded -- 覆盖 return string.format('-webkit-mask-image:url("%s");mask-image:url("%s");', url, url) end -- 图标样式 local function buildIconAttr(args) local iconStyle = buildIconStyle(args.icon) local style = BASE_ICON_STYLE .. iconStyle return ' style="' .. style .. '"' end function p.main(frame) local args = frame:getParent().args local type_ = args.type or "info" local iconAttr = buildIconAttr(args) -- text模式 local textContent = args.text or args[1] if textContent and textContent ~= "" then return string.format([[ <div class="notice notice-%s"> <div class="notice-icon"%s></div> <div class="notice-text text-base"> <div class="notice-text-only text-base">%s</div> </div> </div> ]], type_, iconAttr, textContent) end -- 列表 local listItems = {} for i = 1, 50 do local key = "l" .. i if args[key] and args[key] ~= "" then table.insert(listItems, "<li>" .. args[key] .. "</li>") end end local listHtml = "" if #listItems > 0 then listHtml = '<ul class="notice-list text-sm">' .. table.concat(listItems, "\n") .. "</ul>" elseif args.list and args.list ~= "" then listHtml = '<ul class="notice-list text-sm">' .. args.list .. "</ul>" end return string.format([[ <div class="notice notice-%s"> <div class="notice-icon"%s></div> <div class="notice-text text-base"> <div class="notice-title text-base">%s</div> %s <div class="notice-detail text-sm">%s</div> </div> </div> ]], type_, iconAttr, args.title or "", listHtml, args.detail or "") end return p
该页面嵌入的页面:
Template:Documentation
(
查看源代码
)
Template:Notice
(
查看源代码
)
Template:Notice/styles.css
(
查看源代码
)
Template:沙盒页顶
(
查看源代码
)
Module:Notice
(
查看源代码
)
Module:沙盒/doc
(
查看源代码
)
返回
Module:沙盒
。
查看“︁Module:沙盒”︁的源代码
来自Vocawiki