Jump to content

User:Qwerfjkl/scripts/convertAbbreviations

From Wikipedia, the free encyclopedia

< Qwerfjkl's scripts | JS | Base template

This script gives a link under the "Tools" section in the left navigation bar, titled "Convert abbreviations". It only shows up during source editing (and won't work if syntax highlighting is enabled). It converts US state abbreviations found in tables to full names (using a regex search, which may have errors). You can put the column or table by itself in its own page section (or in a sandbox) temporarily, to prevent incorrect changes, or run it on the whole article. I recommend clicking "Show Changes" before publishing, to spot any mistakes.

convertAbbreviations
DescriptionScript for converting a column of US state abbreviations to full names
Author(s)Qwerfjkl
StatusStable
First releasedSeptember 11, 2022; 2 years ago (2022-09-11)
UpdatedSeptember 12, 2022; 2 years ago (2022-09-12)
SkinsVector 2022 (tested); other skins untested
SourceUser:Qwerfjkl/scripts/convertAbbreviations.js

Installation

[edit]

red-outlined triangle containing exclamation point Warning: You are not logged in. Please create an account or log in to proceed. After installing the script, bypass your cache.

Method 1

Click on the button below. If it doesn't appear after a few seconds you can enable script installer in the "Advanced" section of Special:Preferences#mw-prefsection-gadgets, or try this link.

Install Button
Method 2

This can only be used on the English Wikipedia.

  1. Place the following at the bottom of your common.js page or your skin.js page:
    importScript('User:Qwerfjkl/scripts/convertAbbreviations.js'); // [[User:Qwerfjkl/scripts/convertAbbreviations.js]]
    
  2. Press Publish changes (ignore any error warnings).
Method 3

This can be used on any Wikimedia project (for instance, globally in your global.js on the Meta-Wiki).

  1. Place the following on the bottom of your common.js page or your skin.js page:
    mw.loader.load('https://en.wikipedia.org/w/index.php?title=User%3AQwerfjkl%2Fscripts%2FconvertAbbreviations.js&action=raw&ctype=text/javascript'); // [[User:Qwerfjkl/scripts/convertAbbreviations.js]]
    
  2. Press Publish changes (ignore any error warnings).