MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(function () { mw.loader.using('mediawiki.util').then(function () { console.log('[ReportAbuseLink] Starting...'); const reportLinkText = '🐾 Report Abuse'; const reportPageURL = mw.util.getUrl('Report_Animal_Abuse'); // Change if your page name differs let attempts = 0; const maxAttempts = 50; const tryInsert = function () { const personalMenu = document.querySelector('#p-personal ul.vector-menu-content-list'); const loginItem = document.querySelector('#pt-login-2'); if (personalMenu && loginItem) { console.log('[ReportAbuseLink] Found login item. Inserting before it.'); const li = document.createElement('li'); li.id = 'pt-reportabuse'; const a = document.createElement('a'); a.href = reportPageURL; a.textContent = reportLinkText; a.title = 'Report animal abuse to authorities or NGOs'; li.appendChild(a); personalMenu.insertBefore(li, loginItem); return true; } else if (personalMenu && attempts >= maxAttempts) { console.log('[ReportAbuseLink] Login item not found after max attempts. Appending to end.'); const li = document.createElement('li'); li.id = 'pt-reportabuse'; const a = document.createElement('a'); a.href = reportPageURL; a.textContent = reportLinkText; a.title = 'Report animal abuse to authorities or NGOs'; li.appendChild(a); personalMenu.appendChild(li); return true; } return false; }; const interval = setInterval(function () { attempts++; if (tryInsert() || attempts >= maxAttempts) { clearInterval(interval); console.log('[ReportAbuseLink] Done.'); } }, 100); }); });