Jump to content

MediaWiki:Common.js: Difference between revisions

From Looksmaxxing Wiki
Custom emblem, wordmark, and favicon
 
Use the Wingman logo, with permission from the copyright holder
 
Line 1: Line 1:
(function () {
(function () {
   var icon = "https://looksmaxxing.wiki/images/0/02/Looksmaxxing-icon.png";
   var icon = "https://looksmaxxing.wiki/images/b/b9/Wingman_mark.png";
   var word = "https://looksmaxxing.wiki/images/d/d9/Looksmaxxing-wordmark.png";
   var word = "https://looksmaxxing.wiki/images/3/30/Wingman_wordmark.png";
   var fav = "https://looksmaxxing.wiki/images/f/fb/Looksmaxxing-favicon.png";
   var fav = "https://looksmaxxing.wiki/images/3/32/Wingman_favicon.png";
  var logo = "https://looksmaxxing.wiki/images/5/5f/Wingman_logo.png";
   function apply() {
   function apply() {
     document.querySelectorAll(".mw-logo-icon").forEach(function (img) {
     document.querySelectorAll(".mw-logo-icon").forEach(function (img) {
       img.src = icon;
       img.src = icon;
       img.removeAttribute("srcset");
       img.removeAttribute("srcset");
       img.alt = "Looksmaxxing Wiki";
       img.alt = "Wingman";
       img.style.width = "40px";
       img.style.width = "40px";
       img.style.height = "40px";
       img.style.height = "40px";
       img.style.objectFit = "cover";
       img.style.objectFit = "contain";
      img.style.background = "#000";
       img.style.borderRadius = "3px";
       img.style.borderRadius = "3px";
     });
     });
     document.querySelectorAll(".mw-logo-wordmark").forEach(function (el) {
     document.querySelectorAll(".mw-logo-wordmark").forEach(function (el) {
       if (el.dataset.brand) return;
       if (el.dataset.brand === "wingman") return;
       el.dataset.brand = "1";
       el.dataset.brand = "wingman";
       if (el.tagName === "IMG") {
       if (el.tagName === "IMG") {
         el.src = word;
         el.src = word;
         el.removeAttribute("srcset");
         el.removeAttribute("srcset");
         el.alt = "Looksmaxxing Wiki";
         el.alt = "Wingman";
         el.style.height = "26px";
         el.style.height = "28px";
        el.style.background = "#000";
         return;
         return;
       }
       }
Line 26: Line 29:
       var im = document.createElement("img");
       var im = document.createElement("img");
       im.src = word;
       im.src = word;
       im.alt = "Looksmaxxing Wiki";
       im.alt = "Wingman";
       im.style.height = "26px";
       im.style.height = "28px";
       im.style.width = "auto";
       im.style.width = "auto";
       im.style.verticalAlign = "middle";
       im.style.verticalAlign = "middle";
      im.style.background = "#000";
       el.appendChild(im);
       el.appendChild(im);
     });
     });
Line 43: Line 47:
       l.type = "image/png";
       l.type = "image/png";
     });
     });
    if (mw.config.get("wgPageName") === "Wingman") {
      var box = document.querySelector(".infobox-image");
      if (box && !box.querySelector("img")) {
        var shot = document.createElement("img");
        shot.src = logo;
        shot.alt = "Wingman logo";
        shot.width = 220;
        box.insertBefore(shot, box.firstChild);
        box.querySelectorAll("a.new").forEach(function (a) { a.style.display = "none"; });
      }
    }
   }
   }
   if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", apply);
   if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", apply);
   else apply();
   else apply();
})();
})();

Latest revision as of 19:04, 23 September 2026

(function () {
  var icon = "https://looksmaxxing.wiki/images/b/b9/Wingman_mark.png";
  var word = "https://looksmaxxing.wiki/images/3/30/Wingman_wordmark.png";
  var fav = "https://looksmaxxing.wiki/images/3/32/Wingman_favicon.png";
  var logo = "https://looksmaxxing.wiki/images/5/5f/Wingman_logo.png";
  function apply() {
    document.querySelectorAll(".mw-logo-icon").forEach(function (img) {
      img.src = icon;
      img.removeAttribute("srcset");
      img.alt = "Wingman";
      img.style.width = "40px";
      img.style.height = "40px";
      img.style.objectFit = "contain";
      img.style.background = "#000";
      img.style.borderRadius = "3px";
    });
    document.querySelectorAll(".mw-logo-wordmark").forEach(function (el) {
      if (el.dataset.brand === "wingman") return;
      el.dataset.brand = "wingman";
      if (el.tagName === "IMG") {
        el.src = word;
        el.removeAttribute("srcset");
        el.alt = "Wingman";
        el.style.height = "28px";
        el.style.background = "#000";
        return;
      }
      el.textContent = "";
      var im = document.createElement("img");
      im.src = word;
      im.alt = "Wingman";
      im.style.height = "28px";
      im.style.width = "auto";
      im.style.verticalAlign = "middle";
      im.style.background = "#000";
      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 (mw.config.get("wgPageName") === "Wingman") {
      var box = document.querySelector(".infobox-image");
      if (box && !box.querySelector("img")) {
        var shot = document.createElement("img");
        shot.src = logo;
        shot.alt = "Wingman logo";
        shot.width = 220;
        box.insertBefore(shot, box.firstChild);
        box.querySelectorAll("a.new").forEach(function (a) { a.style.display = "none"; });
      }
    }
  }
  if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", apply);
  else apply();
})();