“模块:TWRSideNavBox”的版本间的差异
跳到导航
跳到搜索
小 |
|||
(未显示同一用户的1个中间版本) | |||
第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>" | -- Defines the style of NavBox | ||
boxCaudaLabel = "\n</div>" | |||
function p.assemblyFixedNavBox( frame ) | function p.assemblyFixedNavBox( frame ) | ||
第11行: | 第12行: | ||
splitPoint = v:find("::") | splitPoint = v:find("::") | ||
-- Format of each element: "<File Name>::<Anchor>" | -- Format of each element: "<File Name>::<Anchor>" | ||
-- with no spaces in both sides of the | -- with no spaces in both sides of the two cola | ||
if splitPoint ~= nil and splitPoint > 1 then | if splitPoint ~= nil and splitPoint > 1 then | ||
name1 = v:sub(1, splitPoint - 1) | name1 = v:sub(1, splitPoint - 1) |
2022年1月4日 (二) 22:35的最新版本
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" -- Defines the style of NavBox 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 two cola 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