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&amp;diff=1218745168&amp;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&amp;action=edit&amp;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">&#x26AB;</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">&#x26AB;</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 = &quot;Module:Basketball color/data/sandbox&quot;<br /> <br /> local function stripwhitespace(text)<br /> return text:match(&quot;^%s*(.-)%s*$&quot;)<br /> end<br /> <br /> local function get_colors(team, unknown)<br /> team = stripwhitespace(team or &#039;&#039;)<br /> unknown = unknown or {&quot;DCDCDC&quot;, &quot;000000&quot;, &quot;000000&quot;, &quot;FFFFFF&quot;}<br /> <br /> local use_default = {<br /> [&quot;&quot;] = 1,<br /> [&quot;retired&quot;] = 1,<br /> [&quot;free agent&quot;] = 1,<br /> }<br /> <br /> local colors = nil<br /> <br /> if ( team and use_default[team:lower()] ) then<br /> colors = {&quot;DCDCDC&quot;, &quot;000000&quot;, &quot;000000&quot;, &quot;FFFFFF&quot;}<br /> else<br /> local all_colors = mw.loadData(data_module)<br /> colors = all_colors[team]<br /> if ( colors and type(colors) == &#039;string&#039; ) 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(&#039;[1-4]&#039;) or &#039;0&#039;)<br /> if ( num ) then<br /> return colors[num]<br /> else<br /> return &#039;&#039;<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 = &#039;&#039;<br /> borderwidth = borderwidth or &#039;&#039;<br /> <br /> if (borderwidth ~= &#039;&#039;) then<br /> border = &#039;border:&#039; .. borderwidth .. &#039;px solid #&#039; .. stripwhitespace(colors[bd]) .. &#039;;&#039;<br /> end<br /> <br /> return &#039;background-color:#&#039; .. stripwhitespace(colors[bg]) .. &#039;;color:#&#039; .. stripwhitespace(colors[fg]) .. &#039;;&#039; .. border<br /> end<br /> <br /> local function team_check(team, unknown)<br /> local colors = get_colors(team, unknown)<br /> if type(colors) == &#039;table&#039; then<br /> return &#039;known&#039;<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(&#039;&#039;)<br /> if( c[1] and c[2] and c[3] and c[4] ) then<br /> res:tag(&#039;td&#039;):wikitext(t)<br /> else<br /> res:tag(&#039;td&#039;):wikitext(t .. &#039; &lt;span class=error&gt;ERROR&lt;/span&gt;&#039;)<br /> end<br /> for i=1,4 do<br /> res:tag(&#039;td&#039;):css(&#039;background-color&#039;, &#039;#&#039; .. stripwhitespace(c[i] or &#039;ERROR&#039;))<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) == &#039;number&#039; 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, &#039;Free agent&#039;)<br /> table.insert(teamlist, &#039;Retired&#039;)<br /> end<br /> <br /> -- build table<br /> local root = mw.html.create(&#039;table&#039;)<br /> root:addClass(&#039;wikitable sortable&#039;)<br /> :css(&#039;font-size&#039;, &#039;90%&#039;)<br /> :css(&#039;line-height&#039;, &#039;100%&#039;)<br /> :cssText(style)<br /> local row = root:tag(&#039;tr&#039;)<br /> row:tag(&#039;th&#039;):wikitext(&#039;Team&#039;)<br /> for i=1,4 do<br /> row:tag(&#039;th&#039;)<br /> :addClass(&#039;unsortable&#039;)<br /> :wikitext(i)<br /> end<br /> for k, team in pairs( teamlist ) do<br /> row = root:tag(&#039;tr&#039;)<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 &#039;&#039;, args[2] or &#039;&#039;)<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 &#039;&#039;, args[&#039;border&#039;] or &#039;&#039;, 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 &#039;&#039;, args[&#039;border&#039;] or &#039;&#039;, 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 &#039;&#039;, args[2] or &#039;&#039;)<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[&#039;style&#039;] or &#039;&#039;, frame.args[&#039;data&#039;])<br /> end<br /> <br /> return p</div> Frietjes