Jump to content

MediaWiki:Common.js: Difference between revisions

From Artemis Archive
No edit summary
Tag: Manual revert
No edit summary
Line 1: Line 1:
$(function () {
$(function () {
     console.log('[ReportAbuseLink] Running (Styled Float)...');
     mw.loader.using('mediawiki.util').then(function () {
        console.log('[ReportAbuseLink] Inserting styled floating button...');


    // Avoid duplicate buttons
        const pageTitle = 'Report_Animal_Abuse';
    if (document.getElementById('report-abuse-button')) return;
        const linkHref = mw.util.getUrl(pageTitle);
        const linkText = '🚨 Report Abuse';


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


    // Styling
        const container = document.createElement('div');
    link.style.position = 'fixed';
        container.id = 'report-abuse-button';
    link.style.top = '16px';
        container.innerHTML = `<a href="${linkHref}" style="
    link.style.right = '90px'; // shift left to avoid overlapping menus
            display: inline-block;
    link.style.backgroundColor = '#f8f9fa'; // vector skin bg
            background-color: #b10000;
    link.style.color = '#202122';
            color: white;
    link.style.border = '1px solid #a2a9b1';
            font-weight: bold;
    link.style.padding = '6px 10px';
            font-size: 14px;
    link.style.borderRadius = '6px';
            padding: 6px 12px;
    link.style.fontSize = '14px';
            border-radius: 6px;
    link.style.fontFamily = 'system-ui, sans-serif';
            text-decoration: none;
    link.style.fontWeight = 'normal';
            position: fixed;
    link.style.zIndex = '9999';
            top: 10px;
    link.style.textDecoration = 'none';
            right: 10px;
    link.style.boxShadow = '0 1px 3px rgba(0,0,0,0.1)';
            z-index: 9999;
    link.style.transition = 'background-color 0.2s, box-shadow 0.2s';
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        ">${linkText}</a>`;


    // Hover effect
        document.body.appendChild(container);
    link.addEventListener('mouseenter', () => {
         console.log('[ReportAbuseLink] Done.');
         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.');
});
});

Revision as of 05:58, 21 April 2025

$(function () {
    mw.loader.using('mediawiki.util').then(function () {
        console.log('[ReportAbuseLink] Inserting styled floating button...');

        const pageTitle = 'Report_Animal_Abuse';
        const linkHref = mw.util.getUrl(pageTitle);
        const linkText = '🚨 Report Abuse';

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

        const container = document.createElement('div');
        container.id = 'report-abuse-button';
        container.innerHTML = `<a href="${linkHref}" style="
            display: inline-block;
            background-color: #b10000;
            color: white;
            font-weight: bold;
            font-size: 14px;
            padding: 6px 12px;
            border-radius: 6px;
            text-decoration: none;
            position: fixed;
            top: 10px;
            right: 10px;
            z-index: 9999;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        ">${linkText}</a>`;

        document.body.appendChild(container);
        console.log('[ReportAbuseLink] Done.');
    });
});