MediaWiki:Common.js: Difference between revisions
Footer v3: widen Marspedia footer + embed Moon Society network footer (network-footer.css/js, Option B) |
Footer: encode network-band non-ASCII (arrows/em-dash/copyright) as HTML entities — fixes mojibake |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
/* Marspedia | /* Marspedia site-info footer injection (v5 "concept", 2026-07-05) — Marspedia-specific part. | ||
Injects #mp-custom-footer ( | Injects #mp-custom-footer (dark brand-led footer) after the native (hidden) #footer. | ||
The Moon Society network | The Moon Society network band is added by network-footer.js appended AFTER this IIFE. | ||
Content: brand blurb + site search, then Explore / Contribute / Mars Atlas columns. */ | |||
(function () { | (function () { | ||
'use strict'; | 'use strict'; | ||
| Line 17: | Line 15: | ||
var html = [ | var html = [ | ||
'<div id="mp-custom-footer">', | '<div id="mp-custom-footer">', | ||
' <div class="mp- | ' <div class="mp-si-inner">', | ||
' <div class="mp- | /* Brand column */ | ||
' < | ' <div class="mp-si-brand">', | ||
' | ' <h2 class="mp-si-wordmark">Marspedia</h2>', | ||
' < | ' <p class="mp-si-tagline">The open encyclopedia of Mars settlement, terraforming, and the science of the Red Planet.</p>', | ||
' </ | ' <form class="mp-footer-search" action="/index.php" method="get" role="search">', | ||
' <a href="/Marspedia:Contributing | ' <input type="hidden" name="title" value="Special:Search">', | ||
' <input type="hidden" name="fulltext" value="1">', | |||
' <input type="search" name="search" class="mp-footer-search-input" placeholder="Search Marspedia…" aria-label="Search Marspedia">', | |||
' <button type="submit" class="mp-footer-search-btn">Search</button>', | |||
' </form>', | |||
' <a class="mp-si-cta" href="/Marspedia:Contributing">Start contributing →</a>', | |||
' </div>', | ' </div>', | ||
/* Explore */ | |||
' <div class="mp- | ' <div class="mp-si-col">', | ||
' | ' <p class="mp-si-label">Explore</p>', | ||
' <ul class="mp-si-links">', | |||
' | ' <li><a href="/Main_Page">Main page</a></li>', | ||
' <li><a href="/Special:Random">Random article</a></li>', | |||
' | ' <li><a href="/Mars_Atlas">Mars Atlas</a></li>', | ||
' | ' <li><a href="/Education">Education</a></li>', | ||
' | ' <li><a href="/Special:RecentChanges">Recent changes</a></li>', | ||
' | ' <li><a href="/Special:Categories">Categories</a></li>', | ||
' | ' </ul>', | ||
' | ' </div>', | ||
' | /* Contribute */ | ||
' | ' <div class="mp-si-col">', | ||
' <p class="mp-si-label">Contribute</p>', | |||
' <ul class="mp-si-links">', | |||
' | ' <li><a href="/Special:RequestAccount">Create account</a></li>', | ||
' <li><a href="/Help:Editing">Editing basics</a></li>', | |||
' | ' <li><a href="/Help:Contents">Help</a></li>', | ||
' | ' <li><a href="/Marspedia:Sandbox">Sandbox</a></li>', | ||
' | ' <li><a href="/Marspedia:Community_Portal">Community & editors</a></li>', | ||
' <li><a href="/Special:Upload">Upload a file</a></li>', | |||
' | ' </ul>', | ||
' | |||
' | |||
' | |||
' | |||
' | |||
' </div>', | ' </div>', | ||
' <div class="mp- | /* Mars Atlas */ | ||
' <p class="mp- | ' <div class="mp-si-col">', | ||
' <ul class="mp- | ' <p class="mp-si-label">Mars Atlas</p>', | ||
' <li><a href="/ | ' <ul class="mp-si-links">', | ||
' <li><a href="/ | ' <li><a href="/Mars_Atlas">Atlas home</a></li>', | ||
' <li><a href="/ | ' <li><a href="/Mars_atlas_Exploration">Exploration</a></li>', | ||
' <li><a href="/Mars_atlas_Quadrangles">Quadrangles</a></li>', | |||
' <li><a href="/Mars_atlas_geology">Geology</a></li>', | |||
' </ul>', | ' </ul>', | ||
' </div>', | ' </div>', | ||
' </div>', /* end .mp-si-inner */ | |||
/* Bottom strip */ | |||
' <div class="mp-si-bottom">', | |||
' <p class="mp-si-bottom-timestamp">' + lastmodText + '</p>', | |||
' <ul class="mp-si-bottom-links">', | |||
' <li><a href="/Marspedia:Privacy_policy">Privacy policy</a></li>', | |||
' <li><a href="/Marspedia:About">About Marspedia</a></li>', | |||
' <li><a href="/Marspedia:General_disclaimer">Disclaimers</a></li>', | |||
' </ul>', | |||
' </div>', | ' </div>', | ||
'</div>' | '</div>' /* end #mp-custom-footer */ | ||
].join('\n'); | ].join('\n'); | ||
var nativeFooter = document.getElementById('footer'); | var nativeFooter = document.getElementById('footer'); | ||
| Line 110: | Line 91: | ||
/* ===================== BEGIN network-footer.js (Moon Society canonical, verbatim) ===================== */ | /* ===================== BEGIN network-footer.js (Moon Society canonical, verbatim) ===================== */ | ||
/* ============================================================================= | /* ============================================================================= | ||
Moon Society network footer | Moon Society network footer — injector | ||
Builds the .ms-network-footer element and mounts it. One identical file for | Builds the .ms-network-footer element and mounts it. One identical file for | ||
every property; it auto-detects which site it is on (by hostname) and marks | every property; it auto-detects which site it is on (by hostname) and marks | ||
| Line 119: | Line 100: | ||
appended INSIDE it. Marspedia uses this to nest the footer as a | appended INSIDE it. Marspedia uses this to nest the footer as a | ||
sub-element of its larger Mars footer. | sub-element of its larger Mars footer. | ||
- Otherwise the footer is appended to <body> (full-bleed) | - Otherwise the footer is appended to <body> (full-bleed) — the default for | ||
moonsociety.org / Lunarpedia / Spacepedia. | moonsociety.org / Lunarpedia / Spacepedia. | ||
| Line 153: | Line 134: | ||
' <span class="msf-seg__name">Lunar<b>pedia</b></span>', | ' <span class="msf-seg__name">Lunar<b>pedia</b></span>', | ||
' <span class="msf-seg__tag">the Moon</span>', | ' <span class="msf-seg__tag">the Moon</span>', | ||
' <span class="msf-seg__arrow" aria-hidden="true"> | ' <span class="msf-seg__arrow" aria-hidden="true">→</span>', | ||
' <span class="msf-seg__here">You are here</span>', | ' <span class="msf-seg__here">You are here</span>', | ||
' </a>', | ' </a>', | ||
| Line 164: | Line 145: | ||
' <span class="msf-seg__name">Space<b>pedia</b></span>', | ' <span class="msf-seg__name">Space<b>pedia</b></span>', | ||
' <span class="msf-seg__tag">outer space</span>', | ' <span class="msf-seg__tag">outer space</span>', | ||
' <span class="msf-seg__arrow" aria-hidden="true"> | ' <span class="msf-seg__arrow" aria-hidden="true">→</span>', | ||
' <span class="msf-seg__here">You are here</span>', | ' <span class="msf-seg__here">You are here</span>', | ||
' </a>', | ' </a>', | ||
| Line 176: | Line 157: | ||
' <span class="msf-seg__name">Mars<b>pedia</b></span>', | ' <span class="msf-seg__name">Mars<b>pedia</b></span>', | ||
' <span class="msf-seg__tag">the Red Planet</span>', | ' <span class="msf-seg__tag">the Red Planet</span>', | ||
' <span class="msf-seg__arrow" aria-hidden="true"> | ' <span class="msf-seg__arrow" aria-hidden="true">→</span>', | ||
' <span class="msf-seg__here">You are here</span>', | ' <span class="msf-seg__here">You are here</span>', | ||
' </a>', | ' </a>', | ||
| Line 204: | Line 185: | ||
' <div class="ms-network-footer__meta">', | ' <div class="ms-network-footer__meta">', | ||
' <span> | ' <span>© 2026 The Moon Society — a 501(c)(3) nonprofit</span>', | ||
' <span class="msf-meta__spring"></span>', | ' <span class="msf-meta__spring"></span>', | ||
' <div class="msf-social" aria-label="The Moon Society on social media">', | ' <div class="msf-social" aria-label="The Moon Society on social media">', | ||
Latest revision as of 12:36, 5 July 2026
/* Marspedia site-info footer injection (v5 "concept", 2026-07-05) — Marspedia-specific part.
Injects #mp-custom-footer (dark brand-led footer) after the native (hidden) #footer.
The Moon Society network band is added by network-footer.js appended AFTER this IIFE.
Content: brand blurb + site search, then Explore / Contribute / Mars Atlas columns. */
(function () {
'use strict';
function buildFooter() {
var lastmodEl = document.getElementById('footer-info-lastmod');
var lastmod = lastmodEl
? lastmodEl.textContent.replace(/^\s*This page was last edited on\s*/i, '').trim()
: '';
var lastmodText = lastmod
? 'This page was last edited on ' + lastmod + '.'
: '';
var html = [
'<div id="mp-custom-footer">',
' <div class="mp-si-inner">',
/* Brand column */
' <div class="mp-si-brand">',
' <h2 class="mp-si-wordmark">Marspedia</h2>',
' <p class="mp-si-tagline">The open encyclopedia of Mars settlement, terraforming, and the science of the Red Planet.</p>',
' <form class="mp-footer-search" action="/index.php" method="get" role="search">',
' <input type="hidden" name="title" value="Special:Search">',
' <input type="hidden" name="fulltext" value="1">',
' <input type="search" name="search" class="mp-footer-search-input" placeholder="Search Marspedia…" aria-label="Search Marspedia">',
' <button type="submit" class="mp-footer-search-btn">Search</button>',
' </form>',
' <a class="mp-si-cta" href="/Marspedia:Contributing">Start contributing →</a>',
' </div>',
/* Explore */
' <div class="mp-si-col">',
' <p class="mp-si-label">Explore</p>',
' <ul class="mp-si-links">',
' <li><a href="/Main_Page">Main page</a></li>',
' <li><a href="/Special:Random">Random article</a></li>',
' <li><a href="/Mars_Atlas">Mars Atlas</a></li>',
' <li><a href="/Education">Education</a></li>',
' <li><a href="/Special:RecentChanges">Recent changes</a></li>',
' <li><a href="/Special:Categories">Categories</a></li>',
' </ul>',
' </div>',
/* Contribute */
' <div class="mp-si-col">',
' <p class="mp-si-label">Contribute</p>',
' <ul class="mp-si-links">',
' <li><a href="/Special:RequestAccount">Create account</a></li>',
' <li><a href="/Help:Editing">Editing basics</a></li>',
' <li><a href="/Help:Contents">Help</a></li>',
' <li><a href="/Marspedia:Sandbox">Sandbox</a></li>',
' <li><a href="/Marspedia:Community_Portal">Community & editors</a></li>',
' <li><a href="/Special:Upload">Upload a file</a></li>',
' </ul>',
' </div>',
/* Mars Atlas */
' <div class="mp-si-col">',
' <p class="mp-si-label">Mars Atlas</p>',
' <ul class="mp-si-links">',
' <li><a href="/Mars_Atlas">Atlas home</a></li>',
' <li><a href="/Mars_atlas_Exploration">Exploration</a></li>',
' <li><a href="/Mars_atlas_Quadrangles">Quadrangles</a></li>',
' <li><a href="/Mars_atlas_geology">Geology</a></li>',
' </ul>',
' </div>',
' </div>', /* end .mp-si-inner */
/* Bottom strip */
' <div class="mp-si-bottom">',
' <p class="mp-si-bottom-timestamp">' + lastmodText + '</p>',
' <ul class="mp-si-bottom-links">',
' <li><a href="/Marspedia:Privacy_policy">Privacy policy</a></li>',
' <li><a href="/Marspedia:About">About Marspedia</a></li>',
' <li><a href="/Marspedia:General_disclaimer">Disclaimers</a></li>',
' </ul>',
' </div>',
'</div>' /* end #mp-custom-footer */
].join('\n');
var nativeFooter = document.getElementById('footer');
if (nativeFooter && nativeFooter.parentNode) {
var wrapper = document.createElement('div');
wrapper.innerHTML = html;
nativeFooter.parentNode.insertBefore(wrapper.firstChild, nativeFooter.nextSibling);
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', buildFooter);
} else {
buildFooter();
}
}());
/* ===================== BEGIN network-footer.js (Moon Society canonical, verbatim) ===================== */
/* =============================================================================
Moon Society network footer — injector
Builds the .ms-network-footer element and mounts it. One identical file for
every property; it auto-detects which site it is on (by hostname) and marks
that property "You are here".
Placement:
- If an element with id="ms-network-footer-slot" exists, the footer is
appended INSIDE it. Marspedia uses this to nest the footer as a
sub-element of its larger Mars footer.
- Otherwise the footer is appended to <body> (full-bleed) — the default for
moonsociety.org / Lunarpedia / Spacepedia.
Pairs with network-footer.css. ES5-safe (no template literals) so it survives
MediaWiki ResourceLoader on every property. Defensive: any failure is caught
so it can never break the host page.
============================================================================= */
(function () {
"use strict";
if (window.__msNetworkFooterMounted) { return; }
window.__msNetworkFooterMounted = true;
var CURRENT = ({
"lunarpedia.org": "lunarpedia",
"www.lunarpedia.org": "lunarpedia",
"spacepedia.wiki": "spacepedia",
"www.spacepedia.wiki": "spacepedia",
"marspedia.org": "marspedia",
"www.marspedia.org": "marspedia"
})[window.location.hostname] || "";
var HTML = [
'<footer class="ms-network-footer" role="contentinfo" aria-label="Moon Society network">',
' <div class="ms-network-footer__inner">',
' <div class="ms-network-footer__bar">',
' <a class="msf-seg msf-seg--luna" href="https://lunarpedia.org">',
' <svg class="msf-seg__icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">',
' <path d="M13.4 2.05a10 10 0 1 0 8.55 8.55A7.6 7.6 0 0 1 13.4 2.05Z"/>',
' <circle cx="7.2" cy="10.6" r="1.3" fill="#0b1020" opacity=".35"/>',
' <circle cx="10.4" cy="15.4" r="1" fill="#0b1020" opacity=".3"/>',
' </svg>',
' <span class="msf-seg__name">Lunar<b>pedia</b></span>',
' <span class="msf-seg__tag">the Moon</span>',
' <span class="msf-seg__arrow" aria-hidden="true">→</span>',
' <span class="msf-seg__here">You are here</span>',
' </a>',
' <a class="msf-seg msf-seg--space" href="https://spacepedia.wiki">',
' <svg class="msf-seg__icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">',
' <path d="M12 1.6l1.9 6.6 6.6 1.9-6.6 1.9L12 18.5l-1.9-6.5L3.5 10l6.6-1.9z"/>',
' <circle cx="18.5" cy="4.5" r="1.1"/>',
' </svg>',
' <span class="msf-seg__name">Space<b>pedia</b></span>',
' <span class="msf-seg__tag">outer space</span>',
' <span class="msf-seg__arrow" aria-hidden="true">→</span>',
' <span class="msf-seg__here">You are here</span>',
' </a>',
' <a class="msf-seg msf-seg--mars" href="https://marspedia.org">',
' <svg class="msf-seg__icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">',
' <circle cx="12" cy="12" r="9.2"/>',
' <path d="M4 9.5c3-1.2 6 .6 9 .2s4.9-1.9 6.9-1.2" stroke="#571d0e" stroke-width="1.1" fill="none" opacity=".5" stroke-linecap="round"/>',
' <path d="M9.4 3.2c1.6.4 3 .3 4.4 0l-.6 2.1-3.3.1z" fill="#ffe3cf" opacity=".7"/>',
' </svg>',
' <span class="msf-seg__name">Mars<b>pedia</b></span>',
' <span class="msf-seg__tag">the Red Planet</span>',
' <span class="msf-seg__arrow" aria-hidden="true">→</span>',
' <span class="msf-seg__here">You are here</span>',
' </a>',
' </div>',
' <div class="ms-network-footer__society">',
' <div class="msf-org">',
' <svg class="msf-org__moon" viewBox="0 0 48 48" fill="currentColor" aria-hidden="true">',
' <circle cx="24" cy="24" r="21" opacity=".16"/>',
' <circle cx="24" cy="24" r="21" fill="none" stroke="currentColor" stroke-width="1.4" opacity=".5"/>',
' <circle cx="17" cy="19" r="3.2" opacity=".55"/>',
' <circle cx="31" cy="28" r="4.4" opacity=".4"/>',
' <circle cx="15" cy="30" r="2.4" opacity=".4"/>',
' </svg>',
' <div>',
' <p class="msf-org__name">The Moon Society</p>',
' <p class="msf-org__mission"><em>Championing permanent human settlement of the Moon since 2000.</em></p>',
' </div>',
' </div>',
' <nav class="msf-cta" aria-label="Support the Moon Society">',
' <a class="msf-btn msf-btn--ghost" href="https://www.moonsociety.org/about">Learn more</a>',
' <a class="msf-btn msf-btn--primary" href="https://www.moonsociety.org/get-involved/donate/">Donate</a>',
' <a class="msf-btn msf-btn--outline" href="https://join.moonsociety.org">Join</a>',
' <a class="msf-btn msf-btn--outline" href="https://www.moonsociety.org/get-involved/volunteer/">Volunteer</a>',
' </nav>',
' </div>',
' <div class="ms-network-footer__meta">',
' <span>© 2026 The Moon Society — a 501(c)(3) nonprofit</span>',
' <span class="msf-meta__spring"></span>',
' <div class="msf-social" aria-label="The Moon Society on social media">',
' <a href="https://x.com/TheMoonSociety" aria-label="X (Twitter)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M18.24 2.25h3.31l-7.23 8.26 8.5 11.24h-6.66l-5.22-6.82-5.97 6.82H1.66l7.73-8.84L1.24 2.25H8.07l4.71 6.23 5.46-6.23Zm-1.16 17.85h1.83L7.01 4.13H5.05l12.03 15.97Z"/></svg></a>',
' <a href="https://www.facebook.com/allthingslunar/" aria-label="Facebook"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M22 12a10 10 0 1 0-11.56 9.88v-6.99H7.9V12h2.54V9.8c0-2.5 1.49-3.89 3.78-3.89 1.09 0 2.24.2 2.24.2v2.46h-1.26c-1.24 0-1.63.77-1.63 1.56V12h2.78l-.44 2.89h-2.34v6.99A10 10 0 0 0 22 12Z"/></svg></a>',
' <a href="https://www.linkedin.com/groups/47371/" aria-label="LinkedIn"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M20.45 20.45h-3.56v-5.57c0-1.33-.03-3.04-1.85-3.04-1.86 0-2.14 1.45-2.14 2.94v5.67H9.35V9h3.42v1.56h.05a3.75 3.75 0 0 1 3.37-1.85c3.6 0 4.27 2.37 4.27 5.45v6.29ZM5.34 7.43a2.07 2.07 0 1 1 0-4.13 2.07 2.07 0 0 1 0 4.13ZM7.12 20.45H3.55V9h3.57v11.45ZM22.22 0H1.77C.79 0 0 .78 0 1.73v20.54C0 23.22.79 24 1.77 24h20.45c.98 0 1.78-.78 1.78-1.73V1.73C24 .78 23.2 0 22.22 0Z"/></svg></a>',
' <a href="https://www.youtube.com/@TheMoonSociety" aria-label="YouTube"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M23 12s0-3.5-.45-5.17a2.9 2.9 0 0 0-2.04-2.05C18.8 4.33 12 4.33 12 4.33s-6.8 0-8.5.45a2.9 2.9 0 0 0-2.05 2.05A30 30 0 0 0 1 12a30 30 0 0 0 .45 5.17 2.9 2.9 0 0 0 2.05 2.05c1.7.45 8.5.45 8.5.45s6.8 0 8.5-.45a2.9 2.9 0 0 0 2.04-2.05C23 15.5 23 12 23 12Zm-13.25 3.5v-7l6 3.5-6 3.5Z"/></svg></a>',
' </div>',
' </div>',
' </div>',
'</footer>'
].join("\n");
function mount() {
try {
if (document.querySelector(".ms-network-footer")) { return; }
var holder = document.createElement("div");
holder.innerHTML = HTML;
var node = holder.firstChild;
while (node && node.nodeType !== 1) { node = node.nextSibling; }
if (!node) { return; }
node.setAttribute("data-network-current", CURRENT);
var slot = document.getElementById("ms-network-footer-slot");
if (slot) { slot.appendChild(node); }
else if (document.body) { document.body.appendChild(node); }
} catch (e) { /* never break the host page */ }
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", mount);
} else {
mount();
}
})();
/* ====================== END network-footer.js (Moon Society canonical, verbatim) ====================== */