User:Acagastya/spamblock.js

// function spamBlockTagger { let api = new mw.Api; api .postWithToken('edit', {     action: 'edit',      title: mw.config.get('wgPageName'),      appendtext: `\n\n== Blocked ==\n ~`,      summary: 'spam block'    }) .done(data => {     api        .get({ action: 'parse', page: mw.config.get('wgPageName'), prop: 'text' })       .done(data => { let text = data.parse.text['*']; $('.mw-parserpoutput').replaceWith(text); $('#tag-develop').fadeOut; });   }); }

function spamBlockInit { if(mw.config.get('wgNamespaceNumber') != 3) return; let t = document.getElementById('t-whatlinkshere'); if (!t) return; let li = document.createElement('li'); let a = document.createElement('a'); a.setAttribute('href', 'javascript:tagSpamBlock.spamBlockTagger'); a.id = 'tag-spam-block'; a.appendChild(document.createTextNode('Spam block')); li.appendChild(a); t.parentNode.appendChild(li); }

const tagSpamBlock = { spamBlockTagger, spamBlockInit };

mw.loader.using(['mediawiki.api'], => tagSpamBlock.spamBlockInit); //