User:Panamitsu/script/Edit history user mute.js

// Mute a certain user from a page's edit history.

// Get username (WARNING: Document.currentScript does not work on Internet Explorer)

// The odd variable name is to prevent name conflicts with other scripts.

const EDIT_HISTORY_USER_MUTE_USERNAME = new URLSearchParams(document.currentScript.src).get("username");

$( document ).ready( function () {

// Make sure the edit history page is open

if (mw.config.get('wgAction') == 'history') {

console.log("Blocking user: " + EDIT_HISTORY_USER_MUTE_USERNAME);

// Find user's edits and hide them.

bdiTags = document.getElementsByTagName("bdi");

for (var i = bdiTags.length-1; i >= 0; i--) {

var tag = bdiTags[i];

if (tag.textContent.toLowerCase() == EDIT_HISTORY_USER_MUTE_USERNAME.toLowerCase()) {

tag.parentNode.parentNode.parentNode.style.display = "none";

}

}

}

} );