User:SD0001/shortdescs-in-category

shortdescs-in-category
Short descriptions in a category
DescriptionShow short descriptions of pages while browsing categories
Author(s)SD0001
UpdatedFebruary 20, 2022
    (2 years ago)
Skin supportAll desktop skins
SourceUser:SD0001/shortdescs-in-category.js

This script gives a Show SDs button at the top of the list of pages in a category. On clicking, short descriptions of all pages in view are displayed.

Colour codes:

  • black - local short description
  • pink - wikidata description
  • red ("no shortdesc") - no shortdesc present locally or on wikidata.

To tweak the color codes to your liking, see #Customisation below.

Installation edit

If you have the script-installer gadget, just click on the "Install" button in the infobox.

Otherwise, add the line

importScript('User:SD0001/shortdescs-in-category.js'); // [[User:SD0001/shortdescs-in-category.js]]

on your common.js or skin.js page.

Usage edit

If the category contains talk pages (such as in WikiProject classification categories), the short description of the article is shown (not that of the talk page).

Customisation edit

Customisations can be done by adding statements to your common.css page.

  • Hide display of the red "– no shortdesc" (for pages that have no description)
.cat-shortdesc-none { display: none; }
  • Change the colors:
.cat-shortdesc-none { color: red !important; }
.cat-shortdesc-local { color: black !important; }
.cat-shortdesc-wikidata { color: MediumVioletRed !important; }
The default colors are the ones mentioned above. You can also specify colors like rgb(255, 99, 71) and #ff6347. You may find W3C CSS Colors helpful.

See also edit