MediaWiki:Common.js

From Ylvapedia
Revision as of 18:25, 5 April 2024 by Hachimitsu (talk | contribs)
Jump to navigation Jump to search

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* 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","Dangerous","Hallucinogenic", "パサパサ","妖精サイズ","死んでいる","くさい","つまらない","コシがない","苦い","不格好","カチカチ","淡白","すかすか","無骨","曇った色","有害物質","ふにゃふにゃ","	退屈","ざらざら","危険","幻覚作用",];
   var greenValues = ["Slightly moist", "Moist", "Fatty", "Juicy", "Bursting with Juice","Bursting", "Pumpkin-Sized", "Putit-Sized", "Monster-Sized", "Mammoth-Sized", "Titan-Sized","Almost Moving", "Moving", "Lively", "Very Lively","Alive","Faint Aroma", "Pleasant Smell", "Fragrant", "Highly Fragrant", "Heavenly Scent","Unusual", "Rare", "Super Rare","Ultra Rare", "Slightly Firm", "Stretchy", "Chewy", "Resilient","Slightly Sweet", "Sweet", "Clearly Sweet", "Extremely Sweet", "Sugar Bomb", "Concerning", "Eye-Catching", "Cute", "Beautiful", "Creepy Cute", "Collagen Rich", "Creamy", "Mellow", "Thick", "Velvety","Somewhat Dense", "Dense", "Very Dense", "Concentrated", "Ultra Concentrated","Rich", "Slightly Rough", "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", "Somewhat Spicy", "Spicy", "Very Spicy", "Extremely Spicy", "Intensely Spicy", "Glossy", "Bright", "Shiny", "Lustrous", "Bewitchingly Shiny","Rainbow Color","Fatten Up","Slim Down","Never Decay","普通の出来","まあまあの出来","良い出来","高級品","極上品","しっとり","てかてか","脂たっぷり","ジューシー","じゅわっと溢れる脂","プチサイズ","かぼちゃサイズ","お化けサイズ","マンモスサイズ","巨人サイズ","動きそう","動く","活きがいい","ピチピチ","生きている","ほのかな香り","いい匂い","かぐわしい","香り高い","天上の香り","少し珍しい","珍しい","レア","スーパーレア","ウルトラレア","少しコシがある","粘り強い","もちもち","伸びる","どこまでも伸びる","ほんのり甘い","甘い","はっきり甘い","激甘","砂糖爆弾","少し気になる","気になる","綺麗","かわいい","きもかわいい","コラーゲン豊富","独特の味","クリーミー","まろやか","濃厚","こくまろ","ちょっとぎっしり","ぎっしり","みっちり","パンパン","超特濃縮","おおざっぱ","華奢","繊細","非常に繊細","極めて繊細","薄い色","カラフル","鮮やか","鮮烈","万色","ビタミン微量","ビタミン少量","ビタミン中量","ビタミン大量","ビタミンの宝庫","ポリポリ","シャキシャキ","サクサク","ザクザク","カリカリ","やや刺激的","刺激的","スパイシー","とてもスパイシー","恐ろしくスパイシー","僅かな光沢","つるつる","つやつや","艶やか","魅惑の光沢","太る","痩せる","腐らない",];

    // Loop through each Food table cell in wikitable
    $('.Food td').each(function () {
        var cellText = $(this).text().trim();

        // Check if cell text is exactly equal to any redValues
        if (redValues.includes(cellText)) {
            $(this).css('color', 'red');
        }

        // Check if cell text is exactly equal to any greenValues
        if (greenValues.includes(cellText)) {
            $(this).css('color', 'green');
        }
    });
});

	// Script for auto coloration of text in equipment tables
	
$(document).ready(function () {
    // Define the values for blue, red and green text
   var blueValues = ["can cut", "can mine", "can fish"];
   var redValues = ["decreases", "sucks", "accelerates"];
   var greenValues = ["increases", "grants you", "float", "enhances", "better", "additional", "easier", "sustains", "slows the process of decay","inflicts massive","triggers","negates","reduces","prevents","see invisible","returns to your hand.","protects you from thieves.","digest rotten","absolute piercing","protects you from mutation.","strengthens"];

    // Loop through each Equipment table cell in wikitable
    $('.Equipment td').each(function () {
        var cellText = $(this).text().trim();

        // Check if cell text contains blueValues 
        if (blueValues.some(function (value) {
            return cellText.indexOf(value) !== -1;
        })) {
            $(this).css('color', 'steelblue');
        }
        
        // Check if cell text contains redValues 
        if (redValues.some(function (value) {
            return cellText.indexOf(value) !== -1;
        })) {
            $(this).css('color', 'red');
        }

        // Check if cell text contains greenValues 
        if (greenValues.some(function (value) {
            return cellText.indexOf(value) !== -1;
        })) {
            $(this).css('color', 'green');
        }
    });
});