MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary Tag: Reverted |
||
| Line 1: | Line 1: | ||
/* ========================================================= | /* ========================================================= | ||
Lumenward: | Lumenward: GitHub link in top-right header (Vector 2022) | ||
- Not in dropdown | - Not in dropdown | ||
- Not near logo | |||
========================================================= */ | ========================================================= */ | ||
mw. | 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 | var old = document.getElementById('lumenward-github-link'); | ||
if (old) old.remove(); | |||
// | // Vector 2022 right-side header container (user icons live here) | ||
var | var right = | ||
document.querySelector('.mw-header .vector-header-end') | document.querySelector('.mw-header .vector-header-end') || | ||
document.querySelector('.mw-header .mw-header-user') | document.querySelector('.mw-header .mw-header-user') || | ||
document.querySelector('.mw-header .vector-user-links' | document.querySelector('.mw-header .vector-user-links'); | ||
if (! | 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); | |||
// Insert | |||
}); | }); | ||
Revision as of 11:28, 14 December 2025
/* =========================================================
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);
});