skype.html 2.99 KB
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>

<script type="text/javascript" src="alfresco-skype-uri.js"></script>
<script
    src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
    
<script type="text/javascript">
   $(document).ready(function()
       {
          $("a[href$=\"/profile\"").each(function(index)
          {
             var href = $(this).attr("href");
             if (href.indexOf("/share/page/user/") > -1)
             {
                $(this).hover(function()
                {
                   // Parses out the Alfresco username.  
                   //TODO: Use regex
                   var user = "/user/";
                   var start = href.indexOf(user) + user.length;
                   var end = href.indexOf("/profile");
                   var username = href.substring(start, end);
                   var id = "skype_bubble_" + username;
                   var skypeBubble = $("#" + id);
                   
                   if (skypeBubble.length)
                   {
                      console.log("found it");
                      $(this).append(skypeBubble);
                   }
                   else 
                   {
                      //TODO: Determine if this user has a skype id, and then display Skype buttons
                      //Perhaps use Yahoo bubble like we did for Roles
                      $(this).append($("<div id=\"" + id 
                            + "\" style=\"background-color: #0094ff\" />"));
                          Skype.ui(
                             {
                            name : "dropdown",
                            element : id,
                            participants : [ "kngtinc117-test-skype" ],//["echo123"],
                            imageSize : 32,
                            imageColor : "white",
                            video : true
                         });
                   }
                   
                }, function()
                {
                   //TODO: Only remove after a few seconds if user is not hovering above this or the skype bubble
                   $(this).find("div:last").remove();
                });
             }
          });
       });
</script>

    <a href="/share/page/user/dsamarzija/profile" class="theme-color-1">Dario
        Samarzija</a>
    <br>
    <a href="/share/page/user/dsamarzija2/profile" class="theme-color-1">Dario
        Samarzija2</a>

<span id="jelena">something</span>

    <div id="SkypeButton_Call_ahmedowian_1">
        <script type="text/javascript">
                           Skype.ui(
                           {
                              "name" : "dropdown",
                              video : true,
                              "element" : "SkypeButton_Call_ahmedowian_1",
                              "participants" : [ "jelena.cule97", "echo123" ],
                              "imageSize" : 32
                           });
                        </script>
    </div>
</body>
</html>