Anonymous

Module:Navboxes: Difference between revisions

From Melvor Idle
m
no edit summary
(made farming navbox collapsible. maybe.)
mNo edit summary
Line 41: Line 41:
   local treeProduce = table.concat(treeProduceTable, ' • ')
   local treeProduce = table.concat(treeProduceTable, ' • ')
   local pagename = ''
   local pagename = ''
   local allotment = 'mw-collapsible mw-collapsed'
   local allotment = 'mw-collapsed'
   local herb = 'mw-collapsible mw-collapsed'
   local herb = 'mw-collapsed'
   local tree = 'mw-collapsible mw-collapsed'
   local tree = 'mw-collapsed'


   if frame.args ~= nil and frame.args[1] then
   if frame.args ~= nil and frame.args[1] then
     pagename = frame.args[1]
     pagename = frame.args[1]
     if Shared.contains(allotmentSeeds, pagename) or Shared.contains(allotmentProduce, pagename) then
     if Shared.contains(allotmentSeeds, pagename) or Shared.contains(allotmentProduce, pagename) then
       allotment = 'mw-collapsible'
       allotment = ''
     elseif Shared.contains(herbSeeds, pagename) or Shared.contains(herbProduce, pagename) then
     elseif Shared.contains(herbSeeds, pagename) or Shared.contains(herbProduce, pagename) then
       herb = 'mw-collapsible'
       herb = ''
     elseif Shared.contains(treeSeeds, pagename) or Shared.contains(treeProduce, pagename) then
     elseif Shared.contains(treeSeeds, pagename) or Shared.contains(treeProduce, pagename) then
       tree = 'mw-collapsible'
       tree = ''
     end
     end
   end
   end
Line 58: Line 58:
   local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"'
   local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"'
   result = result..'\r\n!'..Icons.Icon({'Farming', type='skill'})
   result = result..'\r\n!'..Icons.Icon({'Farming', type='skill'})
   result = result..'{| class="wikitable '..allotment..'" style="margin:auto; clear:both; width: 100%"'
   result = result..'\r\n|-{| class="wikitable mw-collapsible '..allotment..'" style="margin:auto; clear:both; width: 100%"'
   result = result..'\r\n!colspan="2"|Allotments'
   result = result..'\r\n!colspan="2"|Allotments'
   result = result..'\r\n|-\r\n!scope="row"|Seeds'
   result = result..'\r\n|-\r\n!scope="row"|Seeds'
Line 65: Line 65:
   result = result..'\r\n|style="text-align:center;|'..allotmentProduce
   result = result..'\r\n|style="text-align:center;|'..allotmentProduce
   result = result..'\r\n|}'
   result = result..'\r\n|}'
   result = result..'{| class="wikitable '..herb..'" style="margin:auto; clear:both; width: 100%"'
   result = result..'{| class="wikitable mw-collapsible '..herb..'" style="margin:auto; clear:both; width: 100%"'
   result = result..'\r\n!colspan="2"|Herbs'
   result = result..'\r\n!colspan="2"|Herbs'
   result = result..'\r\n|-\r\n!scope="row"|Seeds'
   result = result..'\r\n|-\r\n!scope="row"|Seeds'
Line 72: Line 72:
   result = result..'\r\n|style="text-align:center;|'..herbProduce
   result = result..'\r\n|style="text-align:center;|'..herbProduce
   result = result..'\r\n|}'
   result = result..'\r\n|}'
   result = result..'{| class="wikitable '..tree..'" style="margin:auto; clear:both; width: 100%"'
   result = result..'{| class="wikitable mw-collapsible '..tree..'" style="margin:auto; clear:both; width: 100%"'
   result = result..'\r\n!scope="row" colspan="2"|Trees'
   result = result..'\r\n!scope="row" colspan="2"|Trees'
   result = result..'\r\n|-\r\n!scope="row"|Seeds'
   result = result..'\r\n|-\r\n!scope="row"|Seeds'
444

edits