RohanHBTU commited on
Commit
ec24108
1 Parent(s): 223f3a7

Upload 3 files

Browse files
static/style.css ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body,html{
2
+ height: 100%;
3
+ margin: 0;
4
+ background: rgb(255, 255, 255);
5
+ background: -webkit-linear-gradient(to right, rgb(196, 200, 195), rgb(201, 216, 241), rgb(192, 192, 237));
6
+ background: linear-gradient(to right, rgb(144, 199, 241), rgb(199, 204, 216), rgb(204, 204, 222));
7
+ }
8
+
9
+ .chat{
10
+ margin-top: auto;
11
+ margin-bottom: auto;
12
+ }
13
+ .card{
14
+ height: 500px;
15
+ border-radius: 15px !important;
16
+ background-color: rgba(35, 50, 138, 0.677) !important;
17
+ }
18
+ .msg_card_body{
19
+ overflow-y: auto;
20
+ }
21
+ .msg_card_body::-webkit-scrollbar {
22
+ width: 12px; /* width of the entire scrollbar */
23
+ }
24
+
25
+ /*.msg_card_body::-webkit-scrollbar-track {
26
+ background-color: rgba(35, 50, 138, 0.677) !important;
27
+ }*/
28
+
29
+ .msg_card_body::-webkit-scrollbar-thumb {
30
+ background-color: rgba(35, 50, 138, 0.677) !important;
31
+ border-radius: 20px; /* roundness of the scroll thumb */
32
+ /*border: 3px solid orange; creates padding around scroll thumb */
33
+ }
34
+ .contacts_body{
35
+ padding: 0.75rem 0 !important;
36
+ overflow-y: auto;
37
+ white-space: nowrap;
38
+ }
39
+ .card-header{
40
+ border-radius: 15px 15px 0 0 !important;
41
+ border-bottom: 0 !important;
42
+ background-color: rgba(31, 46, 130, 0.677) !important;
43
+ }
44
+ .card-footer{
45
+ border-radius: 0 0 15px 15px !important;
46
+ border-top: 0 !important;
47
+ }
48
+ .container{
49
+ align-content: center;
50
+ }
51
+ .search{
52
+ border-radius: 15px 0 0 15px !important;
53
+ background-color: rgb(0, 0, 0) !important;
54
+ border:0 !important;
55
+ color:white !important;
56
+ }
57
+ .search:focus{
58
+ box-shadow:none !important;
59
+ outline:0px !important;
60
+ }
61
+ .type_msg{
62
+ background-color: rgba(0, 0, 0, 0.549) !important;
63
+ border:0 !important;
64
+ color:white !important;
65
+ height: 60px !important;
66
+ overflow-y: auto;
67
+ }
68
+ .type_msg:focus{
69
+ box-shadow:none !important;
70
+ outline:0px !important;
71
+ }
72
+ .attach_btn{
73
+ border-radius: 15px 0 0 15px !important;
74
+ background-color: rgba(201, 13, 13, 0.267) !important;
75
+ border:0 !important;
76
+ color: white !important;
77
+ cursor: pointer;
78
+ }
79
+ .send_btn{
80
+ border-radius: 0 15px 15px 0 !important;
81
+ background-color: rgba(0,0,0,0.3) !important;
82
+ border:0 !important;
83
+ color: white !important;
84
+ cursor: pointer;
85
+ }
86
+ .search_btn{
87
+ border-radius: 0 15px 15px 0 !important;
88
+ background-color: rgba(0,0,0,0.3) !important;
89
+ border:0 !important;
90
+ color: white !important;
91
+ cursor: pointer;
92
+ }
93
+ .contacts{
94
+ list-style: none;
95
+ padding: 0;
96
+ }
97
+ .contacts li{
98
+ width: 100% !important;
99
+ padding: 5px 10px;
100
+ margin-bottom: 15px !important;
101
+ }
102
+ .active{
103
+ background-color: rgba(0, 0, 0, 0.479);
104
+ }
105
+ .user_img{
106
+ height: 70px;
107
+ width: 70px;
108
+ /*border:1.5px solid #f5f6fa;*/
109
+
110
+ }
111
+ .user_img_msg{
112
+ height: 40px;
113
+ width: 40px;
114
+ /*border:1.5px solid #f5f6fa;*/
115
+ border: 0;
116
+
117
+ }
118
+ .img_cont{
119
+ position: relative;
120
+ height: 70px;
121
+ width: 70px;
122
+ }
123
+ .img_cont_msg{
124
+ height: 40px;
125
+ width: 40px;
126
+ }
127
+ .online_icon{
128
+ position: absolute;
129
+ height: 15px;
130
+ width:15px;
131
+ background-color: #4cd137;
132
+ border-radius: 50%;
133
+ bottom: 0.2em;
134
+ right: 0.4em;
135
+ border:1.5px solid white;
136
+ }
137
+ .offline{
138
+ background-color: #c23616 !important;
139
+ }
140
+ .user_info{
141
+ margin-top: auto;
142
+ margin-bottom: auto;
143
+ margin-left: 15px;
144
+ }
145
+ .user_info span{
146
+ font-size: 20px;
147
+ color: white;
148
+ }
149
+ .user_info p{
150
+ font-size: 10px;
151
+ color: rgba(255,255,255,0.6);
152
+ }
153
+ .video_cam{
154
+ margin-left: 50px;
155
+ margin-top: 5px;
156
+ }
157
+ .video_cam span{
158
+ color: white;
159
+ font-size: 20px;
160
+ cursor: pointer;
161
+ margin-right: 20px;
162
+ }
163
+ .msg_cotainer{
164
+ margin-top: auto;
165
+ margin-bottom: auto;
166
+ margin-left: 10px;
167
+ border-radius: 25px;
168
+ background-color: rgb(212, 75, 75);
169
+ padding: 10px;
170
+ position: relative;
171
+ }
172
+ .msg_cotainer_send{
173
+ margin-top: auto;
174
+ margin-bottom: auto;
175
+ margin-right: 10px;
176
+ border-radius: 25px;
177
+ background-color: #58cc71;
178
+ padding: 10px;
179
+ position: relative;
180
+ }
181
+ .msg_time{
182
+ position: absolute;
183
+ left: 0;
184
+ bottom: -15px;
185
+ color: rgba(255,255,255,0.5);
186
+ font-size: 10px;
187
+ }
188
+ .msg_time_send{
189
+ position: absolute;
190
+ right:0;
191
+ bottom: -15px;
192
+ color: rgba(255,255,255,0.5);
193
+ font-size: 10px;
194
+ }
195
+ .msg_head{
196
+ position: relative;
197
+ }
198
+ #action_menu_btn{
199
+ position: absolute;
200
+ right: 10px;
201
+ top: 10px;
202
+ color: white;
203
+ cursor: pointer;
204
+ font-size: 20px;
205
+ }
206
+ .action_menu{
207
+ z-index: 1;
208
+ position: absolute;
209
+ padding: 15px 0;
210
+ background-color: rgba(0,0,0,0.5);
211
+ color: white;
212
+ border-radius: 15px;
213
+ top: 30px;
214
+ right: 15px;
215
+ display: none;
216
+ }
217
+ .action_menu ul{
218
+ list-style: none;
219
+ padding: 0;
220
+ margin: 0;
221
+ }
222
+ .action_menu ul li{
223
+ width: 100%;
224
+ padding: 10px 15px;
225
+ margin-bottom: 5px;
226
+ }
227
+ .action_menu ul li i{
228
+ padding-right: 10px;
229
+ }
230
+ .action_menu ul li:hover{
231
+ cursor: pointer;
232
+ background-color: rgba(0,0,0,0.2);
233
+ }
234
+ @media(max-width: 576px){
235
+ .contacts_card{
236
+ margin-bottom: 15px !important;
237
+ }
238
+ }
templates/RedHenNoBackgroundNewVistaPrintSmall.png ADDED
templates/chat.html ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
2
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
3
+ <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
4
+
5
+ <!DOCTYPE html>
6
+ <html>
7
+ <head>
8
+ <title>Chatbot</title>
9
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
10
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
11
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
12
+ <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css')}}"/>
13
+ </head>
14
+
15
+
16
+ <body>
17
+ <div class="container-fluid h-100">
18
+ <div class="row justify-content-center h-100">
19
+ <div class="col-md-8 col-xl-6 chat">
20
+ <div class="card">
21
+ <div class="card-header msg_head">
22
+ <div class="d-flex bd-highlight">
23
+ <div class="img_cont">
24
+ <img src="https://avatars.githubusercontent.com/u/8597243?s=200&v=4" class="rounded-circle user_img">
25
+ <span class="online_icon"></span>
26
+ </div>
27
+ <div class="user_info">
28
+ <span>Red Hen Bot</span>
29
+ <p>Ask me anything!</p>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ <div id="messageFormeight" class="card-body msg_card_body">
34
+
35
+
36
+ </div>
37
+ <div class="card-footer">
38
+ <form id="messageArea" class="input-group">
39
+ <input type="text" id="text" name="msg" placeholder="Type your message..." autocomplete="off" class="form-control type_msg" required/>
40
+ <div class="input-group-append">
41
+ <button type="submit" id="send" class="input-group-text send_btn"><i class="fas fa-location-arrow"></i></button>
42
+ </div>
43
+ </form>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+
50
+ <script>
51
+ $(document).ready(function() {
52
+ $("#messageArea").on("submit", function(event) {
53
+ const date = new Date();
54
+ const hour = date.getHours();
55
+ const minute = date.getMinutes();
56
+ const str_time = hour+":"+minute;
57
+ var rawText = $("#text").val();
58
+
59
+ var userHtml = '<div class="d-flex justify-content-end mb-4"><div class="msg_cotainer_send">' + rawText + '<span class="msg_time_send">'+ str_time + '</span></div><div class="img_cont_msg"><img src="https://i.ibb.co/d5b84Xw/Untitled-design.png" class="rounded-circle user_img_msg"></div></div>';
60
+
61
+ $("#text").val("");
62
+ $("#messageFormeight").append(userHtml);
63
+
64
+ var chatWindow = document.getElementById("messageFormeight");
65
+ var observer = new MutationObserver(function(mutations) {
66
+ mutations.forEach(function(mutation) {
67
+ if (mutation.addedNodes.length > 0) {
68
+ chatWindow.scrollTop = chatWindow.scrollHeight;
69
+ }
70
+ });
71
+ });
72
+ observer.observe(chatWindow, { childList: true });
73
+
74
+ $.ajax({
75
+ data: {
76
+ msg: rawText,
77
+ },
78
+ type: "POST",
79
+ url: "/get",
80
+ }).done(function(data) {
81
+ var botHtml = '<div class="d-flex justify-content-start mb-4"><div class="img_cont_msg"><img src="https://avatars.githubusercontent.com/u/8597243?s=200&v=4" class="rounded-circle user_img_msg"></div><div class="msg_cotainer">' + data + '<span class="msg_time">' + str_time + '</span></div></div>';
82
+ $("#messageFormeight").append($.parseHTML(botHtml));
83
+ });
84
+ // Scroll to the bottom of the chat window
85
+ //var chatWindow = document.getElementById("messageFormeight");
86
+ //chatWindow.scrollTop = chatWindow.scrollHeight;
87
+
88
+ event.preventDefault();
89
+ });
90
+ });
91
+ </script>
92
+
93
+ </body>
94
+ </html>