User:The Transhumanist/ViewAnnotationToggler.js: Difference between revisions

Content deleted Content added
try mw-body-content
No edit summary
Line 1:
//This selector grabs all of the <li> elements that are within #mw-content-text, and then does something for each of them
var content = document.getElementById('mw-body-content');
$("#mw-content-text li").each( function (ind, el)
var whattohide = content.innerHTML.replace(/Chess;/g,'');
{
content.innerHTML = whattohide;
//first, grab the text from the current li element; we want only the top level text, so filter out all of the other stuff.
var currentText = $(el).contents().filter(function(){return this.nodeType === 3; });
 
//Don't bother processing if there's nothing to process
if(currentText.text().length > 0)
{
//replace the character
var newText = currentText.text().replace(/–/g,'');
//reinsert the updated string back into the DOM
currentText.replaceWith(newText);
}
});