User:Alex 21/script-episodetable
User:Alex 21/script-episodetable.js is a script that transforms a raw-code episode table header for television series to the templated version {{Episode table}}, including suggested widths in the template code, based on averages of widths automatically calculated by HTML. This allows for proper tracking of accessibility issues through Category:Articles using Template:Episode table with invalid colour combination.
Installation
[edit]To install the script, add:
importScript('User:Alex 21/script-functions.js'); importScript('User:Alex 21/script-episodetable.js');
>>> User:Alex 21/script-functions.js is required to include multiple shared functions, and the custom "TV Scripts" header, many of which are used identically in a few of my other scripts - you only need to include it in Special:MyPage/common.js once. Follow the instructions at User:Alex 21/script-functions for installing scripts by Alex 21. <<<
There will be a "Episode table" link in the toolbox on the left on every article. This script gathers all of the episode tables on the page by specifically searching for episode lists and retrieving the table from that, and converting to {{Episode table}}. It also adds suggested widths into the templated code, based on averages of widths automatically calculated by HTML; these widths are also dynamically edited into the existing tables so that you can view how the widths will set before you implement the edits. (Note: There may be inaccurate estimations of the widths if tables for specials are also included that do not conform to the season tables. To fix this, edit the Episodes section, click Preview, and use the script then.)
Click the "Episode table" link to convert the tabular overview to the template, which will be saved in your clipboard - you will be directed to the edit page. Once in edit mode, pasted the copied episode table header over the raw code, making sure that you replace the original table's ending |}
with }}
to close the template, manually replacing references as you do so (the template automatically gives the parameters for the references). Save the page.
To calculate the optimum widths for tables that already have preset widths (as opposed to tables that do not include set widths), hold down your computer's "control" key when pressing the "Episode table" link in the left hand side toolbox. This resets the widths of the table columns to be unset, and calculates the optimum widths from the unset-width columns.
Bugs
[edit]Please report any bugs on the talk page of the script's creator.