Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:NFL Draft
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- this module implements -- [[Template:NFLDraft-row]] -- [[Template:NFLDraft-header]] -- [[Template:NFLDraft-footer]] local p = {} local afbpositions = require('Module:American football positions')._main local yesno = require('Module:Yesno') local row_colors = { ["compensatory"] = "d9e9f9", ["supplemental"] = "ffdddd", ["expansion"] = "a9f5d0", ["resolution"] = "ccf9cc" } local doubledagger = "[[File:Double-dagger-14-plain.png|alt=double-dagger|link=]]" local function anchor(value) if value and value ~= '' then return '<span class="anchor" id="' .. value .. '"></span>' end return '' end local function sortname(first, last, link, nolink) last = last or '' first = first or '' link = link or '' local name = first .. ' ' .. last if not (nolink or (first == '-') or (last == '-')) then if link ~= '' then name = '[[' .. link .. '|' .. name .. ']]' else name = '[[' .. name .. ']]' end end name = '<span class=vcard><span class=fn>' .. name .. '</span></span>' return '<span data-sort-value="' .. mw.text.encode(last .. ',' .. first) .. ">" .. name .. '</span>' end local function get_round_color(round, numrounds) -- make sure numbers are within bounds round = tonumber(round) or -1 numrounds = tonumber(numrounds) or 7 numrounds = numrounds < 7 and 7 or numrounds numrounds = numrounds > 32 and 32 or numrounds -- linear color scale from F00 to F0A local c = {"F00", "F30", "F50", "F80", "FB0", "FE0", "FF0", "CF0", "9F0", "6F0", "4F0", "1F0", "0F1", "0F4", "0F6", "0F9", "0FC", "0FF", "0EF", "0BF", "08F", "05F", "03F", "00F", "20F", "50F", "70F", "A0F", "D0F", "F0F", "F0D", "F0A"} -- affine map from [1, numrounds] to [1, #c] local r = math.floor(1.5 + (round - 1) * (#c - 1) / (numrounds - 1)) return c[r] or "fff" end function p._row(args) local rowtype = 'none' for k,v in ipairs({'resolution', 'expansion', 'supplemental', 'compensatory'}) do if yesno(v) then rowtype = v end end local rowcolor = row_colors[rowtype] local root = {} local txt = '' table.insert(root,'|-' .. (rowcolor and 'style="background:#' .. rowcolor .. '"' or '')) if not yesno(args['undrafted']) then local pickstyle = 'text-align:center;' table.insert(root,'|style="background:#' .. get_round_color(args['round'], args['numberofrounds']) .. '"|') txt = (args['round'] or '{{{round}}}') if yesno(args['firstpickinround']) then txt = txt .. anchor('Round_' .. (args['round'] or '')) end if yesno(args['compensatory']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. '*' pickstyle = pickstyle .. 'background-color:unset;' elseif yesno(args['supplemental']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. '^' pickstyle = pickstyle .. 'background-color:unset;' elseif yesno(args['expansion']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. 'Β€' pickstyle = pickstyle .. 'background-color:unset;' elseif yesno(args['resolution']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. 'Γ' pickstyle = pickstyle .. 'background-color:unset;' else txt = '! ' .. txt end table.insert(root,txt) txt = args['picknum'] or '{{{picknum}}}' if tonumber(txt) == 1 then txt = '[[List of first overall National Football League draft picks|1]]' elseif tonumber(txt) == 2 then txt = '[[List of second overall National Football League draft picks|1]]' elseif yesno(args['lastpick']) then txt = '[[Mr. Irrelevant|' .. txt ']]' end txt = anchor('Pick_' .. (args['picknum'] or '')) .. txt table.insert(root,'!scope=row style="font-weight:bold;' .. pickstyle .. '"|' .. txt) end txt = args['team'] or '{{{team}}}' if args['draftyear'] then txt = '[[' .. args['draftyear'] .. ' ' .. (args['teamdab'] or txt) .. ' season|' .. txt .. ']]' elseif args['teamdab'] then txt = '[[' .. args['teamdab'] .. '|' .. args['team'] .. ']]' end table.insert(root,'| ' .. txt) txt = '' if args['last'] then local style = '' local name = sortname(args['first'], args['last'], args['dab'], (args['playerpageexists'] == 'no') and 1 or nil) .. (yesno(args['hof']) and doubledagger or '') .. (yesno(args['probowl']) and '<sup>β </sup>' or '') if yesno(args['hof']) then style = 'style="background:#FFCC00"|' elseif yesno(args['probowl']) then style = 'style="background:#faecc8"|' end txt = style .. name end table.insert(root,'|' .. txt) txt = '' if args['position'] then txt = afbpositions(args['position'], false) if args['position2'] then txt = txt .. '/' .. afbpositions(args['position2'], false) end end table.insert(root,'| ' .. txt) txt = '' if args['college'] and args['college']:lower() ~= 'university' then if args['collegelink'] then if yesno(args['cfb page exists']) then txt = '[[' .. (args['collegeyear'] or '{{{collegeyear}}}') .. ' ' .. (args['collegeteam'] or '') .. ' football team|' .. args['collegelink'] .. ']]' else txt = mw.getCurrentFrame():expandTemplate{ title = 'cfb link', args = { ['year'] = args['collegeyear'] or '{{{collegeyear}}}', ['team'] = args['collegeteam'] or '{{{collegeteam}}}', ['school'] = args['college'] or '{{{college}}}', ['title'] = args['collegelink'] or '{{{collegelink}}}' } } end else txt = '[[' .. args['college'] .. ']]' end end table.insert(root,'| ' .. txt) txt = '' if args['college'] and args['college']:lower() ~= 'university' then if args['conference'] then txt = args['conference'] else local cfbconf = require('Module:College football conference')._main txt = cfbconf(args['collegeyear'], args['college']) end txt = 'style="text-align:center"|' .. txt end table.insert(root,'|' .. txt) txt = '' if args['note'] then txt = '<small>' .. args['note'] .. '</small>' end table.insert(root,'|' .. txt) return table.concat(root, '\n') end local function abbr(a, d) return '<abbr title="' .. d .. '">' .. a .. '</abbr>' end function p._header(args) local root = {} local style = 'scope=col style="background:#A8BDEC;%s"' table.insert(root, '<span></span>\n{| class="wikitable sortable plainrowheaders" border="1"') if args['caption'] then table.insert(root, '|+ ' .. args['caption']) end table.insert(root, '|-') local cstyle = string.format(style,'width:3px;') local pstyle = string.format(style, '') local nstyle = string.format(style, args['noteswidth'] and 'width:' .. args['noteswidth'] .. ';' or '') local oteam if not yesno(args['undrafted']) then table.insert(root, '! ' .. cstyle .. ' class="unsortable" |') table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Rnd.', 'Draft round')) table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Pick No.', 'Overall selection number')) oteam = abbr('NFL team', 'Team which made selection') else oteam = abbr('Original NFL team', 'Team which signed the player after the draft') end table.insert(root, '! ' .. pstyle .. ' | ' .. oteam) table.insert(root, '! ' .. pstyle .. ' | Player') table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Pos.', 'Football position played')) table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('College', 'Most recent college attended')) table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Conf.', 'Athletic conference of most recent college')) table.insert(root, '! ' .. nstyle .. ' class="unsortable" | Notes') table.insert(root, '|-') return table.concat(root, '\n') end function p._footer() return '|-\n|}' end function p.row(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return p._row(args) end function p.header(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return p._header(args) end function p.footer(frame) return p._footer() end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Lua
(
edit
)
Template:Sandbox other
(
edit
)
Module:NFL Draft/doc
(
edit
)
Module:String
(
edit
)