User:WikiMacaroons/surname.js

var surname = $(mw.util.addPortletLink('p-personal','#','Surname','Add a (surname) redirect','Add a (surname) redirect','','#pt-mytalk')); var surname = $(mw.util.addPortletLink('p-personal','#','Forename','Add a (forename) redirect','Add a (forename) redirect','','#pt-mytalk')); originalsur = document.getElementById("firstHeading").textContent; $( surname ).click( function {		  var params = {				action: 'edit',				title: document.getElementById("firstHeading").textContent+" (surname)",				prependtext: "#REDIRECT "+originalsur+"",				summary: "Redirect automatically added using WikiMacaroons' stupid redirect tool.",				format: 'json'			},			api = new mw.Api;		api.postWithToken( 'csrf', params ).done( function ( data ) { //alert( data ); } ); }); $( surname ).click( function {		  var params = {				action: 'edit',				title: document.getElementById("firstHeading").textContent+" (forename)",				prependtext: "#REDIRECT "+originalsur+"",				summary: "Redirect automatically added using WikiMacaroons' stupid redirect tool.",				format: 'json'			},			api = new mw.Api;		api.postWithToken( 'csrf', params ).done( function ( data ) { //alert( data ); } ); });