IMSLP Expand Composition Information

Expands composition information in the IMSLP library.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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        IMSLP Expand Composition Information
// @namespace   https://github.com/Enchoseon/enchos-assorted-userscripts/raw/main/imslp-expand-composition-information.user.js
// @version     1.0.3
// @description Expands composition information in the IMSLP library.
// @author      Enchoseon
// @include     *imslp.org*
// @run-at      document-end
// @grant       none
// ==/UserScript==

(function() {
    "use strict";
    // ==============================
    // Expand Composition Information
    // ==============================
    expandCompositionInformation();
    document.getElementById("cathassecselp1").addEventListener("click", function (event) {
        expandCompositionInformation();
    }, true);
    function expandCompositionInformation() {
        Object.values(document.getElementById("mw-pages").getElementsByTagName("li")).forEach((elem) => {
            elem.dispatchEvent(new Event("mouseover"));
            window.addEventListener("mouseout", function (event) {
                event.stopPropagation();
            }, true);
        });
    }
    // ============
    // Style Tweaks
    // ============
    const css = `
        .showHSList a {
            font-weight: bold;
        }
    `;
    var s = document.createElement("style");
    s.setAttribute("type", "text/css");
    s.appendChild(document.createTextNode(css));
    document.getElementsByTagName("head")[0].appendChild(s);
})();