MediaWiki:Common.js: Difference between revisions

comment out the donator stuff cuz experimental
(farded)
(comment out the donator stuff cuz experimental)
 
(6 intermediate revisions by the same user not shown)
Line 30: Line 30:


// Experimental donator user group checker
// Experimental donator user group checker
/*
$(document).ready(function(){
$(document).ready(function(){
     mw.loader.using('mediawiki.api', function() {
     mw.loader.using('mediawiki.api', function() {
Line 60: Line 61:
             for (var i = 0; i < nodes.snapshotLength; i++) {
             for (var i = 0; i < nodes.snapshotLength; i++) {
                 var node = nodes.snapshotItem(i);
                 var node = nodes.snapshotItem(i);
                 node.style.color = "purple";
                 var nodeText = node.textContent;
 
                // Iterate through each user's name
                for (var j = 0; j < users.length; j++) {
                    var userName = users[j];
           
                    // Create a regular expression to match the name in the text
                    var regex = new RegExp('\\b' + userName + '\\b', 'g');
           
                    // Check if the user's name is present in the text
                    if (nodeText.match(regex)) {
                        // Create a new HTML string with the name wrapped in a <span> element
                        var highlightedText = nodeText.replace(regex, '<span style="color: #c846ff;">$&</span>');
           
                        // Update the node's HTML with the highlighted text
                        node.innerHTML = highlightedText;
                    }
                }
                // this entire section was made by copilot because im too lazy to do it myself
             }
             }


         } );
         } );
     })
     })
} );
} );*/