MediaWiki:Common.js: Difference between revisions
From The Radical Buddhism Project
Created page with "→Any JavaScript here will be loaded for all users on every page load.: →===================================================================== RADICAL BUDDHIST PROJECT - AUTOMATED DESKTOP CATEGORY GENERATOR =====================================================================: $(document).ready(function() { // Locate MediaWiki's hidden internal category tracking metadata links var catLinks = $('.mw-normal-catlinks a, .catlinks a'); if (catLinks...." |
No edit summary |
||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
/* ===================================================================== | /* ===================================================================== | ||
| Line 5: | Line 6: | ||
===================================================================== */ | ===================================================================== */ | ||
$(document).ready(function() { | $(document).ready(function() { | ||
var catLinks = $('.mw-normal-catlinks a, .catlinks a'); | var catLinks = $('.mw-normal-catlinks a, .catlinks a'); | ||
if (catLinks.length > 0 && $('#custom-cat-tray').length === 0) { | if (catLinks.length > 0 && $('#custom-cat-tray').length === 0) { | ||
| Line 13: | Line 13: | ||
var text = $(this).text(); | var text = $(this).text(); | ||
var href = $(this).attr('href'); | var href = $(this).attr('href'); | ||
if (text !== 'Categories' && text !== 'カテゴリ') { | if (text !== 'Categories' && text !== 'カテゴリ') { | ||
if (index > 1) trayHtml += ' <span style="color: #d0d4d8; margin: 0 8px;">|</span> '; | if (index > 1) trayHtml += ' <span style="color: #d0d4d8; margin: 0 8px;">|</span> '; | ||
| Line 21: | Line 20: | ||
trayHtml += '</div>'; | trayHtml += '</div>'; | ||
$('.mw-body-content, #bodyContent').append(trayHtml); | $('.mw-body-content, #bodyContent').append(trayHtml); | ||
} | } | ||
}); | }); | ||
Revision as of 12:35, 21 July 2026
/* Any JavaScript here will be loaded for all users on every page load. */
/* =====================================================================
RADICAL BUDDHIST PROJECT - AUTOMATED DESKTOP CATEGORY GENERATOR
===================================================================== */
$(document).ready(function() {
var catLinks = $('.mw-normal-catlinks a, .catlinks a');
if (catLinks.length > 0 && $('#custom-cat-tray').length === 0) {
var trayHtml = '<div id="custom-cat-tray" style="margin: 40px 0 20px 0; padding: 15px 20px; background-color: #f0f2f4; border: 1px solid #d0d4d8; font-family: sans-serif; font-size: 0.85em; color: #222222;"><strong>Categories:</strong> ';
catLinks.each(function(index) {
var text = $(this).text();
var href = $(this).attr('href');
if (text !== 'Categories' && text !== 'カテゴリ') {
if (index > 1) trayHtml += ' <span style="color: #d0d4d8; margin: 0 8px;">|</span> ';
trayHtml += '<a href="' + href + '" style="color: #222222; text-decoration: none;">' + text + '</a>';
}
});
trayHtml += '</div>';
$('.mw-body-content, #bodyContent').append(trayHtml);
}
});
