MediaWiki

Difference between revisions of "Common.js"

From Shadow Era Wiki

m
Line 1: Line 1:
// Random Main Card //
+
// -----------------------------
 +
// Random Card: This script randomly selects a SE card in the Main Page.
 +
// -----------------------------
 
document.addEventListener('DOMContentLoaded', function() {
 
document.addEventListener('DOMContentLoaded', function() {
 
     var cardData = {
 
     var cardData = {
         "se": 202,
+
         "se": 202, // Number of cards in the 'se' set
         "ex": 152,
+
         "ex": 152, // Number of cards in the 'ex' set
         "sf": 202,
+
         "sf": 202, // Number of cards in the 'sf' set
         "ll": 202,
+
         "ll": 202, // Number of cards in the 'll' set
         "cp": 60,
+
         "cp": 60, // Number of cards in the 'cp' set
         "rr": 200 // Note: trouver un moyen de choisir les bonnes cartes.
+
         "rr": 200 // Number of cards in the 'rr' set
 
     };
 
     };
  
     var prefixes = Object.keys(cardData);
+
     var prefixes = Object.keys(cardData); // Get prefixes of the card data
  
     var randomPrefix = prefixes[Math.floor(Math.random() * prefixes.length)];
+
     var randomPrefix = prefixes[Math.floor(Math.random() * prefixes.length)]; // Randomly select a prefix
 
      
 
      
     var maxNumber = cardData[randomPrefix];
+
     var maxNumber = cardData[randomPrefix]; // Get the maximum number of cards for the selected prefix
 
      
 
      
     var randomIndex = Math.floor(Math.random() * maxNumber) + 1; // +1 pour inclure le numéro maximum
+
     var randomIndex = Math.floor(Math.random() * maxNumber) + 1; // +1 to include the maximum number
 
      
 
      
     var formattedNumber = randomIndex.toString().padStart(3, '0'); // Ajoute des zéros pour obtenir 3 chiffres
+
     var formattedNumber = randomIndex.toString().padStart(3, '0'); // Add leading zeros to ensure 3 digits
 
      
 
      
     var cardImageUrl = 'https://www.shadowera.com/cards/' + randomPrefix + formattedNumber + '.jpg';
+
     var cardImageUrl = 'https://www.shadowera.com/cards/' + randomPrefix + formattedNumber + '.jpg'; // Create the card image URL
 
      
 
      
     var cardImage = document.getElementById('randomCard');
+
     var cardImage = document.getElementById('randomCard'); // Get the image element by ID
 
     if (cardImage) {
 
     if (cardImage) {
         cardImage.src = cardImageUrl;
+
         cardImage.src = cardImageUrl; // Set the image source
         cardImage.alt = randomPrefix + formattedNumber + '.jpg'; // Mettre à jour l'attribut alt
+
         cardImage.alt = randomPrefix + formattedNumber + '.jpg'; // Update the alt attribute
 
     }
 
     }
 
});
 
});
 
+
// -----------------------------
// Background Wiki image and Skin
+
// Background Wiki image and Skin:
 +
// This script applies the background image and overlay styles to the wiki body.
 +
// Changes color in different area and set index to objects.
 +
// -----------------------------
 +
// Background Image
 
$(document).ready(function() {
 
$(document).ready(function() {
     // Image de fond
+
     // Background Image
 
     $('body').css({
 
     $('body').css({
 
         'background-image': 'url("https://www.shadowera.com/landing/img/developers.jpg")',
 
         'background-image': 'url("https://www.shadowera.com/landing/img/developers.jpg")',
 
         'background-size': 'cover',
 
         'background-size': 'cover',
         'background-attachment': 'fixed',
+
         'background-attachment': 'fixed',  
 
         'background-repeat': 'no-repeat'
 
         'background-repeat': 'no-repeat'
 
     });
 
     });
  
     // Ajouter l'overlay
+
     // Add Overlay
     $('body').append('<div class="overlay"></div>');
+
     $('body').append('<div class="overlay"></div>'); // Append overlay to the body
 
     $('.overlay').css({
 
     $('.overlay').css({
         'position': 'absolute',
+
         'position': 'absolute', // Position the overlay absolutely
         'top': '55px',  // Positionnement d'origine
+
         'top': '55px',  // Original positioning from the top
         'left': '1%', // Positionnement à gauche pour créer une bordure de 1%
+
         'left': '1%', // Left positioning for a 1% border
         'width': '98%',  // Largeur totale pour tenir compte des 1% de chaque côté
+
         'width': '98%',  // Total width to account for 1% on each side
         'background-color': 'rgba(24, 29, 35, 0.9)',
+
         'background-color': 'rgba(24, 29, 35, 0.9)', // Set overlay color with opacity
         'z-index': '1', // Assurez-vous que l'overlay est au-dessus des éléments de fond
+
         'z-index': '1', // Ensure the overlay is above background elements
         'pointer-events': 'none',
+
         'pointer-events': 'none', // Prevent interaction with the overlay
         'border-radius': '10px'
+
         'border-radius': '10px' // Round the corners of the overlay
 
     });
 
     });
  
     // Ajuster la hauteur de l'overlay pour qu'il atteigne le bas de la page
+
     // Adjust the height of the overlay to reach the bottom of the page
 
     function adjustOverlayHeight() {
 
     function adjustOverlayHeight() {
         var documentHeight = $(document).height(); // Hauteur totale du document
+
         var documentHeight = $(document).height();  
         var overlayStart = $('.overlay').position().top; // Position actuelle de l'overlay
+
         var overlayStart = $('.overlay').position().top;  
         var overlayHeight = documentHeight - overlayStart; // Calculer la hauteur de l'overlay
+
         var overlayHeight = documentHeight - overlayStart;
         $('.overlay').css('height', overlayHeight + 'px'); // Définir la hauteur de l'overlay
+
         $('.overlay').css('height', overlayHeight + 'px');  
 
     }
 
     }
  
     adjustOverlayHeight(); // Appeler la fonction pour ajuster la hauteur initialement
+
     adjustOverlayHeight();  
  
    // Réajuster la hauteur lors du redimensionnement de la fenêtre
 
 
     $(window).resize(function() {
 
     $(window).resize(function() {
 
         adjustOverlayHeight();
 
         adjustOverlayHeight();
Line 68: Line 73:
 
});
 
});
  
    // Appliquer le style au contenu du wiki
+
// Apply style to wiki content: This section applies styles to the main content area of the wiki.
    $('#mw-content-text').css({
+
$('#mw-content-text').css({
        'position': 'relative',
+
    'position': 'relative',
        'color': 'white', // Assurez-vous que le texte soit lisible
+
    'color': 'white',  
        'padding': '20px' // Ajouter du padding pour l'esthétique
+
    'padding': '20px'
    });
+
});
  
    // Appliquer des styles aux titres
+
// Apply styles to headings
    $('.mw-headline').css({
+
$('.mw-headline').css({
        'color': 'white' // Mettre le texte en blanc
+
    'color': 'white'
    });
+
});
  
    // Rendre le texte des commentaires dans les éléments <span> avec la classe co1 en gris clair
+
// Render comments text in <span> elements with class co1 in light gray color
    $('.co1').css({
+
$('.co1').css({
        'color': '#b3b3b3' // Exemple d'une couleur gris clair
+
    'color': '#b3b3b3'
    });
+
});
  
    // Rendre le titre blanc
+
// Set the title color to white
    $('.title').css({
+
$('.title').css({
        'color': 'white', // Titre en blanc
+
    'color': 'white',
        'position': 'relative', // Assurez-vous que le titre a une position
+
    'position': 'relative',
        'z-index': '7' // Assurez-vous que le titre est au-dessus de l'overlay
+
    'z-index': '7'
    });
+
});
   
+
    // Rendre le tagline moins blanc
+
    $('#tagline').css({
+
        'color': 'rgba(255, 255, 255, 0.5)' // Tagline en blanc avec opacité
+
    });
+
  
    // Rendre le texte de l'élément abbr en blanc
+
// Make the tagline less bright
    $('.minoredit').css({
+
$('#tagline').css({
        'color': 'white', // Texte en blanc
+
    'color': 'rgba(255, 255, 255, 0.5)'
        'position': 'relative', // Assurez-vous que l'élément a une position
+
});
        'z-index': '7' // Assurez-vous que l'élément est au-dessus de l'overlay
+
    });
+
  
    // Rendre le texte des éléments <code> en blanc
+
// Set the text color of abbr elements to white
    $('code').css({
+
$('.minoredit').css({
        'color': 'white', // Texte en blanc
+
    'color': 'white',
        'position': 'relative', // Assurez-vous que l'élément a une position
+
    'position': 'relative',
        'z-index': '7' // Assurez-vous que l'élément est au-dessus de l'overlay
+
    'z-index': '7'
    });
+
});
  
    // Rendre le texte de l'élément <label> spécifique en noir
+
// Set the text color of <code> elements to white
    $('#mw-editpage-watch').css({
+
$('code').css({
        'color': 'black' // Texte en noir
+
    'color': 'white',
     });
+
     'position': 'relative',
 +
    'z-index': '7'
 +
});
  
    // Rendre le texte de l'élément <label> spécifique en noir
+
// Set the text color of specific <label> element in black
    $('#mw-editpage-minoredit').css({
+
$('#mw-editpage-watch').css({
        'color': 'black' // Texte en noir
+
    'color': 'black'
    });
+
});
  
    // Rendre le texte de l'élément <label> spécifique en noir
+
// Set the text color of specific <label> element in black
    $('label[for="wpSummary"]').css({
+
$('#mw-editpage-minoredit').css({
        'color': 'black' // Texte en noir
+
    'color': 'black'
    });
+
});
  
    // Rendre le texte de tous les autres éléments <label> avec l'attribut for en blanc
+
// Set the text color of specific <label> element in black
    $('label[for]').not('#mw-editpage-watch, #mw-editpage-minoredit, label[for="wpSummary"]').css({
+
$('label[for="wpSummary"]').css({
        'color': 'white' // Texte en blanc
+
    'color': 'black'
    });
+
});
  
    // Rendre le texte de tous les éléments <p> dans le div #editpage-copywarn en noir
+
// Set the text color of all other <label> elements with the for attribute to white
    $('#editpage-copywarn p').css({
+
$('label[for]').not('#mw-editpage-watch, #mw-editpage-minoredit, label[for="wpSummary"]').css({
        'color': 'black' // Texte en noir
+
    'color': 'white'
    });
+
});
  
    // Changer la couleur des éléments <span> avec la classe mw-plusminus-neg
+
// Set the text color of all <p> elements in the #editpage-copywarn div to black
    $('.mw-plusminus-neg').css({
+
$('#editpage-copywarn p').css({
        'color': '#e88c18' // Nouvelle couleur
+
    'color': 'black'
    });
+
});
  
    // Changer la couleur des éléments <a> avec la classe mw-userlink
+
// Change the color of elements <span> with the class mw-plusminus-neg
    $('.mw-userlink').css({
+
$('.mw-plusminus-neg').css({
        'color': '#e88c18' // Nouvelle couleur
+
    'color': '#e88c18'
    });
+
});
  
    // Changer la couleur des éléments <a> avec la classe new
+
// Change the color of elements <a> with the class mw-userlink
    $('a.new[title="User talk:Blopi (page does not exist)"]').css({
+
$('.mw-userlink').css({
        'color': '#e88c18' // Nouvelle couleur
+
    'color': '#e88c18'
    });
+
});
  
    // Cibler le texte en gras <b>
+
// Change the color of elements <a> with the class new
    $('#editpage-copywarn b').css({
+
$('a.new[title="User talk:Blopi (page does not exist)"]').css({
        'color': 'black' // Texte en noir pour le texte en gras
+
    'color': '#e88c18'
    });
+
});
  
    // Rendre Subcategories de la même couleur que tagline
+
// Target the bold <b> text
    $('h2').css({
+
$('#editpage-copywarn b').css({
        'color': 'rgba(255, 255, 255, 0.8)' // Couleur identique au tagline
+
    'color': 'black'
 +
});
  
    });
+
// Render Subcategories the same color as tagline
    // Rendre le texte des éléments <span> avec la classe mw-plusminus-pos en vert clair
+
$('h2').css({
    $('.mw-plusminus-pos').css({
+
    'color': 'rgba(255, 255, 255, 0.8)'
        'color': '#66ff66' // Exemple d'une couleur vert clair
+
});
    });
+
  
    // Rendre Subcategories de la même couleur que tagline
+
// Set the text color of <span> elements with the class mw-plusminus-pos to light green
    $('h4').css({
+
$('.mw-plusminus-pos').css({
        'color': 'rgba(255, 255, 255, 0.8)' // Couleur identique au tagline
+
    'color': '#66ff66'
    });
+
});
  
    // Rendre Subcategories de la même couleur que tagline
+
// Render Subcategories the same color as tagline
    $('h5').css({
+
$('h4').css({
        'color': 'orange',
+
    'color': 'rgba(255, 255, 255, 0.8)'
        'position': 'relative',
+
});
        'z-index': '7'
+
    });
+
  
    // Changer la couleur des cellules du tableau
+
// Render Subcategories the same color as tagline
    $('table, td, th').css({
+
$('h5').css({
        'background-color': '#1c242c', // Couleur des cellules
+
    'color': 'orange',
        'color': 'white', // Assurez-vous que le texte des cellules soit lisible
+
    'position': 'relative',
        'border': '1px solid #3a3e42' // Ajouter une bordure grise
+
    'z-index': '7'
    });
+
});
  
     // Changer la couleur de <h3>R cont.</h3> pour qu'elle soit identique au tagline
+
// Change the color of table cells
    $('h3').css({
+
$('table, td, th').css({
        'color': 'rgba(255, 255, 255, 0.5)' // Couleur identique au tagline
+
     'background-color': '#1c242c',
    });
+
    'color': 'white',
 +
    'border': '1px solid #3a3e42'
 +
});
 +
 
 +
// Change the color of <h3> to be the same as the tagline
 +
$('h3').css({
 +
    'color': 'rgba(255, 255, 255, 0.5)'
 +
});
  
// Charger le module collapsible de MediaWiki pour rendre la section repliable.
+
// Load the collapsible module from MediaWiki to make sections collapsible.
 
mw.loader.load('mediawiki.collapsible');
 
mw.loader.load('mediawiki.collapsible');
  
// Cette fonction affiche ou masque un élément avec l'ID spécifié.
+
// This function displays or hides an element with the specified ID.
 
function toggleContent(id) {
 
function toggleContent(id) {
 
     var element = document.getElementById(id);
 
     var element = document.getElementById(id);
 
     if (element.style.display === 'none' || element.style.display === '') {
 
     if (element.style.display === 'none' || element.style.display === '') {
         element.style.display = 'table-row-group';
+
         element.style.display = 'table-row-group'; // Show the element
 
     } else {
 
     } else {
         element.style.display = 'none';
+
         element.style.display = 'none'; // Hide the element
 
     }
 
     }
 
}
 
}
  
 
// -----------------------------
 
// -----------------------------
// Custom Script for Highlighting Backticks
+
// Script for Highlighting Backticks
 
// Applies custom visual styles to text wrapped in backticks without altering the content
 
// Applies custom visual styles to text wrapped in backticks without altering the content
 +
// This script waits for the document to fully load, and applies a visual style
 +
// to any text that is surrounded by backticks (` `), without altering the content in previous.
 
// -----------------------------
 
// -----------------------------
 
// This script waits for the document to fully load, and applies a visual style
 
// to any text that is surrounded by backticks (` `), without altering the content.
 
  
 
document.addEventListener('DOMContentLoaded', function () {
 
document.addEventListener('DOMContentLoaded', function () {
Line 225: Line 229:
 
         const backtickRegex = /`([^`]+)`/g; // Matches text between backticks
 
         const backtickRegex = /`([^`]+)`/g; // Matches text between backticks
 
         const styledText = text.replace(backtickRegex, function (match, p1) {
 
         const styledText = text.replace(backtickRegex, function (match, p1) {
             return '<span class="backtick-style">' + p1 + '</span>';
+
             return '<span class="backtick-style">' + p1 + '</span>';  
 
         });
 
         });
         return styledText;
+
         return styledText; // Return the modified text
 
     }
 
     }
  
Line 233: Line 237:
 
     // Traverse all text nodes and apply the backtick highlighting
 
     // Traverse all text nodes and apply the backtick highlighting
 
     // @param {Node} node
 
     // @param {Node} node
     //  
+
     //
 
     function traverseTextNodes(node) {
 
     function traverseTextNodes(node) {
         if (node.nodeType === 3 && node.nodeValue.includes('`')) { // Only process text nodes
+
         if (node.nodeType === 3 && node.nodeValue.includes('`')) {  
             const span = document.createElement('span');
+
             const span = document.createElement('span');  
             span.innerHTML = highlightBackticks(node.nodeValue);
+
             span.innerHTML = highlightBackticks(node.nodeValue);  
             node.parentNode.replaceChild(span, node);
+
             node.parentNode.replaceChild(span, node);  
         } else if (node.nodeType === 1 && node.childNodes) { // Traverse element children
+
         } else if (node.nodeType === 1 && node.childNodes) {
             node.childNodes.forEach(traverseTextNodes);
+
             node.childNodes.forEach(traverseTextNodes);  
 
         }
 
         }
 
     }
 
     }

Revision as of 16:32, 12 October 2024

// -----------------------------
// Random Card: This script randomly selects a SE card in the Main Page.
// -----------------------------
document.addEventListener('DOMContentLoaded', function() {
    var cardData = {
        "se": 202, // Number of cards in the 'se' set
        "ex": 152, // Number of cards in the 'ex' set
        "sf": 202, // Number of cards in the 'sf' set
        "ll": 202, // Number of cards in the 'll' set
        "cp": 60,  // Number of cards in the 'cp' set
        "rr": 200  // Number of cards in the 'rr' set
    };
 
    var prefixes = Object.keys(cardData); // Get prefixes of the card data
 
    var randomPrefix = prefixes[Math.floor(Math.random() * prefixes.length)]; // Randomly select a prefix
 
    var maxNumber = cardData[randomPrefix]; // Get the maximum number of cards for the selected prefix
 
    var randomIndex = Math.floor(Math.random() * maxNumber) + 1; // +1 to include the maximum number
 
    var formattedNumber = randomIndex.toString().padStart(3, '0'); // Add leading zeros to ensure 3 digits
 
    var cardImageUrl = 'https://www.shadowera.com/cards/' + randomPrefix + formattedNumber + '.jpg'; // Create the card image URL
 
    var cardImage = document.getElementById('randomCard'); // Get the image element by ID
    if (cardImage) {
        cardImage.src = cardImageUrl; // Set the image source
        cardImage.alt = randomPrefix + formattedNumber + '.jpg'; // Update the alt attribute
    }
});
// -----------------------------
// Background Wiki image and Skin:
// This script applies the background image and overlay styles to the wiki body.
// Changes color in different area and set index to objects.
// -----------------------------
// Background Image
$(document).ready(function() {
    // Background Image
    $('body').css({
        'background-image': 'url("https://www.shadowera.com/landing/img/developers.jpg")',
        'background-size': 'cover',
        'background-attachment': 'fixed', 
        'background-repeat': 'no-repeat'
    });
 
    // Add Overlay
    $('body').append('<div class="overlay"></div>'); // Append overlay to the body
    $('.overlay').css({
        'position': 'absolute', // Position the overlay absolutely
        'top': '55px',  // Original positioning from the top
        'left': '1%', // Left positioning for a 1% border
        'width': '98%',  // Total width to account for 1% on each side
        'background-color': 'rgba(24, 29, 35, 0.9)', // Set overlay color with opacity
        'z-index': '1', // Ensure the overlay is above background elements
        'pointer-events': 'none', // Prevent interaction with the overlay
        'border-radius': '10px' // Round the corners of the overlay
    });
 
    // Adjust the height of the overlay to reach the bottom of the page
    function adjustOverlayHeight() {
        var documentHeight = $(document).height(); 
        var overlayStart = $('.overlay').position().top; 
        var overlayHeight = documentHeight - overlayStart;
        $('.overlay').css('height', overlayHeight + 'px'); 
    }
 
    adjustOverlayHeight(); 
 
    $(window).resize(function() {
        adjustOverlayHeight();
    });
});
 
// Apply style to wiki content: This section applies styles to the main content area of the wiki.
$('#mw-content-text').css({
    'position': 'relative',
    'color': 'white', 
    'padding': '20px'
});
 
// Apply styles to headings
$('.mw-headline').css({
    'color': 'white'
});
 
// Render comments text in <span> elements with class co1 in light gray color
$('.co1').css({
    'color': '#b3b3b3'
});
 
// Set the title color to white
$('.title').css({
    'color': 'white',
    'position': 'relative',
    'z-index': '7'
});
 
// Make the tagline less bright
$('#tagline').css({
    'color': 'rgba(255, 255, 255, 0.5)'
});
 
// Set the text color of abbr elements to white
$('.minoredit').css({
    'color': 'white',
    'position': 'relative',
    'z-index': '7'
});
 
// Set the text color of <code> elements to white
$('code').css({
    'color': 'white',
    'position': 'relative',
    'z-index': '7'
});
 
// Set the text color of specific <label> element in black
$('#mw-editpage-watch').css({
    'color': 'black'
});
 
// Set the text color of specific <label> element in black
$('#mw-editpage-minoredit').css({
    'color': 'black'
});
 
// Set the text color of specific <label> element in black
$('label[for="wpSummary"]').css({
    'color': 'black'
});
 
// Set the text color of all other <label> elements with the for attribute to white
$('label[for]').not('#mw-editpage-watch, #mw-editpage-minoredit, label[for="wpSummary"]').css({
    'color': 'white'
});
 
// Set the text color of all <p> elements in the #editpage-copywarn div to black
$('#editpage-copywarn p').css({
    'color': 'black'
});
 
// Change the color of elements <span> with the class mw-plusminus-neg
$('.mw-plusminus-neg').css({
    'color': '#e88c18'
});
 
// Change the color of elements <a> with the class mw-userlink
$('.mw-userlink').css({
    'color': '#e88c18'
});
 
// Change the color of elements <a> with the class new
$('a.new[title="User talk:Blopi (page does not exist)"]').css({
    'color': '#e88c18'
});
 
// Target the bold <b> text
$('#editpage-copywarn b').css({
    'color': 'black'
});
 
// Render Subcategories the same color as tagline
$('h2').css({
    'color': 'rgba(255, 255, 255, 0.8)'
});
 
// Set the text color of <span> elements with the class mw-plusminus-pos to light green
$('.mw-plusminus-pos').css({
    'color': '#66ff66'
});
 
// Render Subcategories the same color as tagline
$('h4').css({
    'color': 'rgba(255, 255, 255, 0.8)'
});
 
// Render Subcategories the same color as tagline
$('h5').css({
    'color': 'orange',
    'position': 'relative',
    'z-index': '7'
});
 
// Change the color of table cells
$('table, td, th').css({
    'background-color': '#1c242c',
    'color': 'white',
    'border': '1px solid #3a3e42'
});
 
// Change the color of <h3> to be the same as the tagline
$('h3').css({
    'color': 'rgba(255, 255, 255, 0.5)'
});
 
// Load the collapsible module from MediaWiki to make sections collapsible.
mw.loader.load('mediawiki.collapsible');
 
// This function displays or hides an element with the specified ID.
function toggleContent(id) {
    var element = document.getElementById(id);
    if (element.style.display === 'none' || element.style.display === '') {
        element.style.display = 'table-row-group'; // Show the element
    } else {
        element.style.display = 'none'; // Hide the element
    }
}
 
// -----------------------------
// Script for Highlighting Backticks
// Applies custom visual styles to text wrapped in backticks without altering the content
// This script waits for the document to fully load, and applies a visual style 
// to any text that is surrounded by backticks (` `), without altering the content in previous.
// -----------------------------
 
document.addEventListener('DOMContentLoaded', function () {
    // Check if we are in edit mode (to avoid changing the editor content)
    if (document.querySelector('#wpTextbox1') !== null) {
        return; // Do nothing in edit mode
    }
 
    //
    // Function to highlight text between backticks by wrapping it in a span element
    // @param {string} text
    // @returns {string}
    //
    function highlightBackticks(text) {
        const backtickRegex = /`([^`]+)`/g; // Matches text between backticks
        const styledText = text.replace(backtickRegex, function (match, p1) {
            return '<span class="backtick-style">' + p1 + '</span>'; 
        });
        return styledText; // Return the modified text
    }
 
    //
    // Traverse all text nodes and apply the backtick highlighting
    // @param {Node} node
    //
    function traverseTextNodes(node) {
        if (node.nodeType === 3 && node.nodeValue.includes('`')) { 
            const span = document.createElement('span'); 
            span.innerHTML = highlightBackticks(node.nodeValue); 
            node.parentNode.replaceChild(span, node); 
        } else if (node.nodeType === 1 && node.childNodes) {
            node.childNodes.forEach(traverseTextNodes); 
        }
    }
 
    // Apply the changes to the entire body
    traverseTextNodes(document.body);
});