Jump to content

MediaWiki:Common.js

From λ LUMENWARD
Revision as of 11:28, 14 December 2025 by Kauku (talk | contribs)

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.
/* =========================================================
   Lumenward: GitHub link in top-right header (Vector 2022)
   - Not in dropdown
   - Not near logo
   ========================================================= */

mw.hook('wikipage.content').add(function () {
  var url = 'https://github.com/YOUR_GITHUB_ORG_OR_REPO'; // <-- CHANGE THIS
  var text = 'GitHub';

  // Remove any previously inserted link (from older scripts)
  var old = document.getElementById('lumenward-github-link');
  if (old) old.remove();

  // Vector 2022 right-side header container (user icons live here)
  var right =
    document.querySelector('.mw-header .vector-header-end') ||
    document.querySelector('.mw-header .mw-header-user') ||
    document.querySelector('.mw-header .vector-user-links');

  if (!right) return;

  var a = document.createElement('a');
  a.id = 'lumenward-github-link';
  a.href = url;
  a.textContent = text;
  a.target = '_blank';
  a.rel = 'noopener';

  // Minimal styling; final color handled in CSS
  a.style.marginRight = '12px';
  a.style.fontWeight = '600';
  a.style.whiteSpace = 'nowrap';

  // Insert as the FIRST item in the right-side header area
  right.insertBefore(a, right.firstChild);
});