Wikia

Módulo:Caja

local Case = {}
 
local messages = mw.loadData("Módulo:ACData")
 
function Case.render(frame)
 
  local numero = tonumber(frame.args[1])
  local image
  local nom_image = "caja.jpg"
  local lien = ""
 
  local case = mw.html.create("div")
    :addClass("caja")
    :addClass("dia" .. numero)
    :attr("data-day", numero)
    :attr("data-opened", 0)
 
  local currentdate = os.date("!*t")
 
  local currentmonth = currentdate.month -- 1-12
  local currentday = currentdate.day 
  local currentyear = currentdate.year
 
  if (currentmonth == 12 and currentday >= numero) or currentyear > 2014 then
    for i, v in ipairs(messages) do
      if v.day == numero then
        nom_image = v.image
        lien = v.link      
        do break end
      end
    end
 
    case:addClass("canopen")
  end
 
  case
   :tag("div")
   :addClass("numero")
   :wikitext(numero)
 
  image = "[[File:" .. nom_image .. "|80px|link=" .. lien .. "]]"
 
  case
   :tag("div")
   :addClass("ventana")
   :wikitext(image)
 
  case
   :tag("div")
   :addClass("coin")
 
  case:allDone()
 
  return case
 
end --fin Case.render()
 
return Case