Friday, September 30, 2011

Breaking Up SharePoint 2010 Social Tags

If you ever need to break up the “Tags and  Notes” and “Like It” links on a SharePoint 2010 Master Page rendered by the GlobalSiteLink3 usercontrol, you could replace the reference on your master page with the following JavaScript and HTML.  I reflected the dll which renders these global links to find that it was simply rendering the JavaScript

<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">

<script type="text/javascript">

function SendTag() {

SafeRunFunction(function () { TagDialogOpener.Open(encodeURI(window.location), document.title, '0'); }, 'SocialData.js', 'TagDialogOpener');

}

function GetQuickTag() {

SafeRunFunction(function () { var o = new SocialQuickTag('<%# this.ClientID %>'); o.url = encodeURI(window.location); o.title = document.title; o.tagged_text = 'Tagged this page with \u0027I Like It.\u0027'; o.failure_text = 'Failed tagging this page.'; o.replaceImg_style = 'border:0; left:-0px !important;top:-332px !important;position:absolute;'; o.AddQuickTag(0); }, 'SocialData.js', 'SocialQuickTag');

}

<script>

<td class="s4-socialdata-notif">

<div class="ms-socialNotif-Container">

<span class="ms-socialNotif-groupSeparator"></span>

<a class="ms-socialNotif" id="GetQuickTag" href="javascript:;" onclick="GetQuickTag();" title="Tags this page with &#39;I Like It.&#39; Tags make it easy to remember links and post items to your news feed." >

<span>

<span style="height:32px;width:32px;position:relative;display:inline-block;overflow:hidden;">

<img style="border:0; left:-0px !important;top:-132px !important;position:absolute;" id="GetQuickTagImg" alt="Tags this page with &#39;I Like It.&#39; Tags make it easy to remember links and post items to your news feed." src="/_layouts/images/mossfgimg.png"/>

</span>

<span class="ms-socialNotif-text">I Like It</span>

</span>

</a>

<a class="ms-socialNotif" id="TagsAndNotes" href="javascript:;" onclick="SendTag();" onmouseover="GetSocialNotification();" title="Tags help you remember links and classify the page. Notes are public comments. Tags and notes post to your news feed and work across different sites." >

<span>

<span style="height:32px;width:32px;position:relative;display:inline-block;overflow:hidden;">

<img style="border:0; left:-0px !important;top:-300px !important;position:absolute;" id="TagsAndNotesImg" alt="Tags help you remember links and classify the page. Notes are public comments. Tags and notes post to your news feed and work across different sites." src="/_layouts/images/mossfgimg.png"/>

</span>

<span class="ms-socialNotif-text">Tags</span>

</span>

</a>

</div>

</td>

1 comment:

  1. hi matt, cool post! I was wondering how to implement this feature myself. Could you explain to me what the <%# this.ClientID %> is? Is this rendered automatically when I put this onto a page?
    cheers!
    RoelBSS

    ReplyDelete