MediaWiki:Common.js: Difference between revisions
Appearance
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/ | var icon = "https://looksmaxxing.wiki/images/b/b9/Wingman_mark.png"; | ||
var word = "https://looksmaxxing.wiki/images/ | var word = "https://looksmaxxing.wiki/images/3/30/Wingman_wordmark.png"; | ||
var fav = "https://looksmaxxing.wiki/images/ | 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 = " | img.alt = "Wingman"; | ||
img.style.width = "40px"; | img.style.width = "40px"; | ||
img.style.height = "40px"; | img.style.height = "40px"; | ||
img.style.objectFit = " | 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 = " | 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 = " | el.alt = "Wingman"; | ||
el.style.height = " | 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 = " | im.alt = "Wingman"; | ||
im.style.height = " | 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();
})();