跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
天灾之下:危险连接官网(建设中)
天灾之下:危险连接QQ群
天灾之下:危险连接 Bilibili
冰糖服务器
冰糖服务器QQ群
天灾之下:危险连接资料站
搜索
搜索
中文(中国大陆)
外观
创建账号
登录
个人工具
创建账号
登录
查看“︁模块:ImageStackPopup”︁的源代码
模块
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
页面信息
[[雷光]]
外观
移至侧栏
隐藏
←
模块:ImageStackPopup
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
-- Requires ImageStackPopup gadget local p = {} function p.image( frame ) math.randomseed(tonumber(mw.getContentLanguage():formatDate( "U" ))*10000 + os.clock()*10000) local args = frame:getParent().args local popupConfig = {} local caption = '' popupConfig.loop = args.loop == "yes" if tonumber( args.start ) then popupConfig.start = tonumber( args.start ) else popupConfig.start = 1 end if tonumber( args.width ) then popupConfig.width = tonumber( args.width ) end if tonumber( args.height ) then popupConfig.height = tonumber( args.height ) end popupConfig.list = args.list if args['noregisterimages'] == nil then -- Register this as a dependency so that this page shows up as using all the images on the list page frame:expandTemplate{ title = ':' .. args.list } end -- If we don't want to transclude for performance, maybe we could at least link -- however links need to actually be output on the page to register them. if args.caption then popupConfig.caption = "imagestackpopup-caption-" .. math.random() caption = tostring( mw.html.create( 'div' ) :attr( 'id', popupConfig.caption ) :attr( 'style', 'display: none' ) :wikitext( args.caption ) :done() ) end if args.title then popupConfig.title = args.title end return tostring( mw.html.create( 'div' ) :attr( 'class', 'ImageStackPopup' ) :attr( 'data-imagestackpopup-config', mw.text.jsonEncode( { popupConfig } ) ) :wikitext( args.file ) ) .. caption .. '[[Category:Gadget:ImageStackPopup]]' end function p.gallery( frame ) -- Seems like math.random is always seeded with 0 :( math.randomseed(tonumber(mw.getContentLanguage():formatDate( "U" ))*10000 + os.clock()*10000) local args = frame:getParent().args local reuseImageCaption = args.reuse_image_caption ~= nil local title = args["popup-title"] local captionId = nil local captionText = '' local galleryContents = '' local optionsArray = {} local galleryArgs = {} local galleryAttr = { "mode", "widths", "heights", "perrow", "caption", "showfilename", "showthumbnail", "id", "title", "class", "lang", "dir" } for i, j in ipairs( galleryAttr ) do galleryArgs[j] = args[j] end if args['popup-caption'] then captionId = 'imagestackpopup-caption-' .. math.random() captionText = tostring( mw.html.create( 'div' ) :attr( 'style', 'display:none' ) :attr( 'id', captionId ) :wikitext( args['popup-caption'] ) ) end for row in mw.text.gsplit( args.gallery, "\n", true ) do local galleryRow = '' local popupOptions = { title = title, caption = captionId } for part in mw.text.gsplit( row, "!", true ) do equalSplit = mw.text.split( part, '=', true ) if #equalSplit <= 1 then -- be sure this really is a caption. if galleryRow ~= '' and reuseImageCaption and #part > 8 and string.find( part, " ", 1, true ) then local captionId = 'imagestackpopup-caption-' .. math.random() local wrappedPart = tostring( mw.html.create( 'span' ) :attr( 'id', captionId ) :wikitext( part ) ) popupOptions.caption = captionId galleryRow = galleryRow .. wrappedPart .. '|' else galleryRow = galleryRow .. part .. '|' end else if equalSplit[1] == 'popup-width' then popupOptions.width = tonumber(equalSplit[2]) elseif equalSplit[1] == 'popup-height' then popupOptions.height = tonumber(equalSplit[2]) elseif equalSplit[1] == 'popup-loop' then popupOptions.loop = equalSplit[2] ~= '' elseif equalSplit[1] == 'popup-start' then popupOptions.start = tonumber(equalSplit[2]) elseif equalSplit[1] == 'popup-caption' then local captionIdForImg = 'imagestackpopup-caption-' .. math.random() captionText = captionText .. tostring( mw.html.create( 'div' ) :attr( 'id', captionIdForImg ) :css( 'display', 'none' ) :wikitext( table.concat( equalSplit, '=', 2 ) ) ) popupOptions.caption = captionIdForImg elseif equalSplit[1] == 'popup-title' then popupOptions.title = table.concat( equalSplit, '=', 2 ) elseif equalSplit[1] == 'popup-list' then popupOptions.list = table.concat( equalSplit, '=', 2 ) if args['noregisterimages'] == nil then -- Register this as a dependency so that this page shows up as using all the images on the list page frame:expandTemplate{ title = ':' .. table.concat( equalSplit, '=', 2 ) } end else galleryRow = galleryRow .. part .. '|' end end end if string.sub( galleryRow, -1 ) == '|' then galleryRow = string.sub( galleryRow, 1, -2 ) end galleryContents = galleryContents .. galleryRow .. "\n" optionsArray[#optionsArray+1] = popupOptions end return tostring( mw.html.create( 'div' ) :attr( 'class', 'ImageStackPopup' ) :attr( 'data-imagestackpopup-config', mw.text.jsonEncode( optionsArray ) ) :wikitext( frame:extensionTag( 'gallery', galleryContents, galleryArgs ) ) ) .. captionText .. '[[Category:Gadget:ImageStackPopup]]' end return p
该页面嵌入的页面:
模块:ImageStackPopup/doc
(
查看源代码
)
返回
模块:ImageStackPopup
。
搜索
搜索
查看“︁模块:ImageStackPopup”︁的源代码
添加语言
添加话题