Skip to content

wikipedia: toc tweaks by eccenux

Screenshot of wikipedia: toc tweaks

Details

Authoreccenux

LicenseCC-BY

Categorywikipedia, wikimedia

Created

Updated

Size1.4 kB

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

Add numbering to the ToC (Table of Contents) on Wikipedia, in new Vector 2022.

Notes

Userstyle doesn't have notes.

Source code

/* ==UserStyle==
@name         wikipedia: toc tweaks
@version      20230114.11.26
@namespace    userstyles.world/user/eccenux
@description  Add numbering to the ToC (Table of Contents) on Wikipedia, in new Vector 2022.
@author       eccenux
@license      CC-BY
==/UserStyle== */

@-moz-document domain("www.mediawiki.org"), regexp(".*//[a-z]+\\.wikipedia\\.org.*"), regexp(".*//[a-z]{1,5}\\.(wikimedia|wikisource)\\.org.*"), regexp(".*//commons.wikimedia.org.*") {
#mw-panel-toc ul {
    /* reset at the start of each level */
    counter-reset: tocsection -1;
    list-style-type: none;
}
#mw-panel-toc ul ul {
    counter-reset: tocsection 0;
}
#mw-panel-toc li::before {
    counter-increment: tocsection;
    /* combine values of each level with a period */
    content: counters(tocsection, ".") ". ";
    
    float: left;
    font-size: 0.875em;
    display: block;
    padding-top: 4px;
    padding-right: .3em;
}

/* modify first link (top link) */
/*
#mw-panel-toc > ul {
    counter-reset: tocsection -1;
}
*/
#mw-panel-toc > ul > li:first-of-type::before {
    display:none;
}

/* colors */
#mw-panel-toc ul a {
    color: #0645ad;
}

/* "Zawartość" *
.sidebar-toc .sidebar-toc-header {
    display: none;
}

/* adjust widths *
Should not be needed with Fixed top css.
/* width: 15.25em; *
/* max-width: 94.625em; *
.sidebar-toc {
    width: 19.25em;
}
.mw-page-container {
    max-width: 98.625em;
}
/**/

}

Reviews

No reviews yet.