Jump to content

User:Ohconfucius/script/flagcruft

From Wikipedia, the free encyclopedia

Preamble

[edit]

This tool was developed for my own personal use to speedily removing swathes of abused icons, it may help you to pare back extreme instances of over reliance on flags in a single manipulation.

Within-article consistency of formatting

By long-standing convention and as detailed at the Manual of Style, a Wikipedia article needs to use consistent formatting. Despite there being long standing guidelines as to their use, flag icons are much abused within Wikipedia. Users, particularly in sporting and political fields, are wont to plaster certain articles with so many tiny flag icons that it's difficult to make sense of which country they are meant to refer to, or what they mean.

  • There is, for example, no benefit to using flags (and flags only) to give the location of a stadium where a match was played, as was done here, or where a tournament was hosted, as here.
  • Using flags for team managers' nationalities (as here and here) is irrelevant at best.

Caveat

[edit]
  • The script should be used with care. Its use may provoke ire or controversy because many editors seem anchored to the aesthetic appeal of those coloured rectangles dotted all over a page and the security that these may impart. Some cite familiarity with flag use on some external websites and seeking to apply them here.
  • It may not be appropriate to simply sweep away all flag icons, some icons may need to be replaced with the country name. Thus there are instances where different sections of an article may require separate treatment, or the use of the two script buttons in different combinations (see this series of edits).

Functions

[edit]

Functions performed include:

  • remove bare flag images, denoted by the syntax "[[File:Flag of Country.svg|[23]px..." or "[[Image:Flag of Country.svg|[23]px...", and trailing space (if any)
  • Removes flag icons that rely on the {{flagicon}} template
  • Replaces flag icons with the corresponding country name without wikilink
  • Where required, the script will decode the ISO 3166-1 alpha-3 associated with the flag (and most commonly used 3-lettered abbreviations) and give the country name.

Installing the script

[edit]
  1. Open your common.js in edit mode (alternatively, go to your user page and append "/common.js" to the end of the URL and open the page in edit mode).
    • If you prefer to load this only on a specific skin, such as monobook, open your monobook.js in edit mode.
    • If you make a straight copy of this script, instead of "importing" it, you may not benefit from the enhancements and bug-fixes that are made from time to time. In the latter case, you may choose to watchlist this page so you will know when to update your copy for modifications to this script.
  2. Copy the following code onto the JavaScript page you have chosen in the previous step:
    importScript('User:Ohconfucius/script/flagcruft.js'); // [[User:Ohconfucius/script/flagcruft.js]]
    
  3. Save the page and (re-)load it – refresh the cache by following the instructions at the top of your JavaScript page.
  4. Bookmark the script page. This will be your cue to purge the cache on your browser for any updates to take effect.

Disclaimer: Use at your own risk and make sure you check the edit changes before you save.

Actions

[edit]

Once you are in edit mode, there is a button in the toolbox in the left margin

  • FLAGCRUFT function – Removes flag icons and blanks icons called by the |nat= or |clubnat= parameters within certain templates.
  • FLAG->COUNTRY function – Removes flag icons, replaces with the corresponding country name without wikilink.

Miniature flag icons called by other sporting templates that link to national sporting/team articles should not be affected

Bug reports

[edit]

Feedback is appreciated at User talk:Ohconfucius/script. Please report false negatives as well as false positives.

Essays

[edit]

See also

[edit]