User:Acagastya/develop.js

// const tagger = => { let api = new mw.Api; api.postWithToken('edit', {   action: 'edit',    title: mw.config.get('wgPageName'),    prependtext: '',    summary: 'required tag'  }).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; }); }); }

const init = => { if(mw.config.get('wgNamespaceNumber') != 0) return; let t = document.getElementById('p-article-tools'); if(!t) return; let li = document.createElement('li'); let a = document.createElement('a'); a.setAttribute('href', 'javascript:tagDevelop.tagger'); a.setAttribute('id', 'tag-develop'); a.innerText = 'Tag develop'; li.setAttribute('id', 'ca-tagdevelop'); li.appendChild(a);

const tBody = [...t.children][1]; const ul = [...tBody.children][0]; ul.appendChild(li); }

const tagDevelop = { tagger, init };

$.when(mw.loader.using(['mediawiki.util']), $.ready).done(tagDevelop.init); //