MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 61: Line 61:
                 var node = nodes.snapshotItem(i);
                 var node = nodes.snapshotItem(i);


                 // find the person's name in the node, and surround it with a span with a color
                 // find the person's name in the node, and surround it with a span and change the color to purple
                 var innerHTML = node.innerHTML;
                 var name = node.textContent.match(/(.*?)(\s|$)/)[1];
                innerHTML = innerHTML.replace(/(.*)(\s)(.*)/, "$1<span class='donator' style='color: purple;'>$2$3</span>");
                var newNode = document.createElement('span');
                 node.innerHTML = innerHTML;
                newNode.textContent = name;
                newNode.style.color = 'purple';
                 node.replaceChild(newNode, node.firstChild);
             }
             }