Spaces:
Running
Running
File size: 11,172 Bytes
f78a214 8eaebb3 f78a214 8eaebb3 f78a214 8eaebb3 f78a214 8eaebb3 f78a214 8eaebb3 f78a214 339b743 |
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 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Farmers Training</title>
<style>
/* Chat Interface Styles */
.chat-container {
position: fixed;
bottom: 20px;
right: 20px;
width: 300px;
height: 400px;
background: white;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
display: flex;
flex-direction: column;
overflow: hidden;
z-index: 1000;
}
.chat-header {
background: #2e7d32;
color: white;
padding: 10px;
font-weight: bold;
}
.chat-messages {
flex-grow: 1;
overflow-y: auto;
padding: 10px;
}
.chat-message {
margin-bottom: 10px;
padding: 8px 12px;
border-radius: 15px;
max-width: 80%;
}
.user-message {
background: #e3f2fd;
margin-left: auto;
}
.bot-message {
background: #f5f5f5;
}
.chat-input {
display: flex;
padding: 10px;
border-top: 1px solid #eee;
}
.chat-input input {
flex-grow: 1;
padding: 8px;
border: 1px solid #ddd;
border-radius: 20px;
margin-right: 8px;
}
.chat-input button {
background: #2e7d32;
color: white;
border: none;
padding: 8px 15px;
border-radius: 20px;
cursor: pointer;
}
.chat-input button:hover {
background: #1b5e20;
}
/* Global Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
background: #f4f4f4;
color: #333;
line-height: 1.6;
}
/* Header */
header {
background: #2e7d32;
color: #fff;
padding: 20px 40px;
display: flex;
align-items: center;
justify-content: space-between;
}
header h1 {
font-size: 2rem;
}
.search-container {
position: relative;
}
.search-container input[type="text"] {
padding: 8px 12px;
border: none;
border-radius: 20px;
width: 200px;
outline: none;
transition: width 0.3s ease;
}
.search-container input[type="text"]:focus {
width: 250px;
}
/* Video Grid */
.video-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
padding: 20px 40px;
}
.card {
background: #fff;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
opacity: 0;
transform: translateY(20px);
animation: fadeInUp 0.5s forwards;
}
.card:nth-child(odd) {
animation-delay: 0.1s;
}
.card:nth-child(even) {
animation-delay: 0.2s;
}
.card:hover {
transform: scale(1.03);
box-shadow: 0 5px 15px rgba(46, 125, 50, 0.3);
}
.card iframe {
width: 100%;
height: 200px;
border: none;
}
.card-content {
padding: 15px;
}
.card-content h3 {
margin-bottom: 10px;
font-size: 1.2rem;
color: #2e7d32;
}
.card-content p {
font-size: 0.95rem;
color: #666;
}
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
</head>
<body>
<header>
<h1>Farmers Training</h1>
<div class="search-container">
<input type="text" placeholder="Search...">
</div>
</header>
<main>
<div class="video-grid">
<!-- Card 1 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/XsLIkggkcw4" allowfullscreen></iframe>
<div class="card-content">
<h3>Farming Techniques 101</h3>
<p>A quick overview of modern farming techniques to boost productivity.</p>
</div>
</div>
<!-- Card 2 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/QxK4YbPrWXk" allowfullscreen></iframe>
<div class="card-content">
<h3>Organic Farming</h3>
<p>Learn how to switch to organic methods for sustainable agriculture.</p>
</div>
</div>
<!-- Card 3 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/Z9HAy9EYKKs" allowfullscreen></iframe>
<div class="card-content">
<h3>Irrigation Systems</h3>
<p>Explore different irrigation systems and their benefits.</p>
</div>
</div>
<!-- Card 4 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/XeNA6XdMoF8" allowfullscreen></iframe>
<div class="card-content">
<h3>Crop Rotation Strategies</h3>
<p>Understanding the importance of crop rotation for soil health.</p>
</div>
</div>
<!-- Card 5 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/L14woJZEJnk" allowfullscreen></iframe>
<div class="card-content">
<h3>Soil Fertility</h3>
<p>Tips to improve soil fertility using natural and chemical methods.</p>
</div>
</div>
<!-- Card 6 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/TfiWMGrRU7w" allowfullscreen></iframe>
<div class="card-content">
<h3>Modern Tractor Use</h3>
<p>Learn about the latest tractors and machinery for farming.</p>
</div>
</div>
<!-- Card 7 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/_tijHjup-gM" allowfullscreen></iframe>
<div class="card-content">
<h3>Precision Agriculture</h3>
<p>Using technology to optimize farm production and reduce waste.</p>
</div>
</div>
<!-- Card 8 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/dmThw7TyutA" allowfullscreen></iframe>
<div class="card-content">
<h3>Farm Safety Tips</h3>
<p>Essential safety guidelines to protect yourself on the farm.</p>
</div>
</div>
<!-- Card 9 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/eQSNKrigiOM" allowfullscreen></iframe>
<div class="card-content">
<h3>Greenhouse Management</h3>
<p>Learn how to manage greenhouses for year-round farming.</p>
</div>
</div>
<!-- Card 10 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/xW50iMVzo2k" allowfullscreen></iframe>
<div class="card-content">
<h3>Farm Equipment Maintenance</h3>
<p>Maintenance tips to keep your farm equipment running smoothly.</p>
</div>
</div>
<!-- Card 11 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/AzDWmpVOk5I" allowfullscreen></iframe>
<div class="card-content">
<h3>Livestock Management</h3>
<p>Best practices for raising and caring for livestock.</p>
</div>
</div>
<!-- Card 12 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/CIVfSXoTsyk" allowfullscreen></iframe>
<div class="card-content">
<h3>Organic Pesticides</h3>
<p>How to make and use organic pesticides for crop protection.</p>
</div>
</div>
<!-- Card 13 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/Ltc4ZzQN_vE" allowfullscreen></iframe>
<div class="card-content">
<h3>Sustainable Farming</h3>
<p>Steps toward a sustainable and eco-friendly farm operation.</p>
</div>
</div>
<!-- Card 14 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/ttBywb7DwSo" allowfullscreen></iframe>
<div class="card-content">
<h3>Farm Budgeting</h3>
<p>Managing finances and budgeting effectively on the farm.</p>
</div>
</div>
<!-- Card 15 -->
<div class="card">
<iframe src="https://www.youtube.com/embed/Ov3tMgej808" allowfullscreen></iframe>
<div class="card-content">
<h3>Advanced Farming Tools</h3>
<p>Explore the latest tools and technology transforming farming.</p>
</div>
</div>
</div>
</main>
<!-- Chat Interface -->
<div class="chat-container">
<div class="chat-header">Farming Assistant</div>
<div class="chat-messages" id="chatMessages"></div>
<div class="chat-input">
<input type="text" placeholder="Ask about farming..." id="chatInput">
<button onclick="sendMessage()">Send</button>
</div>
</div>
<script src="chatbot.js"></script>
<script>
const searchInput = document.querySelector('.search-container input[type="text"]');
const cards = document.querySelectorAll('.card');
const chatInput = document.getElementById('chatInput');
const chatMessages = document.getElementById('chatMessages');
// Search functionality
searchInput.addEventListener('input', function() {
const searchTerm = searchInput.value.toLowerCase();
cards.forEach(card => {
const title = card.querySelector('h3').textContent.toLowerCase();
const description = card.querySelector('p').textContent.toLowerCase();
if (title.includes(searchTerm) || description.includes(searchTerm)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
// Chat functionality
function addMessage(message, isUser) {
const messageDiv = document.createElement('div');
messageDiv.className = `chat-message ${isUser ? 'user-message' : 'bot-message'}`;
messageDiv.textContent = message;
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
function displayRecommendations(recommendations) {
recommendations.forEach(video => {
const messageDiv = document.createElement('div');
messageDiv.className = 'chat-message bot-message';
messageDiv.innerHTML = `<strong><a href="${video.url}" target="_blank">${video.title}</a></strong><br>${video.description}`;
chatMessages.appendChild(messageDiv);
});
chatMessages.scrollTop = chatMessages.scrollHeight;
}
function sendMessage() {
const message = chatInput.value.trim();
if (message) {
addMessage(message, true);
chatbot.addToHistory(message, true);
const response = chatbot.processInput(message);
addMessage(response.message, false);
chatbot.addToHistory(response.message, false);
if (response.recommendations.length > 0) {
displayRecommendations(response.recommendations);
}
chatInput.value = '';
}
}
// Handle Enter key
chatInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
sendMessage();
}
});
</script>
</body>
</html>
|