FANDOM


-- This module is used by Template:Episode to create navigation links
-- to the previous and next episodes based on the release number.
-- e.g. Ep.2-164 is release #272
-- 
-- See Module:EpisodeLink for the explanation of release/episode numbers.
 
local p = {}
 
function p.GetNav( frame )
    local LATEST_NAVER = 314         -- Update this on Wednesdays - most recent episode #
    local direction = frame.args[1]  -- default is "prev"
    local release = frame.args[2]
    local LinkNumber = 0
    local LinkTxt = "Something went wrong."
 
    -- Get the link number.
    LinkNumber = tonumber( release )
 
    -- Decide if we're going backward or forward.
    if (direction == "next") then LinkNumber = LinkNumber + 1
    else LinkNumber = LinkNumber - 1
    end
 
    -- No prev for Episode 0 / No next for LATEST_NAVER
    if     (LinkNumber == 0)            then LinkTxt = "None"
    elseif (LinkNumber > LATEST_NAVER) then LinkTxt = "TBA"
 
    -- Deal with the special episodes (without a season/ep. name) next.
    elseif (LinkNumber == 34)  then LinkTxt = "[[Extra: The Daily Life of Gu Bera No. 1]]"
    elseif (LinkNumber == 53)  then LinkTxt = "[[Extra: The Daily Life of Gu Bera No. 2]]"
    elseif (LinkNumber == 72)  then LinkTxt = "[[Extra: The Daily Life of Gu Bera No. 3]]"
    elseif (LinkNumber == 105) then LinkTxt = "[[Extra: Season 1 Epilogue]]"
    elseif (LinkNumber == 157) then LinkTxt = "[[Extra: Q&A Special No. 1]]"
    elseif (LinkNumber == 208) then LinkTxt = "[[Extra: Q&A Special No. 2]]"
    elseif (LinkNumber == 273) then LinkTxt = "[[Extra: Punishment]]"
    elseif (LinkNumber == 290) then LinkTxt = "[[Extra: Season 2 Epilogue]]"
 
    -- Season 1 episodes
    elseif (LinkNumber <= 104) then
        if     (LinkNumber < 34)  then LinkNumber = LinkNumber - 1
        elseif (LinkNumber < 53)  then LinkNumber = LinkNumber - 2
        elseif (LinkNumber < 72)  then LinkNumber = LinkNumber - 3
        else                           LinkNumber = LinkNumber - 4
        end
        LinkTxt = "[[Episode " .. LinkNumber .. "]]"
 
    -- Season 2 episodes
    elseif (LinkNumber <=290) then
        if     (LinkNumber < 157) then LinkNumber = LinkNumber - 106
        elseif (LinkNumber < 208) then LinkNumber = LinkNumber - 107
        elseif (LinkNumber < 273) then LinkNumber = LinkNumber - 108
        else                           LinkNumber = LinkNumber - 109
        end
        LinkTxt = "[[Episode 2-" .. LinkNumber .. "]]"
 
    -- Season 3 episodes
    else
        LinkNumber = LinkNumber - 291
        LinkTxt = "[[Episode 3-" .. LinkNumber .. "]]"
    end
 
    return LinkTxt
end
 
return p
--[[Category:Lua modules]]

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.