MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Hachimitsu (talk | contribs) m (missing -) |
Hachimitsu (talk | contribs) mNo edit summary Tag: Reverted |
||
Line 11: | Line 11: | ||
var cellText = $(this).text().trim(); | var cellText = $(this).text().trim(); | ||
// Check if cell text contains any redValues partially | |||
if (redValues.some(function (value) { | if (redValues.some(function (value) { | ||
return cellText.indexOf(value) !== -1; | return cellText.indexOf(value.toLowerCase()) !== -1; | ||
})) { | })) { | ||
$(this).css('color', 'red'); | $(this).css('color', 'red'); | ||
Line 20: | Line 20: | ||
// Check if cell text contains any greenValues partially | // Check if cell text contains any greenValues partially | ||
if (greenValues.some(function (value) { | if (greenValues.some(function (value) { | ||
return cellText.indexOf(value) !== -1; | return cellText.indexOf(value.toLowerCase()) !== -1; | ||
})) { | })) { | ||
$(this).css('color', 'green'); | $(this).css('color', 'green'); |
Revision as of 23:45, 2 March 2024
/* Any JavaScript here will be loaded for all users on every page load. */
importScript('MediaWiki:jquery.js');
$(document).ready(function () {
// Define the values for red and green text
var redValues = ["Dry", "Fairy-Sized", "Dead", "Stinky", "Boring", "Crunchy", "Bitter", "Tarnished", "Bland", "Coarse", "Rustic", "Dull Color", "Harmful Substance", "Squishy", "Tasteless", "Ugly", "decreases"];
var greenValues = ["Slightly moist", "Moist", "Fatty", "Juicy", "Bursting with Juice", "Pumpkin-Sized", "Putit-Sized", "Monster-Sized", "Mammoth-Sized", "Titan-sized", "Moving", "Lively", "Very Lively", "Faint Aroma", "Pleasant Smell", "Fragrant", "Highly Fragrant", "Heavenly Scent","Unusual", "Rare", "Super Rare","Slightly Firm", "Stretchy", "Chewy", "Resilient", "Sweet", "Clearly Sweet", "Extremely Sweet", "Sugar Bomb", "Concerning", "Eye Catching", "Cute", "Beautiful", "Creepy Cute", "Collagen Rich", "Creamy", "Mellow", "Thick", "Velvety", "Dense", "Very Dense", "Concentrated", "Ultra concentrated", "Rough", "Delicate", "Extremely delicate","Pale Color", "Colorful", "Bright", "Trace Vitamins", "Small Vitamins", "Moderate vitamins", "Large vitamins", "A treasure trove of vitamins","Flaky", "Crispy", "Very Crispy", "Snappy", "Spicy", "Very Spicy", "Extremely Spicy", "Intensely Spicy", "Glossy", "Bright", "Shiny", "Lustrous", "Bewitchingly shiny", "increases", "grants you", "float", "enhances", "better", "additional", "easier", "sustains", "slows the process of decay", ];
// Loop through each table cell in wikitable
$('.wikitable td').each(function () {
var cellText = $(this).text().trim();
// Check if cell text contains any redValues partially
if (redValues.some(function (value) {
return cellText.indexOf(value.toLowerCase()) !== -1;
})) {
$(this).css('color', 'red');
}
// Check if cell text contains any greenValues partially
if (greenValues.some(function (value) {
return cellText.indexOf(value.toLowerCase()) !== -1;
})) {
$(this).css('color', 'green');
}
});
});