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

模块:If mobile

来自从零开始
Aladedalu留言 | 贡献2026年1月30日 (五) 14:05的版本 (创建页面,内容为“local p = {} function p._main(args) local frame = mw.getCurrentFrame() local root = mw.html.create() if args["Tag"] then args["tag"] = args["Tag"] end local ifmobile = root:tag(args["tag"] or 'span') ifmobile :addClass('ifmobile') local nomobile = ifmobile:tag(args["tag"] or 'span') local mobile = ifmobile:tag(args["tag"] or 'span') nomobile :addClass('nomobile') :wikitext(args[2]) mo…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在模块:If mobile/doc创建

local p = {}

function p._main(args)
    local frame = mw.getCurrentFrame()
    local root = mw.html.create()

    if args["Tag"] then
        args["tag"] = args["Tag"]
    end

    local ifmobile = root:tag(args["tag"] or 'span')
    ifmobile
        :addClass('ifmobile')

    local nomobile = ifmobile:tag(args["tag"] or 'span')
    local mobile = ifmobile:tag(args["tag"] or 'span')

    nomobile
        :addClass('nomobile')
        :wikitext(args[2])

    mobile
        :addClass('mobile')
        :wikitext(args[1])

    return frame:extensionTag {name = 'templatestyles', args = {src = 'If mobile/styles.css'}} .. tostring(root)
end

function p.main(frame)
    local args = require('Module:Arguments').getArgs(frame, {
        wrappers = 'Template:If mobile'
    })
    return p._main(args)
end

return p