Jump to content

User:Gommeh/SPIlink.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
mw.loader.using('mediawiki.util', function() {
    var addCategoryLinkWithImage = function(imageSrc) {
        $('#pt-notifications-notice').after(
            $('<li>').append(
                $('<a href="/wiki/Wikipedia:Sockpuppet_investigations" title="Wikipedia:Sockpuppet investigations">')
                .append(
                    $('<img width="20" height="20" style="cursor:pointer;">')
                    .css({
                        'padding': '0.25em 0.45em 0.2em',
                        'cursor': 'pointer'
                    })
                    .attr('src', imageSrc)
                )
            ).css({
                'opacity': '1',
                'transition': 'opacity 0.5s'
            })
        );
    };

    $(document).ready(function() {
        var yourImageSrc = '/media/wikipedia/commons/4/42/HandKnittedWhiteLaceSock.jpg';
        addCategoryLinkWithImage(yourImageSrc);
    });
});