presence icon to the Org Chart on the Profile page

A little script that adds the presence icon to the Org Chart on the Profile page
<script type="text/javascript" src="/Scripts/jquery.min.js"></script>
<script type="text/javascript" src="/Scripts/jquery.SPServices-0.7.2.min.js"></script>
<script type="text/javascript" src="/Scripts/jquery-ui.min.js"></script>

<script type="text/javascript">

$(document).ready(function() {
   var companyEmail = "@lego.com";
   var lenghtOfUsername = 8;
   var orgNames = $("td.ms-orgname");
   orgNames.each(function(){
     var link1 = $(this).find('a');
     var hrefText = link1.attr('href');
     var username = hrefText.substr(hrefText.length - lenghtOfUsername);
     $("<span><img width=\"12\" src=\"/_layouts/images/blank.gif\" onload=\"IMNRC('" + username + companyEmail + "')\" id=\"user_ctl00_PlaceHolderMain_ctl03_im_" + username + ",type=sip\" ShowOfflinePawn=1 alt=\"Presence\"></span>").insertAfter($(this));
   });
})

</script>
<br/>

Comments

Popular Posts