MediaWiki:Common.js: Difference between revisions
From The Jadnix Codex
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
/* ============================================================ | /* ============================================================ | ||
JADNIX CODEX: CORE SCRIPTS ( | JADNIX CODEX: CORE SCRIPTS (MonoBook Edition) | ||
============================================================ */ | ============================================================ */ | ||
| Line 6: | Line 6: | ||
/* --- PART A: LOGO & THEME SYSTEM --- */ | /* --- PART A: LOGO & THEME SYSTEM --- */ | ||
// 1. DEFINE LOGOS | // 1. DEFINE LOGOS | ||
const logos = { | const logos = { | ||
still: 'https://files.catbox.moe/0cmhjh.png', | still: 'https://files.catbox.moe/0cmhjh.png', | ||
dealer: 'https://files.catbox.moe/73m0cp.png', | dealer: 'https://files.catbox.moe/73m0cp.png', | ||
skipper: 'https://files.catbox.moe/8gs8n5.png' // <--- | skipper: 'https://files.catbox.moe/8gs8n5.png' // <--- CHECK THIS URL | ||
}; | }; | ||
// 2. HELPER: FORCE LOGO SWAP | // 2. HELPER: FORCE LOGO SWAP (MONOBOOK VERSION) | ||
function swapLogo(url) { | function swapLogo(url) { | ||
// MonoBook uses background-image on the link inside p-logo | |||
$(' | $('#p-logo a').css('background-image', 'url(' + url + ')'); | ||
} | } | ||
| Line 31: | Line 29: | ||
} | } | ||
else if ($('.faction-still').length) { | else if ($('.faction-still').length) { | ||
// Default is usually set by CSS, but we can force it here | |||
$('body').addClass('theme-still'); | $('body').addClass('theme-still'); | ||
swapLogo(logos.still); | // swapLogo(logos.still); // Optional: Default usually handles this | ||
} | } | ||
/* --- PART B: CRDD CALCULATOR LOGIC --- */ | /* --- PART B: CRDD CALCULATOR LOGIC --- */ | ||
// (Keep your calculator code here just like before) | |||
// | |||
if ($('#crdd-interface').length) { | if ($('#crdd-interface').length) { | ||
$('.crdd-range').on('input', function() { | $('.crdd-range').on('input', function() { | ||
$(this).next('.crdd-value-display').text($(this).val()); | $(this).next('.crdd-value-display').text($(this).val()); | ||
}); | }); | ||
function updateCRDD() { | 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 | // Trigger update | ||
$('.crdd-range, input[type=checkbox]').on('input change', updateCRDD); | $('.crdd-range, input[type=checkbox]').on('input change', updateCRDD); | ||
} | } | ||
}); | }); | ||
Revision as of 18:46, 9 February 2026
/* ============================================================
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);
}
});