<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>evolutionLike jQuery Plugin</title><link>https://community.telligent.com/community/11/w/api-documentation/67145/evolutionlike-jquery-plugin</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>evolutionLike jQuery Plugin</title><link>https://community.telligent.com/community/11/w/api-documentation/67145/evolutionlike-jquery-plugin</link><pubDate>Tue, 19 Nov 2019 20:29:10 GMT</pubDate><guid isPermaLink="false">ced1c8fd-9244-4c56-b71e-11bc32434ee2</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67145/evolutionlike-jquery-plugin#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/19/2019 20:29:10&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;&lt;a id="jQuery_fn_evolutionLike" name="jQuery_fn_evolutionLike"&gt;&lt;/a&gt;jQuery.fn.evolutionLike&lt;/h3&gt;
&lt;p&gt;This plugin renders a templatable, interactive, like indicator and toggle. It is typically not called directly, but instead via usage of the [[like UI Component|like UI component]]. Raises and responds to [[ui.like Client Message|ui.like]] messages.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Usage" name="Usage"&gt;&lt;/a&gt;Usage&lt;/h3&gt;
&lt;p&gt;Initializes a new plugin instance against a span:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$(&amp;#39;span.mySelector&amp;#39;).evolutionLike(options);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;jQuery.fn.evolutionLike&lt;/code&gt; also defines a method for initializing &amp;quot;Who Liked?&amp;quot; modal popups to be bound to click events via event delegation. This is also not typically called directly, but instead via usage of the [[like UI Component|like UI component]].&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.fn.evolutionLike.delegatePopups(options);
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;a id="Options" name="Options"&gt;&lt;/a&gt;Options&lt;/h3&gt;
&lt;h4&gt;&lt;a id="Primary_Options" name="Primary_Options"&gt;&lt;/a&gt;Primary Options&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contentId&lt;/code&gt;: (string) Content Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contentTypeId&lt;/code&gt;: (string) Content Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;typeId&lt;/code&gt;: (string) Like Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;initialState&lt;/code&gt;: (boolean) Currently liked by the accessing user&lt;/li&gt;
&lt;li&gt;&lt;code&gt;initialMessage&lt;/code&gt;: (string) Current like message&lt;/li&gt;
&lt;li&gt;&lt;code&gt;initialCount&lt;/code&gt;: (number) Initial like count&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;format&lt;/code&gt;: (string) text format defining the presentation of the like. While the string can contain any text, three specific tokens are replaced when they exist:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;{count}&lt;/code&gt;: Current like count (updated upon [[ui.like Client Message|ui.like]] messages)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{message}&lt;/code&gt;: Current message (updated upon [[ui.like Client Message|ui.like]] messages)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{toggle}&lt;/code&gt;: Link which toggles a like, calling &lt;code&gt;onLike&lt;/code&gt; or &lt;code&gt;onUnlike&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;onLike&lt;/code&gt;: Function which implements what happens when a like &lt;code&gt;{toggle}&lt;/code&gt; is toggled &lt;code&gt;on&lt;/code&gt;. Automatically defined by Evolution within the [[like UI Component|like UI component]], but can be overridden. Passed parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contentId&lt;/code&gt;: Content Id being liked&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contentTypeId&lt;/code&gt;: Content Type Id being liked&lt;/li&gt;
&lt;li&gt;&lt;code&gt;typeId&lt;/code&gt;: Like Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;complete&lt;/code&gt;: Callback to invoke when liking has completed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;onUnlike&lt;/code&gt;: Function which implements what happens when a like &lt;code&gt;{toggle}&lt;/code&gt; is toggled &lt;code&gt;off&lt;/code&gt;. Automatically defined by Evolution within the [[like UI Component|like UI component]], but can be overridden. Passed parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contentId&lt;/code&gt;: Content Id being liked&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contentTypeId&lt;/code&gt;: Content Type Id being liked&lt;/li&gt;
&lt;li&gt;&lt;code&gt;typeId&lt;/code&gt;: Like Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;complete&lt;/code&gt;: Callback to invoke when liking has completed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;a id="Resource_Options" name="Resource_Options"&gt;&lt;/a&gt;Resource Options&lt;/h4&gt;
&lt;p&gt;Defined (and localized) globally by Evolution, but can be overridden.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;likeText&lt;/code&gt;: Like toggle text
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;Like&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unlikeText&lt;/code&gt;: Unlike toggle text
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;Unlike&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;whoLikesOtherText&lt;/code&gt;: Like &lt;code&gt;{message}&lt;/code&gt; value when only one (non-current) user likes the content
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;&amp;lt;a href=&amp;quot;{user_profile_url}&amp;quot; class=&amp;quot;internal-link view-user-profile&amp;quot;&amp;gt;{user_display_name}&amp;lt;/a&amp;gt; likes this&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;whoLikesOtherTwoText&lt;/code&gt;: Like &lt;code&gt;{message}&lt;/code&gt; value when two users (not including the current user) like the content
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;&amp;lt;a href=&amp;quot;{user_profile_url}&amp;quot; class=&amp;quot;internal-link view-user-profile&amp;quot;&amp;gt;{user_display_name}&amp;lt;/a&amp;gt; &amp;lt;span class=&amp;quot;who-likes&amp;quot;&amp;gt;and 1 other&amp;lt;/span&amp;gt; like this.&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;whoLikesOtherMultipleText&lt;/code&gt;: Like &lt;code&gt;{message}&lt;/code&gt; value when three or more users (not including the current user) like the content
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;&amp;lt;a href=&amp;quot;{user_profile_url}&amp;quot; class=&amp;quot;internal-link view-user-profile&amp;quot;&amp;gt;{user_display_name}&amp;lt;/a&amp;gt; and &amp;lt;span class=&amp;quot;who-likes&amp;quot;&amp;gt;{count} others&amp;lt;/span&amp;gt; like this.&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;whoLikesAccessingText&lt;/code&gt;: Like &lt;code&gt;{message}&lt;/code&gt; value the current user likes the content
&lt;ul&gt;
&lt;li&gt;default: `&amp;#39;You like this&amp;#39;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;whoLikesAccessingTwoText&lt;/code&gt;: Like &lt;code&gt;{message}&lt;/code&gt; value when two users (including the current user) like the content
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;You and &amp;lt;span class=&amp;quot;who-likes&amp;quot;&amp;gt;1 other&amp;lt;/span&amp;gt; like this&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;whoLikesAccessingMultipleText&lt;/code&gt;: Like &lt;code&gt;{message}&lt;/code&gt; value when three or more users (including the current user) like the content
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;You and &amp;lt;span class=&amp;quot;who-likes&amp;quot;&amp;gt;{count} others&amp;lt;/span&amp;gt; like this&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;a id="Delegated_Popup_Modal_Options" name="Delegated_Popup_Modal_Options"&gt;&lt;/a&gt;Delegated Popup Modal Options&lt;/h4&gt;
&lt;p&gt;For calls to &lt;code&gt;$.fn.evolutionLike.delegatePopups(options)&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;modalTitleText&lt;/code&gt;: Modal title
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;People who like this&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;containerSelector&lt;/code&gt;: Container elements on which to bind &amp;#39;click&amp;#39; events to initiate modals
&lt;ul&gt;
&lt;li&gt;default: &amp;#39;.content-fragment&amp;#39;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delegatedSelector&lt;/code&gt;: Specific elements on which to delegate &amp;#39;click&amp;#39; events.
&lt;ul&gt;
&lt;li&gt;default: &amp;#39;.ui-like&amp;#39;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;onList&lt;/code&gt;: Function which returns a list of users who have liked a content item. Passed parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contentId&lt;/code&gt;: Content Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contentTypeId&lt;/code&gt;: Content Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;typeId&lt;/code&gt;: Like Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;complete&lt;/code&gt;: Callback to invoke when liking has completed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pageSize&lt;/code&gt;: Likes to return per page&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pageIndex&lt;/code&gt;: Page index&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;onOptions&lt;/code&gt;: A function which parses an element for data to use in calls to &lt;code&gt;onList&lt;/code&gt;. Passed the element which triggered the delegated event handler. Must return an object with &lt;code&gt;contentId&lt;/code&gt;, &lt;code&gt;contentTypeId&lt;/code&gt;, and &lt;code&gt;typeId&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;likersTemplate&lt;/code&gt;: [[template JavaScript API Module|Template]] defining the display of a page of likers within the modal&lt;/li&gt;
&lt;li&gt;&lt;code&gt;likersPopupTemplate&lt;/code&gt;: [[template JavaScript API Module|Template]] defining the modal&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;default &lt;code&gt;likersTemplate&lt;/code&gt;&lt;/em&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;% foreach(likers, function(liker) { %&amp;gt;
    &amp;lt;li class=&amp;quot;content-item&amp;quot;&amp;gt;
        &amp;lt;div class=&amp;quot;full-post-header&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class=&amp;quot;full-post&amp;quot;&amp;gt;
            &amp;lt;span class=&amp;quot;avatar&amp;quot;&amp;gt;
                &amp;lt;a href=&amp;quot;&amp;lt;%: liker.profileUrl %&amp;gt;&amp;quot;  class=&amp;quot;internal-link view-user-profile&amp;quot;&amp;gt;
                    &amp;lt;% if(liker.avatarHtml) { %&amp;gt;
                        &amp;lt;%= liker.avatarHtml %&amp;gt;
                    &amp;lt;% } else { %&amp;gt;
                        &amp;lt;img src=&amp;quot;&amp;lt;%: liker.avatarUrl %&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; border=&amp;quot;0&amp;quot; width=&amp;quot;32&amp;quot; height=&amp;quot;32&amp;quot; style=&amp;quot;width:32px;height:32px&amp;quot; /&amp;gt;
                    &amp;lt;% } %&amp;gt;
                &amp;lt;/a&amp;gt;
            &amp;lt;/span&amp;gt;
            &amp;lt;span class=&amp;quot;user-name&amp;quot;&amp;gt;
                &amp;lt;a href=&amp;quot;&amp;lt;%: liker.profileUrl %&amp;gt;&amp;quot; class=&amp;quot;internal-link view-user-profile&amp;quot;&amp;gt;&amp;lt;%= liker.displayName %&amp;gt;&amp;lt;/a&amp;gt;
            &amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class=&amp;quot;full-post-footer&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/li&amp;gt;
&amp;lt;% }); %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;default &lt;code&gt;likersPopupTemplate&lt;/code&gt;&lt;/em&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&amp;quot;who-likes-list&amp;quot;&amp;gt;
    &amp;lt;div class=&amp;quot;content-list-header&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;ul class=&amp;quot;content-list&amp;quot;&amp;gt;&amp;lt;%= likers %&amp;gt;&amp;lt;/ul&amp;gt;
    &amp;lt;div class=&amp;quot;content-list-footer&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;% if(hasMorePages) { %&amp;gt;
        &amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;show-more&amp;quot;&amp;gt;&amp;lt;%= showMoreText %&amp;gt;&amp;lt;/a&amp;gt;
    &amp;lt;% } %&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>