MediaWiki:Common.js
Appearance
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.
// Scroll to top on page load or refresh
window.addEventListener('load', function() {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
/* --- VERIFIED BADGE SCRIPT (Twitter-style, inline with title) --- */
mw.loader.using('mediawiki.util').then(function () {
$(function () {
const verifiedPages = [
'Narendra_Modi', // Add more verified page names here
];
const currentPage = mw.config.get('wgPageName');
if (verifiedPages.includes(currentPage)) {
const badgeHTML = `
<span class="verified-badge" aria-label="Verified">
<img class="badge-icon" src="https://upload.wikimedia.org/wikipedia/commons/e/e4/Twitter_Verified_Badge.svg"
width="20" height="20" alt="Verified">
<div class="verified-popup" role="dialog" aria-hidden="true">
<div class="popup-title">Verified:</div>
<div class="popup-description">
<img class="inline-verified-icon"
src="https://upload.wikimedia.org/wikipedia/commons/e/e4/Twitter_Verified_Badge.svg"
width="16" height="16" alt="Verified icon">
<div class="popup-text">
Articles or profiles with a verified badge have been authenticated and can represent verified subscribers, notable individuals, government entities, or official organizations.
<a href="#"> Learn more</a>
</div>
</div>
</div>
</span>`;
// Make the heading inline and vertically center contents, then append badge
const heading = $(".firstHeading");
heading.css({
"display": "inline-flex",
"align-items": "center",
"gap": "6px"
});
heading.append(badgeHTML);
}
});
});