Jump to content

MediaWiki:Common.js: Difference between revisions

From Artemis Archive
No edit summary
No edit summary
Line 1: Line 1:
$(function () {
$(function () {
     console.log('[ReportAbuseLink] Running (Header Insert)...');
     console.log('[ReportAbuseLink] Running (Forced Float)...');


     // Check if already added
     // Check if already exists
     if (document.getElementById('report-abuse-link')) {
     if (document.getElementById('report-abuse-button')) return;
        console.log('[ReportAbuseLink] Already exists.');
        return;
    }


     // Create the link element
     // Create the link
     var link = document.createElement('a');
     const link = document.createElement('a');
     link.id = 'report-abuse-link';
     link.id = 'report-abuse-button';
     link.href = mw.util.getUrl('Report_Animal_Abuse');
     link.href = mw.util.getUrl('Report_Animal_Abuse');
     link.textContent = '🐾 Report Abuse';
     link.textContent = '🐾 Report Abuse';
     link.style.color = 'red';
 
    // Style the link
    link.style.position = 'fixed';
    link.style.top = '10px';
    link.style.right = '10px';
    link.style.backgroundColor = '#c00';
     link.style.color = '#fff';
    link.style.padding = '8px 12px';
    link.style.borderRadius = '8px';
     link.style.fontWeight = 'bold';
     link.style.fontWeight = 'bold';
     link.style.marginLeft = '20px';
     link.style.zIndex = '9999';
    link.style.textDecoration = 'none';
    link.style.boxShadow = '0 2px 6px rgba(0,0,0,0.3)';
 
    // Insert into body
    document.body.appendChild(link);


     // Where to insert: near the top logo or navigation bar
     console.log('[ReportAbuseLink] Floating button inserted.');
    var header = document.querySelector('.vector-header-container');
    if (header) {
        header.appendChild(link);
        console.log('[ReportAbuseLink] Link inserted into header.');
    } else {
        console.log('[ReportAbuseLink] Header not found.');
    }
});
});

Revision as of 05:34, 21 April 2025

$(function () {
    console.log('[ReportAbuseLink] Running (Forced Float)...');

    // Check if already exists
    if (document.getElementById('report-abuse-button')) return;

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

    // Style the link
    link.style.position = 'fixed';
    link.style.top = '10px';
    link.style.right = '10px';
    link.style.backgroundColor = '#c00';
    link.style.color = '#fff';
    link.style.padding = '8px 12px';
    link.style.borderRadius = '8px';
    link.style.fontWeight = 'bold';
    link.style.zIndex = '9999';
    link.style.textDecoration = 'none';
    link.style.boxShadow = '0 2px 6px rgba(0,0,0,0.3)';

    // Insert into body
    document.body.appendChild(link);

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