User:Novem Linguae/Scripts/HideRollbackOnTemplates.js

// Kind of requested by Tamzin in Discord. I think they wanted it to only work on TPE though. // The MutationObserver code below was a good lesson for me. Can copy that when needed to other scripts.

function hideRollbackLink { $('.mw-rollback-link').hide; // JQuery doesn't support :before //mw.util.addCSS('.mw-changeslist-links > span:not(:first-child):before { content: ""; }'); // TODO: get rid of pipe | before undo link }

let namespace = mw.config.get('wgNamespaceNumber'); let isTemplate = [10,11].includes(namespace); if ( isTemplate ) { // https://stackoverflow.com/a/20683311/3480193 var observer = new MutationObserver(function(mutations) {		mutations.forEach(function(mutationRecord) { hideRollbackLink; });	});	var target = document.querySelector('.mw-rollback-link'); observer.observe(target, { attributes : true, attributeFilter : ['style'] }); }