User:Rublov/anonymize.js

Source: Wikipedia, the free encyclopedia.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
 * Replaces the username at the top of the screen with a generic string.
 *
 * Written by [[User:Rublov]], December 2021
 *
 * This script is developed on GitHub: https://github.com/rublovwiki/scripts
 */

$(function () {
  const outer = document.getElementById("pt-userpage");
  if (outer) {
    const inner = outer.querySelector("a span");
    if (inner) {
      inner.innerText = "User page";
    }
  }
  
  const outer2 = document.getElementById("pt-userpage-2");
  if (outer2) {
    const inner2 = outer2.querySelector("a span");
    if (inner2) {
      inner2.innerText = "User page";
    }
  }
});