// Mute a certain user from watchlist. Backlink: [[User:Panamitsu/script/watchlistmute.js]]
// NOTE: Future changes to the Wikipedia layout may break this script.
// Get username (WARNING: Document.currentScript does not work on Internet Explorer)
const USERNAME = new URLSearchParams(document.currentScript.src).get("username");
$( document ).ready( function () {
// Make sure the watchlist is opened
if (mw.config.get('wgPageName') == "Special:Watchlist") {
console.log("watchlist is open");
console.log("Blocking user " + USERNAME + " from the watchlist.");
// Find user's contributions in watchlist, and hide them.
bdiTags = document.getElementsByTagName("bdi");
for (var i = bdiTags.length-1; i >= 0; i--) {
var tag = bdiTags[i];
if (tag.textContent.toLowerCase() == USERNAME.toLowerCase()) {
tag.parentNode.parentNode.parentNode.remove();
}
}
}
} );