【问题标题】:How can I use skype-uri.js with personalized buttons?如何使用带有个性化按钮的 skype-uri.js?
【发布时间】:2013-04-09 20:51:00
【问题描述】:

我想使用Skype UI Reference 中的skype-ui,但我不喜欢使用Skype 提供的“图像资源”。我已经创建了我的个性化 Skype 按钮并且我想使用它。我该怎么做?

我知道有这样的代码:

<a href="skype:echo123?call">Call</a> the Skype Echo / Sound Test Service

它可以很容易地用作任何类型的按钮,但是在没有安装任何 Skype 的计算机上使用它时,它不允许我在 Skype 的下载页面中重定向。与使用js脚本时不同:

<div id="call_32" style="width:20%;background-color:#0094ff">
<script type="text/javascript">
    Skype.ui({
        name: "call",
        element: "call_32",
        participants: ["echo123"],
        imageSize: 32,
        imageColor: "white"
    });
 </script>
</div>

但它不允许我使用个性化按钮。

请帮忙。

谢谢,

标记

【问题讨论】:

    标签: javascript skype


    【解决方案1】:

    基于above answerFrançois-Xavier De Nys

    支持通话和聊天链接。

    echo123 替换为您的 Skype ID。

    脚本:

    <script src="https://secure.skypeassets.com/i/scom/js/skype-uri.js"></script>
    
    <script>
    // code for adding and clicking hidden Skype buttons
    var
    SkypeButtons_ek = {},
    
    // call when doc ready to setup the hidden button
    // id = any unique id, user = your skype user id, type = call or chat
    SkypeButton_ek_add = function(id, user, type){
      SkypeButtons_ek[id] = {user: user, type: type};
      jQuery("body").append('<div id="SkypeButton_ek_'+id+'"></div>');
      Skype.ui({
        "name": type,
        "element": "SkypeButton_ek_"+id,
        "participants": [user]
      });
      jQuery("#SkypeButton_ek_"+id+", #SkypeButton_ek_"+id+" > iframe").hide();
    },
    
    // call from your own link/button/event
    // id is the same id you passed to SkypeButton_ek_add
    SkypeButton_ek_click = function(id){
      if (SkypeButtons_ek[id].type == 'chat')
        SkypeWebControl.SDK.Chat.startChat({ConversationType: 'person', ConversationId: SkypeButtons_ek[id].user});
      else {
        Skype.tryAnalyzeSkypeUri(SkypeButtons_ek[id].type, '0');
        Skype.trySkypeUri_Generic('skype:'+SkypeButtons_ek[id].user+'?'+SkypeButtons_ek[id].type+'', jQuery('#SkypeButton_ek_'+id+' > iframe').attr('id'), '0');
      }
    };
    
    // add Skype buttons hidden
    jQuery(document).ready(function($){
      SkypeButton_ek_add(1, 'echo123', 'chat'); 
      SkypeButton_ek_add(2, 'echo123', 'call'); 
    });
    </script>
    

    标记

    <a href="" onclick="SkypeButton_ek_click(1); return false;">Skype Chat</a>
    <a href="" onclick="SkypeButton_ek_click(2); return false;">Skype Call</a>
    

    您当然可以将SkypeButton_ek_click 调用添加或绑定到任何事件。

    【讨论】:

      【解决方案2】:

      1) 插入 Skype 按钮,如下所述: http://www.skype.com/en/features/skype-buttons/create-skype-buttons/

      2) 隐藏 Skype 按钮 div。

      $('#SkypeButton_Call_your_skype_id_1').css('display', 'none');
      

      3) 放置您自己的图片/链接

      <a href="" onclick="skype_contact();">Call me</a>
      

      4) 将此函数放在您的 js 文件中。 (与点击Skype按钮时触发的代码相同)

      function skype_contact()
      {
          Skype.tryAnalyzeSkypeUri('call', '0');
          Skype.trySkypeUri_Generic('skype:your_skype_id?call', $('#SkypeButton_Call_your_skype_id_1 > iframe').attr('id'), '0');         
      }
      

      【讨论】:

        【解决方案3】:
        `<a href="skype:your skype id">`your icon or button here</a>
        

        在此处阅读有关 Skype 按钮的更多信息 http://msdn.microsoft.com/en-us/library/office/dn745878

        【讨论】:

        • 嗯?这是怎么回答的?
        【解决方案4】:

        试试这个,这行得通..

        <html>
        <script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
        <div id="SkypeButton_Call_dhruv_1">
          <script type="text/javascript">
            Skype.ui({
              "name": "call",
              "element": "SkypeButton_Call_dhruv_1",
              "participants": ["dhruv"],
              "imageSize": 32
            });
          </script>
        </div>
        </html>
        

        【讨论】:

          【解决方案5】:

          我知道这个问题有点老了,但由于我刚刚遇到同样的问题,我想我会分享我的解决方案。

          按照按钮前某处的说明包含 skypeui.js 包

          <script type="text/javascript" src="http://cdn.dev.skype.com/uri/skype-uri.js"></script>
          

          然后只需使用以下标记,将“myskypename”替换为您要呼叫的 Skype 名称或号码。

          <div id="MyDiv">
             <a onclick="Skype.tryAnalyzeSkypeUri('call', '0');" href="skype:myskypename?call">
                <img role="Button" src="/images/mybutton.gif">
             </a>
          </div>
          

          【讨论】:

          • 不错!为我工作。感谢分享。
          • 这是最好的答案!谢谢
          猜你喜欢
          • 2017-03-09
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-03-14
          • 1970-01-01
          • 1970-01-01
          • 2020-01-18
          相关资源
          最近更新 更多