inherit
220606
0
Nov 9, 2023 11:33:17 GMT -8
tpgettys
596
April 2015
tpgettys
|
Post by tpgettys on Jul 19, 2015 17:50:19 GMT -8
I don't know if this would better fit a template change or plugin...
We had a request for the list of user's liking a post to explicitly include the viewer if they were one of the one's liking it.
Right now, it is "user1, user2 and 3 more like this" Change to something like "you, user1, user2 and 2 more like this" if the viewer is one of the "likers"
As it is, they have to click the "3 more" to see if their were one of them.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 20, 2015 17:57:23 GMT -8
They may be unaware of this or are perhaps more likely using a skin/theme that hides this very useful feature, but the like button "lights up" and remains that way for every post you like until you take back that like. Later on when you revisit a thread any posts you've previously liked will have the like button lit up to indicate this. Try it out, like yourself then come back and see if you're still liked. This code, if you still want it, would take advantage of that lit up like button to identify which posts were liked by the current user and modify the name list accordingly. Global Header: <script> /* Add yourself to the list of post likers for easy recognition on low contrast skins */ (function(){ function likers_gonna_like(){ var user = proboards.dataHash.user function likeUrself(ev){ var $button = $(ev.target) var $likers = $button.closest('.content-head').find('.info .likes'); if($button.hasClass('liked')){ if($('.user-'+user.id,$likers).length == 0){ var me = $('<a href="'+user.url+'" title="@'+user.username+'" class="'+'user-link user-'+user.id + ' group-'+(user.group_ids[0]||"0")+'" itemprop="url">, ') .append('<span itemprop="name">You</span>') .prependTo($likers) .wrap('<span itemscope itemtype="http://schema.org/Person">'); me.parent().after(', '); $('a.view-likes',$likers).text($('a.view-likes',$likers).text().replace(/^(\d+)/, function(m,p){return p-1;})); // grab name style if a similar one is on page if( user.group_ids.length){ var s = $('.user-'+user.id).not(me) if(s.length==0){ s = $('.user-'+user.id+',.user-link.group-' + user.group_ids.join('[style],user-link.group-') + '[style]').not(me).first(); }else{ me.attr('class', s.attr('class')); } if( s.length && s.attr('style')){ me.attr('style', s.attr('style')); } } } } } $('.likes-button').each(function(index,button){ $(button).one('click.urself',function(){ $(document).ajaxComplete(function(ev,xhr,opts){ if(opts.url == '/post/like'){ likeUrself({target:button}) } }) }) likeUrself({target:button}) }); } $(likers_gonna_like); proboards.on('afterSearch', likers_gonna_like); })() </script> or as a plugin
|
|
inherit
220606
0
Nov 9, 2023 11:33:17 GMT -8
tpgettys
596
April 2015
tpgettys
|
Post by tpgettys on Jul 20, 2015 20:24:43 GMT -8
Thank you very much for your reply. I found out that the like button changes color when viewing a post you liked, so all I needed for our purposes was to make the color change more prominent.
|
|