Always small font on Wikimedia websites

Automatically selects the Small font for the text on Wikipedia, Wikiquote and MediaWiki, bringing the size back to how it used to be and irrespective of whether cookies are enabled.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Always small font on Wikimedia websites
// @namespace
// @match       https://*.wikipedia.org/*
// @match       https://*.wikiquote.org/*
// @match       https://www.mediawiki.org/*
// @grant       none
// @version     1.2
// @author      Rose
// @description Automatically selects the Small font for the text on Wikipedia, Wikiquote and MediaWiki, bringing the size back to how it used to be and irrespective of whether cookies are enabled.
// @namespace https://greasyfork.org/users/1023939
// ==/UserScript==

(function() {
    'use strict';

    // Function to set the text size to "Small"
    function setTextSizeToSmall() {
        // Check if the page has the necessary elements
        const sizeRadio = document.querySelector('#skin-client-pref-vector-feature-custom-font-size-value-0');
        if (sizeRadio) {
            // Set the "Small" radio button to checked
            sizeRadio.checked = true;

            // Trigger a change event on the radio button
            const changeEvent = new Event('change');
            sizeRadio.dispatchEvent(changeEvent);
        }
    }

    // Function to wait for the necessary element to appear
    function waitForElement() {
        const FontSizeBox = document.querySelector('#skin-client-prefs-vector-feature-custom-font-size');
        if (FontSizeBox) {
            setTextSizeToSmall();
        } else {
            requestAnimationFrame(waitForElement);
        }
    }

    // Run the waitForElement function when the page loads
    window.addEventListener('load', waitForElement);
})();