User:Polygnotus/warn-when-editing-userpages.js

// User script to warn when editing a userpage instead of talkpage (function {   if (mw.config.get('wgNamespaceNumber') === 2 && mw.config.get('wgAction') === 'edit') {        var pageName = mw.config.get('wgTitle');        var currentUser = mw.config.get('wgUserName');        var pageOwner = pageName.split('/')[0]; // Get the owner of the user page

if (pageOwner !== currentUser) { var warningMessage = ` Warning: You are about to edit a user page that is not yours. It is recommended to edit the user's talk page instead. `;

$('#editform').prepend(warningMessage); alert("You are about to edit a user page that is not yours. Consider editing the user's talk page instead."); }   } });