Fill in profile pictures in the Family Section

None

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         Fill in profile pictures in the Family Section
// @namespace    https://github.com/nate-kean/
// @version      20251106
// @description  None
// @author       Nate Kean
// @match        https://jamesriver.fellowshiponego.com/members/view/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=fellowshiponego.com
// @grant        none
// @license      MIT
// @run-at       document-end
// ==/UserScript==

(function() {
    for (const initial of document.querySelectorAll(".family-panel div.user-initials")) {
        const pictureLink = document.createElement("a");
        const holder = initial.parentNode;
        const entry = holder.parentNode;
        const link = entry.querySelector(`
            div.family-item-details > p:first-of-type > a,
            div:nth-child(3) > p:first-of-type > a
        `).href;
        pictureLink.href = link;
        const picture = document.createElement("img");
        // Hide it until we delete the initials element, to prevent it from showing up under the profile entry.
        picture.setAttribute("style", "visibility: hidden");
        picture.addEventListener("error", (event) => {
            // Account does not have a picture (or some other error occurred),
            // so roll back the changes and keep the initials.
            pictureLink.remove();
            return true;
        });
        picture.addEventListener("load", (event) => {
            // Success! Go ahead and remove the old initials element.
            initial.remove();
            picture.removeAttribute("style");
        });
        const uid = link.split("/").splice(-1)[0];
        picture.src = `/upload/jamesriver/profilePictures/${uid}_thumb.jpg`;
        picture.classList.add("user-picture", "img-circle");
        pictureLink.appendChild(picture);
        holder.appendChild(pictureLink);
    }
})();