User:Bradv/Scripts/linktocomment.js

(function( $, mw ) {   'use strict';

mw.util.addCSS(`       a.linktocomment img {            height: 0.8em;            filter: opacity(0.5);        }        a.linktocomment img:hover {            filter: unset;        }    `)

$('span[data-mw-comment-end]').each(function {        let span = $(this);        if (span.parents('.mw-headline').length == 0) {            $('', {'class': 'linktocomment', 'href':'#' + span.attr('data-mw-comment-end')})                .append($(' ', {'src': 'https://upload.wikimedia.org/wikipedia/commons/5/56/Chain_link_icon_slanted.png'}))                .insertAfter(span);        }    })

}(jQuery, mediaWiki ));