javascript 如何使用带有个性化按钮的 skype-uri.js?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16054167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 03:05:06  来源:igfitidea点击:

How can I use skype-uri.js with personalized buttons?

javascriptskype

提问by mark lape

I want to use the skype-ui found in Skype UI Referencebut I don't like to use the "image assets" that Skype has available. I have created my personalized Skype button and I want to use it. How can I do this?

我想使用Skype UI 参考中的Skype-ui,但我不喜欢使用 Skype 可用的“图像资产”。我已经创建了我的个性化 Skype 按钮,我想使用它。我怎样才能做到这一点?

I know that there is a code like this:

我知道有这样的代码:

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

and it can easily be use as any kind of button but when using this on a computer that doesn't have any skype installed, the thing won't allow me to redirect in the downloads page of skype. Unlike when using the js script:

它可以很容易地用作任何类型的按钮,但是当在没有安装任何 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>

But it won't let me use a personalized button.

但它不会让我使用个性化按钮。

Please help.

请帮忙。

Thanks,

谢谢,

mark

标记

回答by dwperrin

I know this question is a bit old, but as I just faced the same problem I thought I would share my solution.

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

Include the skypeui.js package as instructed somewhere before the button

按照指示在按钮前的某处包含 skypeui.js 包

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

Then simply use the following markup, replace "myskypename" with the skype name or number you would like to call.

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

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

回答by Fran?ois-Xavier De Nys

1) Insert the skype button like explained here : http://www.skype.com/en/features/skype-buttons/create-skype-buttons/

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

2) Hide the skype button div.

2)隐藏Skype按钮div。

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

3) Place your own image / link

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

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

4) Place this function in your js file. (it's the same code than the one that's triggered when you click on the skype Button)

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');         
}

回答by ekerner

Based on above answerby Fran?ois-Xavier De Nys

基于以上答案弗朗索瓦-格扎维埃·德NYS

Supports call and chat links.

支持通话和聊天链接。

Replace echo123with your skype ID.

echo123替换为您的 Skype ID。

Scripts:

脚本:

<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>

Markup

标记

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

You can of course add or bind the SkypeButton_ek_clickcall to any event.

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

回答by user3243696

Try this, this is working..

试试这个,这是工作..

<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>

回答by TM Dinesh

`<a href="skype:your skype id">`your icon or button here</a>

read more about skype button here http://msdn.microsoft.com/en-us/library/office/dn745878

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