https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ASports_color%2Fsandbox
Module:Sports color/sandbox - Revision history
2025-06-28T19:33:43Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.7
https://en.wikipedia.org/w/index.php?title=Module:Sports_color/sandbox&diff=1218745168&oldid=prev
Andrybak: sync
2024-04-13T15:39:18Z
<p>sync</p>
<a href="//en.wikipedia.org/w/index.php?title=Module:Sports_color/sandbox&diff=1218745168&oldid=849370071">Show changes</a>
Andrybak
https://en.wikipedia.org/w/index.php?title=Module:Sports_color/sandbox&diff=849370071&oldid=prev
Frietjes: Frietjes moved page Module:Basketball color/sandbox to Module:Sports color/sandbox without leaving a redirect: per TfD
2018-07-08T14:16:24Z
<p>Frietjes moved page <a href="/w/index.php?title=Module:Basketball_color/sandbox&action=edit&redlink=1" class="new" title="Module:Basketball color/sandbox (page does not exist)">Module:Basketball color/sandbox</a> to <a href="/wiki/Module:Sports_color/sandbox" title="Module:Sports color/sandbox">Module:Sports color/sandbox</a> without leaving a redirect: per TfD</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 14:16, 8 July 2018</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Frietjes
https://en.wikipedia.org/w/index.php?title=Module:Sports_color/sandbox&diff=689820133&oldid=prev
Vasconia at 16:34, 9 November 2015
2015-11-09T16:34:00Z
<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 16:34, 9 November 2015</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- This module implements</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- This module implements</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_3_0_lhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_1_0_rhs"></a>-- {{<ins style="font-weight: bold; text-decoration: none;">Basketball</ins> leagues color}}, {{<ins style="font-weight: bold; text-decoration: none;">Basketball</ins> color cell}}, {{<ins style="font-weight: bold; text-decoration: none;">Basketball</ins> color cell2}},</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{NBA color}}, {{NBA color cell}}, {{NBA color cell2}}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{NBA color}}, {{NBA color cell}}, {{NBA color cell2}}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{Euroleague color}}, {{Euroleague color cell}}, {{Euroleague color cell2}}, </div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{Euroleague color}}, {{Euroleague color cell}}, {{Euroleague color cell2}}, </div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{NBL colour}}, {{NBL colour cell}}, {{NBL colour cell2}},</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{NBL colour}}, {{NBL colour cell}}, {{NBL colour cell2}},</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{PBA color}}, {{PBA color cell}}, {{PBA color cell2}},</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{PBA color}}, {{PBA color cell}}, {{PBA color cell2}},</div></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_0_rhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_3_0_lhs"></a>-- {{<del style="font-weight: bold; text-decoration: none;">European</del> leagues color}}, {{<del style="font-weight: bold; text-decoration: none;">European leagues</del> color cell}}, {{<del style="font-weight: bold; text-decoration: none;">European leagues</del> color cell2}},</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{KBL color}}, {{KBL color cell}}, {{KBL color cell2}}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- {{KBL color}}, {{KBL color cell}}, {{KBL color cell2}}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--</div></td>
</tr>
</table>
Vasconia
https://en.wikipedia.org/w/index.php?title=Module:Sports_color/sandbox&diff=656305896&oldid=prev
Frietjes: sandbox version for experiments
2015-04-13T18:02:24Z
<p>sandbox version for experiments</p>
<p><b>New page</b></p><div>--<br />
-- This module implements<br />
-- {{NBA color}}, {{NBA color cell}}, {{NBA color cell2}}<br />
-- {{Euroleague color}}, {{Euroleague color cell}}, {{Euroleague color cell2}}, <br />
-- {{NBL colour}}, {{NBL colour cell}}, {{NBL colour cell2}},<br />
-- {{PBA color}}, {{PBA color cell}}, {{PBA color cell2}},<br />
-- {{European leagues color}}, {{European leagues color cell}}, {{European leagues color cell2}},<br />
-- {{KBL color}}, {{KBL color cell}}, {{KBL color cell2}}<br />
--<br />
local p = {}<br />
<br />
local data_module = "Module:Basketball color/data/sandbox"<br />
<br />
local function stripwhitespace(text)<br />
return text:match("^%s*(.-)%s*$")<br />
end<br />
<br />
local function get_colors(team, unknown)<br />
team = stripwhitespace(team or '')<br />
unknown = unknown or {"DCDCDC", "000000", "000000", "FFFFFF"}<br />
<br />
local use_default = {<br />
[""] = 1,<br />
["retired"] = 1,<br />
["free agent"] = 1,<br />
}<br />
<br />
local colors = nil<br />
<br />
if ( team and use_default[team:lower()] ) then<br />
colors = {"DCDCDC", "000000", "000000", "FFFFFF"}<br />
else<br />
local all_colors = mw.loadData(data_module)<br />
colors = all_colors[team]<br />
if ( colors and type(colors) == 'string' ) then<br />
colors = all_colors[colors]<br />
end<br />
end<br />
<br />
return colors or unknown<br />
end<br />
<br />
local function team_color(team, num)<br />
local colors = get_colors(team, nil)<br />
<br />
num = tonumber(num:match('[1-4]') or '0')<br />
if ( num ) then<br />
return colors[num]<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
local function team_colorcell(team, borderwidth, bg, fg, bd)<br />
local colors = get_colors(team, nil)<br />
local border = ''<br />
borderwidth = borderwidth or ''<br />
<br />
if (borderwidth ~= '') then<br />
border = 'border:' .. borderwidth .. 'px solid #' .. stripwhitespace(colors[bd]) .. ';'<br />
end<br />
<br />
return 'background-color:#' .. stripwhitespace(colors[bg]) .. ';color:#' .. stripwhitespace(colors[fg]) .. ';' .. border<br />
end<br />
<br />
local function team_check(team, unknown)<br />
local colors = get_colors(team, unknown)<br />
if type(colors) == 'table' then<br />
return 'known'<br />
else<br />
return unknown<br />
end<br />
end<br />
<br />
local function team_testtable(args, style, data)<br />
local teamlist = {}<br />
if ( data ) then data_module = data end<br />
<br />
-- helper function<br />
local function table_row(t, c)<br />
local res = mw.html.create('')<br />
if( c[1] and c[2] and c[3] and c[4] ) then<br />
res:tag('td'):wikitext(t)<br />
else<br />
res:tag('td'):wikitext(t .. ' <span class=error>ERROR</span>')<br />
end<br />
for i=1,4 do<br />
res:tag('td'):css('background-color', '#' .. stripwhitespace(c[i] or 'ERROR'))<br />
end<br />
<br />
return tostring(res)<br />
end<br />
<br />
-- list of teams<br />
if( args and args[1] ) then<br />
for k, team in pairs(args) do<br />
if type(k) == 'number' then<br />
table.insert(teamlist, team)<br />
end<br />
end<br />
else<br />
local all_colors = mw.loadData(data_module)<br />
for team, colors in pairs( all_colors ) do<br />
table.insert(teamlist, team)<br />
end<br />
table.sort(teamlist)<br />
table.insert(teamlist, 'Free agent')<br />
table.insert(teamlist, 'Retired')<br />
end<br />
<br />
-- build table<br />
local root = mw.html.create('table')<br />
root:addClass('wikitable sortable')<br />
:css('font-size', '90%')<br />
:css('line-height', '100%')<br />
:cssText(style)<br />
local row = root:tag('tr')<br />
row:tag('th'):wikitext('Team')<br />
for i=1,4 do<br />
row:tag('th')<br />
:addClass('unsortable')<br />
:wikitext(i)<br />
end<br />
for k, team in pairs( teamlist ) do<br />
row = root:tag('tr')<br />
row:wikitext(table_row(team, get_colors(team)))<br />
end<br />
<br />
return tostring(root)<br />
end<br />
<br />
function p.color(frame)<br />
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args<br />
return team_color(args[1] or '', args[2] or '')<br />
end<br />
<br />
function p.colorcell(frame)<br />
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args<br />
return team_colorcell(args[1] or '', args['border'] or '', 1, 2, 3)<br />
end<br />
<br />
function p.colorcell2(frame)<br />
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args<br />
return team_colorcell(args[1] or '', args['border'] or '', 3, 4, 1)<br />
end<br />
<br />
function p.check(frame)<br />
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args<br />
return team_check(args[1] or '', args[2] or '')<br />
end<br />
<br />
function p.testtable(frame)<br />
return team_testtable((frame.args[1] ~= nil) and frame.args or frame:getParent().args, frame.args['style'] or '', frame.args['data'])<br />
end<br />
<br />
return p</div>
Frietjes