Jump to content

MediaWiki:Common.js

From Artemis Archive
Revision as of 05:56, 21 April 2025 by Bxuwd (talk | contribs)

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 () {
    console.log('[ReportAbuseLink] Running (Styled Float)...');

    // Avoid duplicate buttons
    if (document.getElementById('report-abuse-button')) return;

    const link = document.createElement('a');
    link.id = 'report-abuse-button';
    link.href = mw.util.getUrl('Report_Animal_Abuse');
    link.textContent = '🐾 Report Abuse';

    // Styling
    link.style.position = 'fixed';
    link.style.top = '16px';
    link.style.right = '90px'; // shift left to avoid overlapping menus
    link.style.backgroundColor = '#f8f9fa'; // vector skin bg
    link.style.color = '#202122';
    link.style.border = '1px solid #a2a9b1';
    link.style.padding = '6px 10px';
    link.style.borderRadius = '6px';
    link.style.fontSize = '14px';
    link.style.fontFamily = 'system-ui, sans-serif';
    link.style.fontWeight = 'normal';
    link.style.zIndex = '9999';
    link.style.textDecoration = 'none';
    link.style.boxShadow = '0 1px 3px rgba(0,0,0,0.1)';
    link.style.transition = 'background-color 0.2s, box-shadow 0.2s';

    // Hover effect
    link.addEventListener('mouseenter', () => {
        link.style.backgroundColor = '#eaf3ff';
        link.style.boxShadow = '0 2px 6px rgba(0,0,0,0.2)';
    });
    link.addEventListener('mouseleave', () => {
        link.style.backgroundColor = '#f8f9fa';
        link.style.boxShadow = '0 1px 3px rgba(0,0,0,0.1)';
    });

    document.body.appendChild(link);

    console.log('[ReportAbuseLink] Button inserted.');
});