$(function() { atReply(); }); /* Inspired by * http://iyus.info/at-reply-petit-plugin-wordpress-inspire-par-twitter/ */ function atReply() { // empty and remove old links, // see http://api.jquery.com/remove/#comment-41237758 $('a.at_reply_link').empty().remove(); // add links $('span.commentAuthor').each(function() { /* duplicate the link to create an element on-the-fly, because the element with its event can't be used twice */ var commentAuthor = $(this).parent().children('.commentAuthor'); var id = commentAuthor.attr('id').replace('atreply_','c'); var name = commentAuthor.attr('title'); var link = $(atReplyLink).click( function () { $('#c_content').val($('#c_content').val()+ '@['+name+'|'+atReplyEntryURL+'#'+id+'] : '); /* show comment form on Noviny theme and its derivatives */ $('#comment-form h3').find('a').trigger('click'); /* Noviny will put the focus on the name field, set the focus to the comment content*/ $('#c_content').focus(); return false; }); /* add the link */ $(this).parent().append(link); var titleWithAuthor = $(this).parent().find('a:last').attr('title').replace("{author}",name); $(this).parent().find('a').attr('title', titleWithAuthor); $(this).parent().find('img').attr('alt', titleWithAuthor); $(this).parent().find('.at_reply_title').html(titleWithAuthor); if (atReplyDisplayTitle) { /* add an hover effect */ $(this).parent().hover( function () { $(this).find('.at_reply_title').show(); }, function () { $(this).find('.at_reply_title').hide(); }); } }); }