forked from microsoft/BotFramework-WebChat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
expandable.html
95 lines (78 loc) · 2.3 KB
/
expandable.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.feedyou.ai/webchat/latest/botchat.css" rel="stylesheet" />
<style>
body {
background-color: #000;
font-family: Helvetica, Arial;
padding: 30px;
}
h1 {
font-family: "Helvetica";
color: #e51836;
}
body>p {
color: #fff;
width: 600px;
}
.header h1 {
color: #e51836;
}
#bot-wrapper {
background-color: #fff;
width: 450px;
max-width: 94%;
height: 700px;
max-height: 75%;
position: fixed;
right: 3%;
bottom: 0px;
}
#bot-wrapper.collapsed #bot {
display: none;
}
#bot-wrapper.collapsed {
height: auto;
}
#bot-header {
color: white;
background-color: #e51836;
height: 19px;
padding: 8px;
cursor: pointer;
}
</style>
</head>
<body>
<div id="bot-wrapper" class="collapsed">
<div id="bot-header">
Click here for more information!
</div>
<div id="bot"></div>
</div>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="https://cdn.feedyou.ai/webchat/latest/botchat-es5.js"></script>
<script>
$(function() {
// Note that `BotChat` component is initialized only after chat window is expanded, so bot is not triggered for users who not open chat.
// OPTIONAL - auto expand after given delay
// setTimeout(function() { $('#bot-wrapper').hasClass('collapsed') && $('#bot-header').click() }, 3000);
$('#bot-header').click(function() {
$('#bot-wrapper').toggleClass('collapsed')
if ($('#bot').is(':empty')) {
$('#bot-header').html('Chatbot')
BotChat.App({
// YOU WILL RECIEVE FOLLOWING ... VALUES FROM FEEDYOU
directLine: { secret: '...' }, // TRY THIS DURING TESTING: flYcEctmv88.cwA.PSk.iaausLq-Qu1ctHCDVtBStyXtukwWaKdmj9Tzp64J8Jo
bot: { id: 'feedbot-...', name: '...' }, // TRY THESE DURING TESTING: { id: 'feedbot-demo-webchat', name: 'DEMO WebChat' }
theme: { mainColor: '#D83838' },
// SEE https://github.com/wearefeedyou/feedbot-webchat FOR OPTIONAL PARAMS
}, document.getElementById("bot"));
}
})
})
</script>
</body>
</html>