User:1otheraaa/vector.js

mw.notify("Welcome to Redwarn") var myClasses = document.getElementsByClassName("mw-usertoollinks-talk");

for (var i = 0; i < myClasses.length; i++) { //myClasses[i].href.split("User_talk:")[1].split("&amp;")[0] //myClasses[i].href = null let button = document.createElement('button') button.setAttribute('onclick',   'edit(this.parentNode.getElementsByClassName("mw-usertoollinks-talk")[0].href.split("User_talk:")[1].split("&action=edit")[0])'); button.innerHTML = "Warn" myClasses[i].parentNode.appendChild(button); }

const wikiAPI = mw.config.get("wgServer") + mw.config.get("wgScriptPath") + "/api.php"; // mediawiki API path (i.e. //en.wikipedia.org/w/api.php) function edit(page) { $.post(wikiAPI, { // LOCALISATION ISSUE!!            "action": "edit",            "token": mw.user.tokens.get("csrfToken"),            "title": "User_talk:" + page,            "summary": "ISP notice (RW modified)", // summary sign here            "text": "",        }); mw.notify("Done") }