Jump to content

MediaWiki:Common.js

From Looksmaxxing Wiki
Revision as of 06:32, 22 September 2026 by Robert (talk | contribs) (Custom emblem, wordmark, and favicon)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
(function () {
  var icon = "https://looksmaxxing.wiki/images/0/02/Looksmaxxing-icon.png";
  var word = "https://looksmaxxing.wiki/images/d/d9/Looksmaxxing-wordmark.png";
  var fav = "https://looksmaxxing.wiki/images/f/fb/Looksmaxxing-favicon.png";
  function apply() {
    document.querySelectorAll(".mw-logo-icon").forEach(function (img) {
      img.src = icon;
      img.removeAttribute("srcset");
      img.alt = "Looksmaxxing Wiki";
      img.style.width = "40px";
      img.style.height = "40px";
      img.style.objectFit = "cover";
      img.style.borderRadius = "3px";
    });
    document.querySelectorAll(".mw-logo-wordmark").forEach(function (el) {
      if (el.dataset.brand) return;
      el.dataset.brand = "1";
      if (el.tagName === "IMG") {
        el.src = word;
        el.removeAttribute("srcset");
        el.alt = "Looksmaxxing Wiki";
        el.style.height = "26px";
        return;
      }
      el.textContent = "";
      var im = document.createElement("img");
      im.src = word;
      im.alt = "Looksmaxxing Wiki";
      im.style.height = "26px";
      im.style.width = "auto";
      im.style.verticalAlign = "middle";
      el.appendChild(im);
    });
    var links = document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon']");
    if (!links.length) {
      var created = document.createElement("link");
      created.rel = "icon";
      document.head.appendChild(created);
      links = [created];
    }
    Array.prototype.forEach.call(links, function (l) {
      l.href = fav;
      l.type = "image/png";
    });
  }
  if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", apply);
  else apply();
})();