forked from easemob/kefu-webim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
executable file
·96 lines (84 loc) · 2.62 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,user-scalable=no">
<style>
body { background-color: #eee;color: #555; }
button, a { display: block;margin: 20px 0;background: #00CEB9;border: none;color: #fff;line-height: 40px;width: 200px;cursor: pointer;outline: none;text-align: center; }
button:hover, a:hover { box-shadow: 0 0 5px #33CEB9; }
button:active, a:active { background: #fff;color: #00CEB9; }
input { height: 40px;outline: none;width: 300px;text-align: center;font-size: 16px;color: #00CEB9; float: left;border: 1px solid #fff; }
</style>
</head>
<body>
<h1>Demo</h1>
<a target="_blank" href="http://docs.easemob.com/cs/300visitoraccess/web-widget">集成文档</a>
<a target="_blank" href="demos/custom-launch-button.html">自定义按钮样式demo</a>
<br>
<br>
<br>
<br>
<br>
<br>
<h1>测试</h1>
<div><input id="testvalue" type="text" placeholder="请输入您的tenantId,点击测试按钮"/></div>
<button onclick="test()">测试</button>
<button onclick="deleteCurrentCookies()">Clear Current Cookie</button>
<button onclick="bindSkillGroup()">绑定技能组</button>
<button onclick="resizeChatWindow()">窗口加宽</button>
<br>
<br>
<br>
<script>
var tenantIdInput = document.getElementById("testvalue");
tenantIdInput.value = (window.localStorage && localStorage.getItem("easemobtest")) || "";
function test(){
window.easemobim.bind({ tenantId: getTenantId() });
}
function getTenantId(){
var tenantId = tenantIdInput.value;
tenantId = tenantId && tenantId.replace(/\s/g, "");
if(/\d+/.test(tenantId)) {
window.localStorage && localStorage.setItem("easemobtest", tenantId);
return tenantId;
}
}
function deleteCurrentCookies(){
var name = window.easemobim.config.tenantId || tenantIdInput.value;
name && (document.cookie = name
+ "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/");
alert("cleared");
}
function bindSkillGroup(){
window.easemobim.bind({
tenantId: getTenantId(),
emgroup: "技能组1"
});
}
function resizeChatWindow(){
window.easemobim.bind({
tenantId: getTenantId(),
dialogWidth: "500px"
});
}
</script>
<script>
window.easemobim = window.easemobim || {};
window.easemobim.config = {
domain: "//sandbox.kefu.easemob.com",
// domain: "//kefu.easemob.com",
// 访客自动上报
// eventCollector: true,
satisfaction: true,
// hide: false,
// minimum: false,
tenantId: "11885",
unused: ""
};
</script>
<script src="easemob.js"></script>
</body>
</html>