-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhelp.html
More file actions
294 lines (255 loc) · 10.6 KB
/
help.html
File metadata and controls
294 lines (255 loc) · 10.6 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EasyShop.com - Help</title>
<style>
/* Enhanced styling */
body {
font-family: 'Trebuchet MS', sans-serif;
margin: 0;
padding: 0;
background-color: #f8f8f8;
color: #333;
overflow-x: hidden; /* Prevent horizontal scroll */
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
.header {
background-color: #ffcc00;
padding: 20px;
text-align: center;
border-bottom: 2px solid #000;
border-radius: 10px 10px 0 0;
margin-bottom: 20px;
}
h1, h2, h3 {
color: #333;
}
h2 {
margin-top: 20px;
margin-bottom: 10px;
}
p {
margin-bottom: 20px;
color: #555;
}
.link-container {
display: flex;
flex-direction: column;
margin-bottom: 20px;
}
.nav-link {
display: block;
padding: 15px;
text-decoration: none;
color: #fff;
background-color: #333;
margin-bottom: 10px;
border-radius: 5px;
transition: background-color 0.3s;
text-align: center;
}
.nav-link:hover {
background-color: #555;
}
.chat-widget {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #333;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
z-index: 1000; /* Ensure it's above other elements */
}
.chat-widget:hover {
background-color: #555;
}
/* Chat interface styling */
.chat-container {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
width: 400px; /* Increased width */
max-height: 500px;
overflow-y: auto;
z-index: 1000; /* Ensure it's above other elements */
display: none;
}
.chat-header {
background-color: #ffcc00;
padding: 15px;
border-radius: 10px 10px 0 0;
}
.chat-messages {
padding: 15px;
min-height: 200px;
}
.user-message, .bot-message {
background-color: #f0f0f0;
padding: 8px;
border-radius: 5px;
margin-bottom: 10px;
}
.bot-message {
background-color: #e1f7d5;
}
.chat-input {
width: calc(100% - 30px);
padding: 10px;
border: none;
border-top: 1px solid #ccc;
border-radius: 0 0 10px 10px;
resize: none;
outline: none;
}
.message-time {
font-size: 0.8em;
color: #999;
margin-top: 5px;
text-align: right;
}
</style>
<script>
// Array of inappropriate words
var inappropriateWords = ["fuck", "asshole", "bitch", "18+", "sex"];
// Variable to track last time an inappropriate word was used
var lastInappropriateWordTime = 0;
// Chat functionality
function toggleChat() {
var chatContainer = document.getElementById("chat-container");
chatContainer.style.display === "none" ? (chatContainer.style.display = "block", displayBotMessage("Welcome to EasyShop.com! Please follow our chat etiquette: Be respectful, avoid inappropriate language, and provide clear and concise messages.")) : chatContainer.style.display = "none";
}
function handleUserInput(event) {
if (event.key === "Enter") {
var userInput = event.target.value.trim().toLowerCase(); // Convert input to lowercase and trim whitespace
if (userInput !== "") {
displayUserMessage(userInput);
getBotResponse(userInput);
event.target.value = ""; // Clear input field
}
}
}
function displayUserMessage(message) {
var chatMessages = document.getElementById("chat-messages");
var userMessageElement = document.createElement("div");
userMessageElement.className = "user-message";
userMessageElement.innerHTML = message + "<div class='message-time'>" + getCurrentTime() + "</div>";
chatMessages.appendChild(userMessageElement);
// Scroll to bottom of chat container
chatMessages.scrollTop = chatMessages.scrollHeight;
}
function displayBotMessage(message) {
var chatMessages = document.getElementById("chat-messages");
var botMessageElement = document.createElement("div");
botMessageElement.className = "bot-message";
botMessageElement.innerHTML = message + "<div class='message-time'>" + getCurrentTime() + "</div>";
chatMessages.appendChild(botMessageElement);
// Scroll to bottom of chat container
chatMessages.scrollTop = chatMessages.scrollHeight;
}
function getCurrentTime() {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
// Add leading zero if minutes is less than 10
minutes = minutes < 10 ? "0" + minutes : minutes;
return hours + ":" + minutes;
}
function getBotResponse(userInput) {
// Check for inappropriate words and set timer
if (checkForInappropriateWords(userInput)) {
displayBotMessage("Please refrain from using inappropriate language. Your message will be removed in 5 minutes.");
// Set timer to remove inappropriate message after 5 minutes
setTimeout(function() {
removeInappropriateMessage();
}, 300000); // 5 minutes in milliseconds
return;
}
// Placeholder function for bot response based on user input
var botResponse;
if (userInput.includes("help!")) {
botResponse = "Please visit Contact page from here <a href='contact.html'>Contact Page.";
} else if (userInput.includes("payment")) {
botResponse = "For payment-related queries, you can visit our <a href='payment.html'>payment page . We ensure safe payemt system and refund policy to our customers</a>.";
} else if (userInput.includes("products")) {
botResponse = "Here are some of our featured products: <ul><li>Toys</li><li>Homemade Items</li><li>Usefull Items</li></ul>";
} else if (userInput.includes("currency")) {
botResponse = "Currently, we only accept ₹ (Indian Rupee) as currency.";
} else if (userInput.includes("hi") || userInput.includes("hello")) {
botResponse = "Hello! How can I assist you today?";
} else {
botResponse = "Thank you for contacting EasyShop.com! How can we assist you today?";
}
displayBotMessage(botResponse);
}
function checkForInappropriateWords(userInput) {
var currentTime = new Date().getTime();
if (currentTime - lastInappropriateWordTime < 300000) { // 5 minutes in milliseconds
return true; // Inappropriate word used within last 5 minutes
}
for (var i = 0; i < inappropriateWords.length; i++) {
if (userInput.includes(inappropriateWords[i])) {
lastInappropriateWordTime = currentTime;
return true;
}
}
return false;
}
function removeInappropriateMessage() {
var chatMessages = document.getElementById("chat-messages");
var messages = chatMessages.getElementsByClassName("user-message");
for (var i = messages.length - 1; i >= 0; i--) {
if (messages[i].innerText.toLowerCase().includes(inappropriateWords[0]) ||
messages[i].innerText.toLowerCase().includes(inappropriateWords[1]) ||
messages[i].innerText.toLowerCase().includes(inappropriateWords[2]) ||
messages[i].innerText.toLowerCase().includes(inappropriateWords[3]) ||
messages[i].innerText.toLowerCase().includes(inappropriateWords[4])) {
messages[i].remove();
break; // Remove only one message
}
}
}
</script>
</head>
<body>
<div class="container">
<div class="header">
<h1>Help Center</h1>
<p>Your reliable source for quality products and a seamless shopping experience.</p>
</div>
<h2>Help Center</h2>
<p><strong>Welcome to EasyShop.com Help Center!</strong> Our commitment to customer satisfaction goes beyond just providing great products. Our Help Center is designed to assist you in navigating through any questions or concerns you may encounter during your shopping journey. Whether you're curious about our ordering process, tracking your shipments, understanding our policies, or need further assistance, feel free to reach out to our dedicated support team.</p>
<div class="link-container">
<a class="nav-link" href="contact.html">Contact Us</a>
<a class="nav-link" href="refund.html">Refund Policy</a>
</div>
<!-- Chat widget button -->
<button class="chat-widget" onclick="toggleChat()">Need Help?</button>
<!-- Chat interface -->
<div id="chat-container" class="chat-container">
<div class="chat-header">
<h3>Chat with Us</h3>
</div>
<div id="chat-messages" class="chat-messages">
<!-- Chat messages will be displayed here -->
</div>
<input type="text" class="chat-input" placeholder="Type your message..." onkeyup="handleUserInput(event)">
</div>
</div>
</body>
</html>