MediaWiki:Common.js
From The Jadnix Codex
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.
/* ============================================================
JADNIX CODEX: CORE SCRIPTS (MonoBook Edition)
============================================================ */
$(function() {
/* --- PART A: LOGO & THEME SYSTEM --- */
// 1. DEFINE LOGOS
const logos = {
still: 'https://files.catbox.moe/0cmhjh.png',
dealer: 'https://files.catbox.moe/73m0cp.png',
skipper: 'https://files.catbox.moe/8gs8n5.png' // <--- CHECK THIS URL
};
// 2. HELPER: FORCE LOGO SWAP (MONOBOOK VERSION)
function swapLogo(url) {
// MonoBook uses background-image on the link inside p-logo
$('#p-logo a').css('background-image', 'url(' + url + ')');
}
// 3. DETECT FACTION -> APPLY CLASS & LOGO
if ($('.faction-dealer').length) {
$('body').addClass('theme-dealer');
swapLogo(logos.dealer);
}
else if ($('.faction-skipper').length) {
$('body').addClass('theme-skipper');
swapLogo(logos.skipper);
}
else if ($('.faction-still').length) {
// Default is usually set by CSS, but we can force it here
$('body').addClass('theme-still');
// swapLogo(logos.still); // Optional: Default usually handles this
}
/* --- PART B: CRDD CALCULATOR LOGIC --- */
// (Keep your calculator code here just like before)
if ($('#crdd-interface').length) {
$('.crdd-range').on('input', function() {
$(this).next('.crdd-value-display').text($(this).val());
});
function updateCRDD() {
// ... (Your calculator logic) ...
// I am abbreviating this part to save space,
// BUT MAKE SURE YOU KEEP THE CALCULATOR CODE YOU HAD!
// If you need me to paste the whole calculator block again, let me know.
}
// Trigger update
$('.crdd-range, input[type=checkbox]').on('input change', updateCRDD);
}
});