“模块:TWRSideNavBox”的版本间的差异
跳到导航
跳到搜索
第2行: | 第2行: | ||
itemString = "|-\n|[[File:{{{1}}}|50px|link={{FULLPAGENAME}}#{{{2}}}]]\n" | itemString = "|-\n|[[File:{{{1}}}|50px|link={{FULLPAGENAME}}#{{{2}}}]]\n" | ||
boxHeadLabel = "<div style=\"position: fixed; right: 0; top: 50%; z-index: 100; padding: 1em 2em 1em 1em; border-radius: 1em 0 0 1em; background-color: #7879934f; background-image: radial-gradient(#01010100 0%, #01010100 50%, #0101010f 65%, #01010122 75%, #01010166 100%); border-width: 0.2em 0 0.2em 0.2em; border-style: solid; border-color: #e6e6f2; box-shadow: 0 0 0.5em #01010166\">" | boxHeadLabel = "<div style=\"position: fixed; right: 0; top: 50%; z-index: 100; padding: 1em 2em 1em 1em; border-radius: 1em 0 0 1em; background-color: #7879934f; background-image: radial-gradient(#01010100 0%, #01010100 50%, #0101010f 65%, #01010122 75%, #01010166 100%); border-width: 0.2em 0 0.2em 0.2em; border-style: solid; border-color: #e6e6f2; box-shadow: 0 0 0.5em #01010166\">\n" | ||
boxCaudaLabel = "</div>" | boxCaudaLabel = "\n</div>" | ||
function p.assemblyFixedNavBox( frame ) | function p.assemblyFixedNavBox( frame ) |
2022年1月2日 (日) 18:25的版本
local p = {} itemString = "|-\n|[[File:{{{1}}}|50px|link={{FULLPAGENAME}}#{{{2}}}]]\n" boxHeadLabel = "<div style=\"position: fixed; right: 0; top: 50%; z-index: 100; padding: 1em 2em 1em 1em; border-radius: 1em 0 0 1em; background-color: #7879934f; background-image: radial-gradient(#01010100 0%, #01010100 50%, #0101010f 65%, #01010122 75%, #01010166 100%); border-width: 0.2em 0 0.2em 0.2em; border-style: solid; border-color: #e6e6f2; box-shadow: 0 0 0.5em #01010166\">\n" boxCaudaLabel = "\n</div>" function p.assemblyFixedNavBox( frame ) local returnString = "" itemString = itemString:gsub("{{FULLPAGENAME}}", frame.args["pagename"]) for k, v in pairs(frame.args) do splitPoint = v:find("::") -- Format of each element: "<File Name>::<Anchor>" -- with no spaces in both sides of the backslash if splitPoint ~= nil and splitPoint > 1 then name1 = v:sub(1, splitPoint - 1) name2 = v:sub(splitPoint + 2) if name1:find("%.%w+$") ~= nil then segment = itemString:gsub("{{{1}}}", name1) else -- If no file extension is found, assumes PNG by default segment = itemString:gsub("{{{1}}}", name1 .. ".png") end segment = segment:gsub("{{{2}}}", name2) returnString = returnString .. segment end end return boxHeadLabel .. "{|\n" .. returnString .. "|}" .. boxCaudaLabel end return p