La documentation pour ce module peut être créée à Module:Nav/doc
local p = {}
local modElements = require( 'Module:Elements' )
local dlc = require( 'Module:Dlc' )
function p.main( f )
local nomPage = mw.title.getCurrentTitle()
local page = modElements.page( nomPage.text )
local nav = page.valeur.nav
local Type = { attribut=false, babiole=false, boss=false, carteSpeciale=false, cavalierApocalypse=false, challenge=false, challengeJournalier=false, consommable=false, etage=false, homonymie=false, itemPool=false, machine=false, miniBoss=false, moddage=false, modeJeu=false, monstre=false, objetActif=false, objetPassif=false, obstacle=false, pageCollection=false, pecheCapital=false, superpecheCapital=true, personnage=false, salle=false, succes=false, transformation=false, version=false }
local _n = '<br><br>'
local _c = page.autres
local _l = ''
local j = 1
if page.existe then
if not page.valeur.Type then
page.valeur.Type = {}
end
repeat
table.insert( page.valeur.Type, f:getParent().args[j] )
j = j + 1
until not f:getParent().args[j]
if page.valeur.Type[1] then
for indexVal, objetVal in pairs( page.valeur.Type ) do
for indexType, objetType in pairs( Type ) do
if objetVal == indexType then
objetType = true
end
end
end
end
-- NAVIGATION
if not nav.AUTRE then
local navPrincipale = {
P = { titre = { i="Isaac_App.png|30px", n="Personnages", l="Personnages" },
n1 = { i="MainPageBosses.png|20px", n="Boss", l="Boss" },
n2 = { i="MainPageBabies.png|15px", n="Co-op", l="Bébés" },
n3 = { i="Sister_Maggy_Icon.png|20px", n="Familiers", l="Familiers" },
n4 = { i="MainPageMonsters.png|17px", n="Monstres", l="Monstres" } },
O = { titre = { i="Magic_Mushroom_Icon.png|30px", n="Objets", l="Objets" },
n1 = { i="The_Left_Hand_Icon.png|18px", n="Babioles", l="Babioles" },
n2 = { i="TarotCard.png|20px", n="Cartes et Runes", l="Cartes et Runes" },
n3 = { i="Red_heart.png|18px", n="Consommables", l="Consommables" },
n4 = { i="Lil\'_Chest_Icon.png|20px", n="Page de collection", l="Page de collection" } },
E = { titre = { i="MainPageRooms.png|30px", n="Mécaniques d\'étages", l="Chapitres" },
n1 = { i="MainPageChallenges.png|15px", n="Challenges", l="Challenges" },
n2 = { i="HardIndicator.png|20px", n="Malédictions", l="Malédictions" },
n3 = { i="Greed_Mode_Indicator.png|20px", n="Modes de jeu", l="Mode de jeu" },
n4 = { i="MainPageRooms.png|20px", n="Salles", l="Salles" } },
M = { titre = { i="MainPageMechanics.png|30px", n="Mécaniques", l="Mécaniques" },
n1 = { i="MainPageAttributes.png|20px", n="Attributs", l="Attributs" },
n2 = { i="Isaac\'s_Tears_Icon.png|18px", n="Item pools", l="Item pools" },
n3 = { i="MainPageAchievements.png|20px", n="Succès", l="Succès" },
n4 = { i="Guppy_App.png|17px", n="Transformations", l="Transformations" } },
I = { titre = { i="MainPageObjects.png|30px", n="Éléments interactifs", l=":Catégorie:Éléments interactifs" },
n1 = { i="Slot_Machine.png|20px", n="Machines", l="Machines" },
n2 = { i="Shopkeeper.png|17px", n="Marchands", l="Marchands" },
n3 = { i="Beggar.png|20px", n="Mendiants", l="Mendiants" },
n4 = { i="Metalblock.png|20px", n="Obstacles", l="Obstacles" } },
T = { titre = { i="Humbling_Bundle_Icon.png|30px", n="Technique", l=nil },
n1 = { i="MainPageSeeds2.png|20px", n="Graines", l="Graines" },
n2 = { i="Daily_Run_Indicator.png|20px", n="Défis journaliers", l="Challenges journaliers", dlc="Afterbirth" },
n3 = { i="Missing_No._Icon.png|17px", n="Moddage", l="Moddage", dlc="Afterbirth+" },
n4 = { i="The_Hourglass_Icon.png|17px", n="Historique des versions", l="Historique des versions" } }
}
local menu = { main=nil }
for index, objet in pairs( navPrincipale ) do
if nav == index then
local i = 1
menu.main = navPrincipale[nav] -- Cette commande mélange le tableau, rendant l'utilisation de table.remove impossible
if nav == 'P' then
menu[1] = navPrincipale.O
menu[2] = navPrincipale.E
menu[3] = navPrincipale.M
menu[4] = navPrincipale.I
menu[5] = navPrincipale.T
elseif nav == 'O' then
menu[1] = navPrincipale.P
menu[2] = navPrincipale.E
menu[3] = navPrincipale.M
menu[4] = navPrincipale.I
menu[5] = navPrincipale.T
elseif nav == 'E' then
menu[1] = navPrincipale.P
menu[2] = navPrincipale.O
menu[3] = navPrincipale.M
menu[4] = navPrincipale.I
menu[5] = navPrincipale.T
elseif nav == 'M' then
menu[1] = navPrincipale.P
menu[2] = navPrincipale.O
menu[3] = navPrincipale.E
menu[4] = navPrincipale.I
menu[5] = navPrincipale.T
elseif nav == 'I' then
menu[1] = navPrincipale.P
menu[2] = navPrincipale.O
menu[3] = navPrincipale.E
menu[4] = navPrincipale.M
menu[5] = navPrincipale.T
elseif nav == 'T' then
menu[1] = navPrincipale.P
menu[2] = navPrincipale.O
menu[3] = navPrincipale.E
menu[4] = navPrincipale.M
menu[5] = navPrincipale.I
end
--[[if nav == 'P' then table.remove( navPrincipale, 1 )
elseif nav == 'O' then table.remove( navPrincipale, 2 )
elseif nav == 'E' then table.remove( navPrincipale, 3 )
elseif nav == 'M' then table.remove( navPrincipale, 4 )
elseif nav == 'I' then table.remove( navPrincipale, 5 )
else table.remove( navPrincipale, 6 ) end
for index, objet in pairs( navPrincipale ) do
menu[i] = objet
i = i + 1
end]]
end
end
_n = _n .. '<table class="navPrincipaleSelect" style="width:775px; height:150px; margin:auto auto 1em auto; color:#FFFFFF; text-align:center; font-size:10pt; font-weight:bold; padding:30px 30px 50px"><tr><td style="width:20%">' .. p.img( menu.main.n1 ) .. '</td><td style="width:20%">' .. p.img( menu.main.n2 ) .. '</td><td style="width:20%">' .. p.img( menu.main.titre ) .. '</td><td style="width:20%">' .. p.img( menu.main.n3 ) .. '</td><td style="width:20%">' .. p.img( menu.main.n4 ) .. '</td></tr><tr><td>' .. p.nom( menu.main.n1 ) .. '</td><td>' .. p.nom( menu.main.n2 ) .. '</td><td>' .. p.nom( menu.main.titre ) .. '</td><td>' .. p.nom( menu.main.n3 ) .. '</td><td>' .. p.nom( menu.main.n4 ) .. '</td></tr><tr><td colspan=5><div style="position:relative"><div class="boutonNav-visible" style="cursor:pointer; width:30px; position:absolute; right:0px">[[File:ButtonNavVisible.png|lien=|Cacher la navigation complète]]</div><div class="boutonNav-collapsed" style="cursor:pointer; width:30px; position:absolute; right:0px">[[File:ButtonNavCollapsed.png|lien=|Afficher la navigation complète]]</div></div></td></tr></table>'
if Type.attribut then
end
if Type.babiole then
end
if Type.boss then
end
if Type.carteSpeciale then
end
if Type.challenge then
end
if Type.challengeJournalier then
end
if Type.consommable then
end
if Type.etage then
end
if Type.homonymie then
end
if Type.itemPool then
end
if Type.machine then
end
if Type.miniBoss then
end
if Type.moddage then
end
if Type.modeJeu then
end
if Type.monstre then
end
if Type.objetActif then
end
if Type.objetPassif then
end
if Type.obstacle then
end
if Type.pageCollection then
end
if Type.personnage then
end
if Type.salle then
end
if Type.succes then
end
if Type.transformation then
end
if Type.version then
end
_n = _n .. '<table class="navPrincipale" style="width:850px; height:400px; margin: 1em auto 1em auto; color:#FFFFFF; text-align:center; font-size:10pt; font-weight:bold; vertical-align:bottom; padding:30px 30px 30px"><tr><th colspan="5">[[Fichier:SmallIsaac.png|30px|frameless]] \'\'[[Binding of Isaac: Rebirth Wiki|The Binding of Isaac: Rebirth]]\'\' [[Fichier:SmallIsaac.png|30px|frameless]]</th></tr>'
_n = _n .. '<tr><td>' .. p.img( menu[1].titre ) .. '</td><td>' .. p.img( menu[2].titre ) .. '</td><td>' .. p.img( menu[3].titre ) .. '</td><td>' .. p.img( menu[4].titre ) .. '</td><td>' .. p.img( menu[5].titre ) .. '</td></tr>'
_n = _n .. "<tr><td>'''" .. p.nom( menu[1].titre ) .. "'''</td><td>'''" .. p.nom( menu[2].titre ) .. "'''</td><td>'''" .. p.nom( menu[3].titre ) .. "'''</td><td>'''" .. p.nom( menu[4].titre ) .. "'''</td><td>'''" .. p.nom( menu[5].titre ) .. "'''</td></tr>"
_n = _n .. '<tr><td><p>' .. p.img( menu[1].n1 ) .. p.nom( menu[1].n1 ) .. '<br>' .. p.img( menu[1].n2 ) .. p.nom( menu[1].n2 ) .. '<br>' .. p.img( menu[1].n3 ) .. p.nom( menu[1].n3 ) .. '<br>' .. p.img( menu[1].n4 ) .. p.nom( menu[1].n4 ) .. '</p></td>'
_n = _n .. '<td><p>' .. p.img( menu[2].n1 ) .. p.nom( menu[2].n1 ) .. '<br>' .. p.img( menu[2].n2 ) .. p.nom( menu[2].n2 ) .. '<br>' .. p.img( menu[2].n3 ) .. p.nom( menu[2].n3 ) .. '<br>' .. p.img( menu[2].n4 ) .. p.nom( menu[2].n4 ) .. '</p></td>'
_n = _n .. '<td><p>' .. p.img( menu[3].n1 ) .. p.nom( menu[3].n1 ) .. '<br>' .. p.img( menu[3].n2 ) .. p.nom( menu[3].n2 ) .. '<br>' .. p.img( menu[3].n3 ) .. p.nom( menu[3].n3 ) .. '<br>' .. p.img( menu[3].n4 ) .. p.nom( menu[3].n4 ) .. '</p></td>'
_n = _n .. '<td><p>' .. p.img( menu[4].n1 ) .. p.nom( menu[4].n1 ) .. '<br>' .. p.img( menu[4].n2 ) .. p.nom( menu[4].n2 ) .. '<br>' .. p.img( menu[4].n3 ) .. p.nom( menu[4].n3 ) .. '<br>' .. p.img( menu[4].n4 ) .. p.nom( menu[4].n4 ) .. '</p></td>'
_n = _n .. '<td><p>' .. p.img( menu[5].n1 ) .. p.nom( menu[5].n1 ) .. '<br>' .. p.img( menu[5].n2 ) .. p.nom( menu[5].n2 ) .. '<br>' .. p.img( menu[5].n3 ) .. p.nom( menu[5].n3 ) .. '<br>' .. p.img( menu[5].n4 ) .. p.nom( menu[5].n4 ) .. '</p></td></tr></table>'
end
-- CATEGORIES
if Type.babiole then
_c = _c .. '[[Catégorie:Babioles]]'
end
if Type.boss then
_c = _c .. '[[Catégorie:Boss]]'
if Type.cavalierApocalypse then
_c = _c .. '[[Catégorie:Cavaliers de l\'Apocalypse]]'
end
end
if Type.carteSpeciale then
_c = _c .. '[[Catégorie:Cartes Spéciales]]'
end
if Type.challenge then
_c = _c .. '[[Catégorie:Challenges]]'
end
if Type.consommable then
_c = _c .. '[[Catégorie:Éléments interactifs]]'
end
if Type.etage then
end
if Type.homonymie then
end
if Type.itemPool then
end
if Type.machine then
end
if Type.miniBoss then
_c = _c .. '[[Catégorie:Objets Passifs]]'
if Type.pecheCapital then
_c = _c .. '[[Catégorie:Sept Péchés Capitaux]]'
elseif Type.superPecheCapital then
_c = _c .. '[[Catégorie:Sept Super Péchés Capitaux]]'
end
end
if Type.moddage then
end
if Type.modeJeu then
end
if Type.monstre then
end
if Type.objetActif then
_c = _c .. '[[Catégorie:Objets Actifs]]'
end
if Type.objetPassif then
_c = _c .. '[[Catégorie:Objets Passifs]]'
end
if Type.obstacle then
end
if Type.pageCollection then
end
if Type.personnage then
end
if Type.salle then
end
if Type.succes then
end
if Type.transformation then
_c = _c .. '[[Catégorie:Transformations]]'
end
if Type.version then
_c = _c .. '[[Catégorie:Versions]]'
end
-- LIEN INTERLANGUES
if lienEn ~= nil and lienEn ~= '' then
_n = _n .. '[[en:' .. lienEn .. ']]'
end
return _n .. _c .. _l
else
return _c
end
end
function p.nom( f )
local iconeDlc = ''
if f.dlc then
iconeDlc = dlc.icone( f.dlc )
end
if f.l then
return iconeDlc .. '[[' .. f.l .. '|' .. f.n .. ']]'
else
return iconeDlc .. f.n
end
end
function p.img( f )
if f.l then
return ' [[Image:' .. f.i .. '|lien=' .. f.l .. '|' .. f.n .. ']] '
else
return ' [[Image:' .. f.i .. '|lien=|' .. f.n .. ']] '
end
end
return p