Module:LNDB

local p = {} local nxb_dengeki = mw.loadData( 'Module:LNDB/Dengeki' ) local nxb_fantasia = mw.loadData( 'Module:LNDB/Fantasia' ) local nxb_sneaker = mw.loadData( 'Module:LNDB/Sneaker' )

local _header = "font-weight:bold;text-align:left;color:white;padding:0.75em 1.5em;" local _id = "font-size:95%;font-style:italic;padding:0.75em 1.5em;" local _title = "width:350px;font-size:95%;font-style:italic;padding:0.75em 1.5em;" local _personnel = "width:150px;font-size:95%;font-style:italic;padding:0.75em 1.5em;" local _list = {} local _tablestart = "\" local _tableend = "\"

local function _generatetable(frame) local count = 0 local id, title, author, illustrator, header, sheader local rows = {} --   --Get Time Query-- --   timestamp = tostring(frame.timestamp) ---   --Get Publisher Query-- ---   pub = tostring(frame.publisher)

-   --Dengeki Bunko-- -   if (pub == "dengeki") then for k, v in spairs(nxb_dengeki) do           if nxb_dengeki[k].d == timestamp then _list[#_list+1] = nxb_dengeki[k] end end sheader = "background:linear-gradient(#3c3c3c,black);background: -moz-linear-gradient(#3c3c3c,black);background: -o-linear-gradient(#3c3c3c,black);background: -webkit-linear-gradient(#3c3c3c,black);".._header end --   --Fantasia Bunko-- --   if (pub == "fantasia") then for k, v in spairs(nxb_fantasia) do           if nxb_fantasia[k].d == timestamp then _list[#_list+1] = nxb_fantasia[k] end end sheader = "background:linear-gradient(#e13131,brown);background: -moz-linear-gradient(#e13131,brown);background: -o-linear-gradient(#e13131,brown);background: -webkit-linear-gradient(#e13131,brown);".._header end -   --Sneaker Bunko-- -   if (pub == "sneaker") then for k, v in spairs(nxb_sneaker) do           if nxb_sneaker[k].d == timestamp then _list[#_list+1] = nxb_sneaker[k] end end sheader = "background:linear-gradient(#ffe401,#f47100);background: -moz-linear-gradient(#ffe401,#f47100);background: -o-linear-gradient(#ffe401,#f47100);background: -webkit-linear-gradient(#ffe401,#f47100);".._header end header = "\\#\\Tác phẩm\\Tác giả\\Minh họa\" --Application Code-- for k, v in spairs(_list) do       count = count + 1 if (count % 2 ==0) then id = "\"..count.."\" title = "\".._list[k].tr.."\" author = "\".._list[k].ar.."\</td\>" illustrator = "\<td style='background:#f6f6f6;".._personnel.."'\>".._list[k].ir.."\</td\>" else id = "\<td style='background:#e9e9e9;".._id.."'\>"..count.."\</td\>" title = "\<td style='background:#e9e9e9;".._title.."'\>".._list[k].tr.."\</td\>" author = "\<td style='background:#e9e9e9;".._personnel.."'\>".._list[k].ar.."\</td\>" illustrator = "\<td style='background:#e9e9e9;".._personnel.."'\>".._list[k].ir.."\</td\>" end rows[#rows+1] = "\<tr onmouseover='this.style.fontWeight=\'bold\'\"\>"..id..title..author..illustrator.."\</tr\>"   end    return _tablestart..header..table.concat(rows,'').._tableend end

function spairs(t) local keys = {} for k in pairs(t) do keys[#keys+1] = k end table.sort(keys) local i = 0 return function i = i + 1 if keys[i] then return keys[i], t[keys[i]] end end end

function p.dengeki(frame) --arg = {timestamp=frame.args[1],publisher='dengeki'} --return _generatetable(arg) tmp = "onmouseover=\"this.style.fontWeight=\'bold\'\"" return tmp end

function p.fantasia(frame) arg = {timestamp=frame.args[1],publisher='fantasia'} return _generatetable(arg) end

function p.sneaker(frame) arg = {timestamp=frame.args[1],publisher='sneaker'} return _generatetable(arg) end

return p