Update index.html
Browse files- index.html +319 -1233
index.html
CHANGED
|
@@ -49,838 +49,173 @@
|
|
| 49 |
--shadow-hover: 0 10px 36px rgba(130, 133, 255, 0.14);
|
| 50 |
}
|
| 51 |
|
| 52 |
-
*,
|
| 53 |
-
*::before,
|
| 54 |
-
*::after {
|
| 55 |
-
margin: 0;
|
| 56 |
-
padding: 0;
|
| 57 |
-
box-sizing: border-box;
|
| 58 |
-
outline: none;
|
| 59 |
-
}
|
| 60 |
|
| 61 |
body {
|
| 62 |
-
font-family: 'Tajawal', sans-serif;
|
| 63 |
-
|
| 64 |
-
color: var(--text-main);
|
| 65 |
-
min-height: 100vh;
|
| 66 |
-
overflow-x: hidden;
|
| 67 |
-
transition: background 0.35s, color 0.35s;
|
| 68 |
}
|
| 69 |
|
| 70 |
-
.bg-mesh {
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
pointer-events: none;
|
| 75 |
-
overflow: hidden;
|
| 76 |
-
}
|
| 77 |
-
.bg-mesh::before {
|
| 78 |
-
content: '';
|
| 79 |
-
position: absolute;
|
| 80 |
-
top: -20%;
|
| 81 |
-
right: -15%;
|
| 82 |
-
width: 55vw;
|
| 83 |
-
height: 55vw;
|
| 84 |
-
background: radial-gradient(circle, rgba(91, 94, 244, 0.13) 0%, transparent 70%);
|
| 85 |
-
border-radius: 50%;
|
| 86 |
-
animation: drift 18s ease-in-out infinite alternate;
|
| 87 |
-
}
|
| 88 |
-
.bg-mesh::after {
|
| 89 |
-
content: '';
|
| 90 |
-
position: absolute;
|
| 91 |
-
bottom: -15%;
|
| 92 |
-
left: -10%;
|
| 93 |
-
width: 45vw;
|
| 94 |
-
height: 45vw;
|
| 95 |
-
background: radial-gradient(circle, rgba(224, 66, 122, 0.1) 0%, transparent 70%);
|
| 96 |
-
border-radius: 50%;
|
| 97 |
-
animation: drift 22s ease-in-out infinite alternate-reverse;
|
| 98 |
-
}
|
| 99 |
-
@keyframes drift {
|
| 100 |
-
from {
|
| 101 |
-
transform: translate(0, 0) scale(1);
|
| 102 |
-
}
|
| 103 |
-
to {
|
| 104 |
-
transform: translate(4%, 3%) scale(1.06);
|
| 105 |
-
}
|
| 106 |
-
}
|
| 107 |
|
| 108 |
/* ===== NAVBAR ===== */
|
| 109 |
.navbar {
|
| 110 |
-
position: fixed;
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
height: auto;
|
| 117 |
-
min-height: 68px;
|
| 118 |
-
background: var(--bg-nav);
|
| 119 |
-
backdrop-filter: blur(28px) saturate(1.6);
|
| 120 |
-
-webkit-backdrop-filter: blur(28px) saturate(1.6);
|
| 121 |
-
border: 1px solid var(--border);
|
| 122 |
-
border-radius: var(--radius-nav);
|
| 123 |
-
display: flex;
|
| 124 |
-
flex-wrap: wrap;
|
| 125 |
-
align-items: center;
|
| 126 |
-
justify-content: space-between;
|
| 127 |
-
padding: 10px 18px;
|
| 128 |
-
z-index: 1000;
|
| 129 |
-
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
|
| 130 |
-
gap: 12px;
|
| 131 |
-
transition: background 0.35s, border-color 0.35s;
|
| 132 |
}
|
| 133 |
|
| 134 |
-
.brand {
|
| 135 |
-
|
| 136 |
-
font-weight: 400;
|
| 137 |
-
font-size: 21px;
|
| 138 |
-
text-decoration: none;
|
| 139 |
-
color: var(--text-main);
|
| 140 |
-
display: flex;
|
| 141 |
-
align-items: center;
|
| 142 |
-
gap: 10px;
|
| 143 |
-
letter-spacing: -0.01em;
|
| 144 |
-
flex-shrink: 0;
|
| 145 |
-
}
|
| 146 |
-
.brand-icon {
|
| 147 |
-
width: 36px;
|
| 148 |
-
height: 36px;
|
| 149 |
-
background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
|
| 150 |
-
border-radius: 10px;
|
| 151 |
-
display: flex;
|
| 152 |
-
align-items: center;
|
| 153 |
-
justify-content: center;
|
| 154 |
-
color: #fff;
|
| 155 |
-
font-size: 15px;
|
| 156 |
-
flex-shrink: 0;
|
| 157 |
-
box-shadow: 0 4px 14px var(--accent-glow);
|
| 158 |
-
}
|
| 159 |
|
| 160 |
-
.search-container {
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
}
|
| 165 |
-
.search-
|
| 166 |
-
display: flex;
|
| 167 |
-
align-items: center;
|
| 168 |
-
background: var(--bg-input);
|
| 169 |
-
border: 1.5px solid var(--border);
|
| 170 |
-
border-radius: var(--radius-pill);
|
| 171 |
-
padding: 4px 4px 4px 16px;
|
| 172 |
-
transition: var(--transition);
|
| 173 |
-
width: 100%;
|
| 174 |
-
}
|
| 175 |
-
.search-bar:focus-within {
|
| 176 |
-
border-color: var(--accent);
|
| 177 |
-
background: var(--bg-input-focus);
|
| 178 |
-
box-shadow: 0 0 0 4px var(--accent-glow);
|
| 179 |
-
}
|
| 180 |
-
.search-bar input {
|
| 181 |
-
flex: 1;
|
| 182 |
-
background: transparent;
|
| 183 |
-
border: none;
|
| 184 |
-
padding: 9px 0;
|
| 185 |
-
color: var(--text-main);
|
| 186 |
-
font-family: 'Tajawal', sans-serif;
|
| 187 |
-
font-size: 14.5px;
|
| 188 |
-
min-width: 0;
|
| 189 |
-
}
|
| 190 |
-
.search-bar input::placeholder {
|
| 191 |
-
color: var(--text-faint);
|
| 192 |
-
}
|
| 193 |
-
.search-btn {
|
| 194 |
-
background: linear-gradient(135deg, var(--accent), var(--accent-2));
|
| 195 |
-
border: none;
|
| 196 |
-
color: #fff;
|
| 197 |
-
cursor: pointer;
|
| 198 |
-
width: 40px;
|
| 199 |
-
height: 36px;
|
| 200 |
-
border-radius: var(--radius-pill);
|
| 201 |
-
display: flex;
|
| 202 |
-
align-items: center;
|
| 203 |
-
justify-content: center;
|
| 204 |
-
font-size: 14px;
|
| 205 |
-
flex-shrink: 0;
|
| 206 |
-
transition: var(--transition);
|
| 207 |
-
box-shadow: 0 2px 8px var(--accent-glow);
|
| 208 |
-
}
|
| 209 |
-
.search-btn:hover {
|
| 210 |
-
opacity: 0.88;
|
| 211 |
-
transform: scale(1.06);
|
| 212 |
-
}
|
| 213 |
|
| 214 |
-
.nav-actions {
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
gap: 8px;
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
#theme-toggle {
|
| 221 |
-
background: var(--bg-input);
|
| 222 |
-
border: 1.5px solid var(--border);
|
| 223 |
-
color: var(--text-sub);
|
| 224 |
-
cursor: pointer;
|
| 225 |
-
width: 38px;
|
| 226 |
-
height: 38px;
|
| 227 |
-
border-radius: 50%;
|
| 228 |
-
display: flex;
|
| 229 |
-
align-items: center;
|
| 230 |
-
justify-content: center;
|
| 231 |
-
font-size: 15px;
|
| 232 |
-
transition: var(--transition);
|
| 233 |
-
flex-shrink: 0;
|
| 234 |
-
}
|
| 235 |
-
#theme-toggle:hover {
|
| 236 |
-
border-color: var(--accent);
|
| 237 |
-
color: var(--accent);
|
| 238 |
-
}
|
| 239 |
|
| 240 |
/* ===== TABS ===== */
|
| 241 |
.tabs-bar {
|
| 242 |
-
position: fixed;
|
| 243 |
-
|
| 244 |
-
left: 50%;
|
| 245 |
-
transform: translateX(-50%);
|
| 246 |
-
width: 95%;
|
| 247 |
-
max-width: 1280px;
|
| 248 |
-
display: flex;
|
| 249 |
-
gap: 6px;
|
| 250 |
-
z-index: 999;
|
| 251 |
-
overflow-x: auto;
|
| 252 |
-
padding-bottom: 4px;
|
| 253 |
-
scrollbar-width: none;
|
| 254 |
-
}
|
| 255 |
-
.tabs-bar::-webkit-scrollbar {
|
| 256 |
-
display: none;
|
| 257 |
-
}
|
| 258 |
-
.tab-pill {
|
| 259 |
-
padding: 7px 16px;
|
| 260 |
-
border-radius: var(--radius-pill);
|
| 261 |
-
background: var(--bg-card);
|
| 262 |
-
border: 1.5px solid var(--border);
|
| 263 |
-
color: var(--text-sub);
|
| 264 |
-
font-family: 'Tajawal', sans-serif;
|
| 265 |
-
font-size: 13px;
|
| 266 |
-
font-weight: 500;
|
| 267 |
-
cursor: pointer;
|
| 268 |
-
transition: var(--transition);
|
| 269 |
-
display: flex;
|
| 270 |
-
align-items: center;
|
| 271 |
-
gap: 6px;
|
| 272 |
-
white-space: nowrap;
|
| 273 |
-
box-shadow: var(--shadow-card);
|
| 274 |
-
}
|
| 275 |
-
.tab-pill:hover {
|
| 276 |
-
border-color: var(--border-hover);
|
| 277 |
-
color: var(--accent);
|
| 278 |
-
}
|
| 279 |
-
.tab-pill.active {
|
| 280 |
-
background: var(--accent);
|
| 281 |
-
color: #fff;
|
| 282 |
-
border-color: var(--accent);
|
| 283 |
-
box-shadow: 0 4px 16px var(--accent-glow);
|
| 284 |
-
}
|
| 285 |
-
.tab-pill i {
|
| 286 |
-
font-size: 11px;
|
| 287 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
|
| 289 |
/* ===== LAYOUT ===== */
|
| 290 |
-
.page-wrapper {
|
| 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 |
-
align-items: center;
|
| 371 |
-
justify-content: center;
|
| 372 |
-
}
|
| 373 |
-
.favicon-wrap img {
|
| 374 |
-
width: 16px;
|
| 375 |
-
height: 16px;
|
| 376 |
-
object-fit: contain;
|
| 377 |
-
}
|
| 378 |
-
.favicon-wrap .fallback-icon {
|
| 379 |
-
color: var(--text-faint);
|
| 380 |
-
font-size: 11px;
|
| 381 |
-
}
|
| 382 |
-
|
| 383 |
-
.result-content {
|
| 384 |
-
flex: 1;
|
| 385 |
-
min-width: 0;
|
| 386 |
-
}
|
| 387 |
-
.result-domain {
|
| 388 |
-
font-size: 11.5px;
|
| 389 |
-
color: var(--text-faint);
|
| 390 |
-
margin-bottom: 4px;
|
| 391 |
-
display: flex;
|
| 392 |
-
align-items: center;
|
| 393 |
-
gap: 4px;
|
| 394 |
-
}
|
| 395 |
-
.result-title {
|
| 396 |
-
font-family: 'Tajawal', sans-serif;
|
| 397 |
-
font-size: 16px;
|
| 398 |
-
font-weight: 700;
|
| 399 |
-
color: var(--accent) !important;
|
| 400 |
-
text-decoration: none;
|
| 401 |
-
display: inline-block;
|
| 402 |
-
margin-bottom: 6px;
|
| 403 |
-
line-height: 1.4;
|
| 404 |
-
transition: color 0.2s;
|
| 405 |
-
}
|
| 406 |
-
.result-title:hover {
|
| 407 |
-
color: var(--accent-2) !important;
|
| 408 |
-
}
|
| 409 |
-
.result-snippet {
|
| 410 |
-
font-size: 13.5px;
|
| 411 |
-
color: var(--text-sub);
|
| 412 |
-
line-height: 1.65;
|
| 413 |
-
}
|
| 414 |
-
|
| 415 |
-
/* ===== IMAGES GRID ===== */
|
| 416 |
-
.images-grid {
|
| 417 |
-
display: grid;
|
| 418 |
-
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
|
| 419 |
-
gap: 14px;
|
| 420 |
-
width: 100%;
|
| 421 |
-
}
|
| 422 |
-
.image-card {
|
| 423 |
-
background: var(--bg-card);
|
| 424 |
-
border: 1.5px solid var(--border);
|
| 425 |
-
border-radius: var(--radius-card);
|
| 426 |
-
overflow: hidden;
|
| 427 |
-
transition: var(--transition);
|
| 428 |
-
box-shadow: var(--shadow-card);
|
| 429 |
-
animation: fadeSlideIn 0.35s ease both;
|
| 430 |
-
display: flex;
|
| 431 |
-
flex-direction: column;
|
| 432 |
-
}
|
| 433 |
-
.image-card:hover {
|
| 434 |
-
border-color: var(--border-hover);
|
| 435 |
-
box-shadow: var(--shadow-hover);
|
| 436 |
-
transform: translateY(-5px);
|
| 437 |
-
}
|
| 438 |
-
.image-card-link {
|
| 439 |
-
display: block;
|
| 440 |
-
width: 100%;
|
| 441 |
-
height: 170px;
|
| 442 |
-
overflow: hidden;
|
| 443 |
-
background: var(--bg-input);
|
| 444 |
-
position: relative;
|
| 445 |
-
}
|
| 446 |
-
.image-card-link img {
|
| 447 |
-
width: 100%;
|
| 448 |
-
height: 100%;
|
| 449 |
-
object-fit: cover;
|
| 450 |
-
transition: transform 0.4s ease;
|
| 451 |
-
display: block;
|
| 452 |
-
}
|
| 453 |
-
.image-card:hover .image-card-link img {
|
| 454 |
-
transform: scale(1.06);
|
| 455 |
-
}
|
| 456 |
-
|
| 457 |
-
.img-skeleton {
|
| 458 |
-
position: absolute;
|
| 459 |
-
inset: 0;
|
| 460 |
-
background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
|
| 461 |
-
background-size: 200% 100%;
|
| 462 |
-
animation: shimmer 1.4s ease-in-out infinite;
|
| 463 |
-
z-index: 2;
|
| 464 |
-
}
|
| 465 |
-
.img-skeleton.hidden {
|
| 466 |
-
display: none;
|
| 467 |
-
}
|
| 468 |
-
@keyframes shimmer {
|
| 469 |
-
0% {
|
| 470 |
-
background-position: 200% 0;
|
| 471 |
-
}
|
| 472 |
-
100% {
|
| 473 |
-
background-position: -200% 0;
|
| 474 |
-
}
|
| 475 |
-
}
|
| 476 |
-
|
| 477 |
-
.image-error-state {
|
| 478 |
-
position: absolute;
|
| 479 |
-
inset: 0;
|
| 480 |
-
display: none;
|
| 481 |
-
align-items: center;
|
| 482 |
-
justify-content: center;
|
| 483 |
-
flex-direction: column;
|
| 484 |
-
gap: 6px;
|
| 485 |
-
color: var(--text-faint);
|
| 486 |
-
font-size: 11px;
|
| 487 |
-
background: var(--bg-input);
|
| 488 |
-
z-index: 1;
|
| 489 |
-
}
|
| 490 |
-
.image-error-state i {
|
| 491 |
-
font-size: 22px;
|
| 492 |
-
}
|
| 493 |
-
.image-error-state.visible {
|
| 494 |
-
display: flex;
|
| 495 |
-
}
|
| 496 |
-
|
| 497 |
-
.image-info {
|
| 498 |
-
padding: 9px 10px;
|
| 499 |
-
font-size: 11.5px;
|
| 500 |
-
color: var(--text-sub);
|
| 501 |
-
white-space: nowrap;
|
| 502 |
-
overflow: hidden;
|
| 503 |
-
text-overflow: ellipsis;
|
| 504 |
-
border-top: 1px solid var(--border);
|
| 505 |
-
background: var(--bg-card);
|
| 506 |
-
}
|
| 507 |
-
|
| 508 |
-
/* ===== VIDEOS GRID ===== */
|
| 509 |
-
.videos-grid {
|
| 510 |
-
display: grid;
|
| 511 |
-
grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
|
| 512 |
-
gap: 20px;
|
| 513 |
-
width: 100%;
|
| 514 |
-
}
|
| 515 |
-
.video-card {
|
| 516 |
-
background: var(--bg-card);
|
| 517 |
-
border: 1.5px solid var(--border);
|
| 518 |
-
border-radius: var(--radius-card);
|
| 519 |
-
overflow: hidden;
|
| 520 |
-
transition: var(--transition);
|
| 521 |
-
box-shadow: var(--shadow-card);
|
| 522 |
-
animation: fadeSlideIn 0.35s ease both;
|
| 523 |
-
}
|
| 524 |
-
.video-card:hover {
|
| 525 |
-
border-color: var(--border-hover);
|
| 526 |
-
box-shadow: var(--shadow-hover);
|
| 527 |
-
transform: translateY(-3px);
|
| 528 |
-
}
|
| 529 |
-
.video-thumb-wrap {
|
| 530 |
-
position: relative;
|
| 531 |
-
width: 100%;
|
| 532 |
-
height: 170px;
|
| 533 |
-
background: var(--bg-input);
|
| 534 |
-
display: block;
|
| 535 |
-
overflow: hidden;
|
| 536 |
-
}
|
| 537 |
-
.video-thumb-wrap img {
|
| 538 |
-
width: 100%;
|
| 539 |
-
height: 100%;
|
| 540 |
-
object-fit: cover;
|
| 541 |
-
opacity: 0.85;
|
| 542 |
-
transition: 0.3s;
|
| 543 |
-
display: block;
|
| 544 |
-
}
|
| 545 |
-
.video-card:hover .video-thumb-wrap img {
|
| 546 |
-
opacity: 1;
|
| 547 |
-
}
|
| 548 |
-
.play-overlay {
|
| 549 |
-
position: absolute;
|
| 550 |
-
top: 50%;
|
| 551 |
-
left: 50%;
|
| 552 |
-
transform: translate(-50%, -50%);
|
| 553 |
-
width: 46px;
|
| 554 |
-
height: 46px;
|
| 555 |
-
background: rgba(91, 94, 244, 0.92);
|
| 556 |
-
color: white;
|
| 557 |
-
border-radius: 50%;
|
| 558 |
-
display: flex;
|
| 559 |
-
align-items: center;
|
| 560 |
-
justify-content: center;
|
| 561 |
-
font-size: 17px;
|
| 562 |
-
box-shadow: 0 0 20px var(--accent-glow);
|
| 563 |
-
transition: var(--transition);
|
| 564 |
-
z-index: 2;
|
| 565 |
-
}
|
| 566 |
-
.video-card:hover .play-overlay {
|
| 567 |
-
transform: translate(-50%, -50%) scale(1.12);
|
| 568 |
-
}
|
| 569 |
-
.video-details {
|
| 570 |
-
padding: 12px;
|
| 571 |
-
}
|
| 572 |
-
.video-title {
|
| 573 |
-
font-size: 14px;
|
| 574 |
-
font-weight: 700;
|
| 575 |
-
color: var(--text-main);
|
| 576 |
-
text-decoration: none;
|
| 577 |
-
display: block;
|
| 578 |
-
margin-bottom: 5px;
|
| 579 |
-
line-height: 1.4;
|
| 580 |
-
}
|
| 581 |
-
.video-title:hover {
|
| 582 |
-
color: var(--accent);
|
| 583 |
-
}
|
| 584 |
-
.video-meta {
|
| 585 |
-
font-size: 11px;
|
| 586 |
-
color: var(--text-faint);
|
| 587 |
-
}
|
| 588 |
|
| 589 |
/* ===== AI WIDGET ===== */
|
| 590 |
-
.sidebar {
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
}
|
| 595 |
-
.ai-widget
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
}
|
| 599 |
-
.ai-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
initial-value: 0deg;
|
| 612 |
-
inherits: false;
|
| 613 |
-
}
|
| 614 |
-
@keyframes spin-glow {
|
| 615 |
-
to {
|
| 616 |
-
--angle: 360deg;
|
| 617 |
-
}
|
| 618 |
-
}
|
| 619 |
-
.ai-widget {
|
| 620 |
-
position: relative;
|
| 621 |
-
z-index: 1;
|
| 622 |
-
background: var(--bg-card);
|
| 623 |
-
border-radius: var(--radius-card);
|
| 624 |
-
padding: 18px 18px 16px;
|
| 625 |
-
box-shadow: var(--shadow-card);
|
| 626 |
-
}
|
| 627 |
-
.ai-widget-header {
|
| 628 |
-
display: flex;
|
| 629 |
-
align-items: center;
|
| 630 |
-
gap: 9px;
|
| 631 |
-
margin-bottom: 14px;
|
| 632 |
-
}
|
| 633 |
-
.ai-widget-icon {
|
| 634 |
-
width: 30px;
|
| 635 |
-
height: 30px;
|
| 636 |
-
border-radius: 8px;
|
| 637 |
-
background: linear-gradient(135deg, var(--accent), var(--accent-2));
|
| 638 |
-
display: flex;
|
| 639 |
-
align-items: center;
|
| 640 |
-
justify-content: center;
|
| 641 |
-
color: #fff;
|
| 642 |
-
font-size: 12px;
|
| 643 |
-
flex-shrink: 0;
|
| 644 |
-
}
|
| 645 |
-
.ai-widget-title {
|
| 646 |
-
font-family: 'Syne', sans-serif;
|
| 647 |
-
font-size: 13.5px;
|
| 648 |
-
font-weight: 600;
|
| 649 |
-
color: var(--text-main);
|
| 650 |
-
}
|
| 651 |
-
.ai-widget-badge {
|
| 652 |
-
margin-right: auto;
|
| 653 |
-
font-size: 10px;
|
| 654 |
-
padding: 2px 8px;
|
| 655 |
-
border-radius: 20px;
|
| 656 |
-
background: var(--accent-glow);
|
| 657 |
-
color: var(--accent);
|
| 658 |
-
font-weight: 600;
|
| 659 |
-
border: 1px solid rgba(91, 94, 244, 0.2);
|
| 660 |
-
}
|
| 661 |
-
.ai-answer-body {
|
| 662 |
-
font-size: 13.5px;
|
| 663 |
-
color: var(--text-sub);
|
| 664 |
-
line-height: 1.75;
|
| 665 |
-
min-height: 60px;
|
| 666 |
-
}
|
| 667 |
-
.ai-answer-body.loading {
|
| 668 |
-
display: flex;
|
| 669 |
-
flex-direction: column;
|
| 670 |
-
gap: 8px;
|
| 671 |
-
}
|
| 672 |
-
.ai-skeleton {
|
| 673 |
-
height: 12px;
|
| 674 |
-
border-radius: 6px;
|
| 675 |
-
background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
|
| 676 |
-
background-size: 200% 100%;
|
| 677 |
-
animation: shimmer 1.4s ease-in-out infinite;
|
| 678 |
-
}
|
| 679 |
-
.ai-skeleton:nth-child(2) {
|
| 680 |
-
width: 85%;
|
| 681 |
-
animation-delay: 0.1s;
|
| 682 |
-
}
|
| 683 |
-
.ai-skeleton:nth-child(3) {
|
| 684 |
-
width: 70%;
|
| 685 |
-
animation-delay: 0.2s;
|
| 686 |
-
}
|
| 687 |
-
.ai-widget-footer {
|
| 688 |
-
font-size: 10.5px;
|
| 689 |
-
color: var(--text-faint);
|
| 690 |
-
margin-top: 12px;
|
| 691 |
-
padding-top: 10px;
|
| 692 |
-
border-top: 1px solid var(--border);
|
| 693 |
-
display: flex;
|
| 694 |
-
align-items: center;
|
| 695 |
-
gap: 5px;
|
| 696 |
-
}
|
| 697 |
-
.ai-widget-footer i {
|
| 698 |
-
color: var(--accent);
|
| 699 |
-
font-size: 10px;
|
| 700 |
-
}
|
| 701 |
-
.ai-sources {
|
| 702 |
-
margin-top: 10px;
|
| 703 |
-
display: flex;
|
| 704 |
-
flex-wrap: wrap;
|
| 705 |
-
gap: 6px;
|
| 706 |
-
}
|
| 707 |
-
.ai-source-chip {
|
| 708 |
-
font-size: 11px;
|
| 709 |
-
padding: 3px 10px;
|
| 710 |
-
border-radius: 20px;
|
| 711 |
-
background: var(--bg-input);
|
| 712 |
-
border: 1px solid var(--border);
|
| 713 |
-
color: var(--text-faint);
|
| 714 |
-
text-decoration: none;
|
| 715 |
-
display: flex;
|
| 716 |
-
align-items: center;
|
| 717 |
-
gap: 5px;
|
| 718 |
-
transition: var(--transition);
|
| 719 |
-
}
|
| 720 |
-
.ai-source-chip:hover {
|
| 721 |
-
border-color: var(--accent);
|
| 722 |
-
color: var(--accent);
|
| 723 |
-
}
|
| 724 |
-
.ai-source-chip i {
|
| 725 |
-
font-size: 9px;
|
| 726 |
-
}
|
| 727 |
-
|
| 728 |
-
.ai-cursor {
|
| 729 |
-
display: inline-block;
|
| 730 |
-
width: 2px;
|
| 731 |
-
height: 14px;
|
| 732 |
-
background: var(--accent);
|
| 733 |
-
margin-right: 2px;
|
| 734 |
-
vertical-align: middle;
|
| 735 |
-
animation: blink 0.9s step-end infinite;
|
| 736 |
-
}
|
| 737 |
-
@keyframes blink {
|
| 738 |
-
0%,
|
| 739 |
-
100% {
|
| 740 |
-
opacity: 1;
|
| 741 |
-
}
|
| 742 |
-
50% {
|
| 743 |
-
opacity: 0;
|
| 744 |
-
}
|
| 745 |
-
}
|
| 746 |
-
|
| 747 |
-
.ai-mobile-wrap {
|
| 748 |
-
display: none;
|
| 749 |
-
position: relative;
|
| 750 |
-
border-radius: var(--radius-card);
|
| 751 |
-
margin-bottom: 16px;
|
| 752 |
-
}
|
| 753 |
|
| 754 |
-
/* ===== EMPTY / ERROR ===== */
|
| 755 |
-
.empty-state {
|
| 756 |
-
text-align: center;
|
| 757 |
-
padding: 60px 20px;
|
| 758 |
-
color: var(--text-sub);
|
| 759 |
-
}
|
| 760 |
-
.empty-state i {
|
| 761 |
-
font-size: 40px;
|
| 762 |
-
margin-bottom: 16px;
|
| 763 |
-
color: var(--text-faint);
|
| 764 |
-
display: block;
|
| 765 |
-
}
|
| 766 |
-
.empty-state p {
|
| 767 |
-
font-size: 15px;
|
| 768 |
-
}
|
| 769 |
-
|
| 770 |
-
/* ===== LOAD MORE ===== */
|
| 771 |
-
.load-more-btn {
|
| 772 |
-
display: flex;
|
| 773 |
-
align-items: center;
|
| 774 |
-
justify-content: center;
|
| 775 |
-
gap: 8px;
|
| 776 |
-
width: 100%;
|
| 777 |
-
padding: 13px;
|
| 778 |
-
border-radius: var(--radius-card);
|
| 779 |
-
background: var(--bg-card);
|
| 780 |
-
border: 1.5px dashed var(--border);
|
| 781 |
-
color: var(--text-sub);
|
| 782 |
-
font-family: 'Tajawal', sans-serif;
|
| 783 |
-
font-size: 14px;
|
| 784 |
-
cursor: pointer;
|
| 785 |
-
transition: var(--transition);
|
| 786 |
-
margin-top: 8px;
|
| 787 |
-
box-shadow: var(--shadow-card);
|
| 788 |
-
}
|
| 789 |
-
.load-more-btn:hover {
|
| 790 |
-
border-color: var(--accent);
|
| 791 |
-
color: var(--accent);
|
| 792 |
-
background: var(--bg-input-focus);
|
| 793 |
-
}
|
| 794 |
-
.load-more-btn:disabled {
|
| 795 |
-
opacity: 0.5;
|
| 796 |
-
cursor: not-allowed;
|
| 797 |
-
}
|
| 798 |
-
|
| 799 |
-
/* ===== RESULTS COUNT ===== */
|
| 800 |
-
.results-meta {
|
| 801 |
-
font-size: 12px;
|
| 802 |
-
color: var(--text-faint);
|
| 803 |
-
margin-bottom: 14px;
|
| 804 |
-
display: flex;
|
| 805 |
-
align-items: center;
|
| 806 |
-
gap: 6px;
|
| 807 |
-
}
|
| 808 |
-
.results-meta span {
|
| 809 |
-
color: var(--accent);
|
| 810 |
-
font-weight: 600;
|
| 811 |
-
}
|
| 812 |
-
|
| 813 |
-
#results-container {
|
| 814 |
-
width: 100%;
|
| 815 |
-
min-height: 200px;
|
| 816 |
-
position: relative;
|
| 817 |
-
}
|
| 818 |
-
|
| 819 |
-
/* ===== RESPONSIVE ===== */
|
| 820 |
@media (max-width: 767px) {
|
| 821 |
-
.navbar {
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
}
|
| 827 |
-
.
|
| 828 |
-
font-size: 18px;
|
| 829 |
-
}
|
| 830 |
-
.brand-icon {
|
| 831 |
-
width: 32px;
|
| 832 |
-
height: 32px;
|
| 833 |
-
font-size: 13px;
|
| 834 |
-
}
|
| 835 |
-
.tabs-bar {
|
| 836 |
-
top: 125px;
|
| 837 |
-
}
|
| 838 |
-
.page-wrapper {
|
| 839 |
-
margin-top: 176px;
|
| 840 |
-
gap: 16px;
|
| 841 |
-
}
|
| 842 |
-
.sidebar {
|
| 843 |
-
display: none !important;
|
| 844 |
-
}
|
| 845 |
-
.ai-mobile-wrap {
|
| 846 |
-
display: block;
|
| 847 |
-
}
|
| 848 |
-
.images-grid {
|
| 849 |
-
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
| 850 |
-
gap: 10px;
|
| 851 |
-
}
|
| 852 |
-
.videos-grid {
|
| 853 |
-
grid-template-columns: 1fr;
|
| 854 |
-
}
|
| 855 |
}
|
| 856 |
@media (min-width: 768px) {
|
| 857 |
-
.navbar {
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
}
|
| 863 |
-
.search-container {
|
| 864 |
-
margin: 0 20px;
|
| 865 |
-
}
|
| 866 |
-
.tabs-bar {
|
| 867 |
-
top: 98px;
|
| 868 |
-
overflow-x: visible;
|
| 869 |
-
padding-bottom: 0;
|
| 870 |
-
}
|
| 871 |
-
.page-wrapper {
|
| 872 |
-
display: grid;
|
| 873 |
-
grid-template-columns: 1fr 300px;
|
| 874 |
-
margin: 176px auto 60px;
|
| 875 |
-
gap: 24px;
|
| 876 |
-
}
|
| 877 |
-
.sidebar {
|
| 878 |
-
order: unset;
|
| 879 |
-
margin-top: 0;
|
| 880 |
-
}
|
| 881 |
-
.ai-mobile-wrap {
|
| 882 |
-
display: none !important;
|
| 883 |
-
}
|
| 884 |
}
|
| 885 |
</style>
|
| 886 |
</head>
|
|
@@ -916,7 +251,6 @@
|
|
| 916 |
<main class="results-area" role="main">
|
| 917 |
<div id="loading-text" class="spinning">جاري جلب النتائج…</div>
|
| 918 |
|
| 919 |
-
<!-- AI card mobile only -->
|
| 920 |
<div class="ai-mobile-wrap" id="ai-mobile-wrap">
|
| 921 |
<div class="ai-glow-ring"></div>
|
| 922 |
<div class="ai-widget">
|
|
@@ -926,46 +260,28 @@
|
|
| 926 |
<span class="ai-widget-badge">AI</span>
|
| 927 |
</div>
|
| 928 |
<div class="ai-answer-body loading" id="ai-answer-body-mobile">
|
| 929 |
-
<div class="ai-skeleton"></div>
|
| 930 |
-
<div class="ai-skeleton"></div>
|
| 931 |
-
<div class="ai-skeleton"></div>
|
| 932 |
-
</div>
|
| 933 |
-
<div class="ai-sources" id="ai-sources-mobile"></div>
|
| 934 |
-
<div class="ai-widget-footer">
|
| 935 |
-
<i class="fa-solid fa-bolt"></i>
|
| 936 |
-
مدعوم بواسطة AnesNT
|
| 937 |
</div>
|
| 938 |
</div>
|
| 939 |
</div>
|
| 940 |
|
| 941 |
<div id="results-meta" class="results-meta" style="display:none"></div>
|
| 942 |
<div id="results-container"></div>
|
| 943 |
-
<button id="load-more-btn" class="load-more-btn" style="display:none">
|
| 944 |
-
<i class="fa-solid fa-chevron-down"></i> تحميل المزيد
|
| 945 |
-
</button>
|
| 946 |
</main>
|
| 947 |
|
| 948 |
-
<aside class="sidebar"
|
| 949 |
-
<div class="
|
| 950 |
-
<div class="ai-
|
| 951 |
-
|
| 952 |
-
<div class="ai-widget">
|
| 953 |
-
<div class="ai-widget-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
<div class="ai-
|
| 959 |
-
<div class="ai-skeleton"></div>
|
| 960 |
-
<div class="ai-skeleton"></div>
|
| 961 |
-
<div class="ai-skeleton"></div>
|
| 962 |
-
</div>
|
| 963 |
-
<div class="ai-sources" id="ai-sources-desktop"></div>
|
| 964 |
-
<div class="ai-widget-footer">
|
| 965 |
-
<i class="fa-solid fa-bolt"></i>
|
| 966 |
-
مدعوم بواسطة AnesNT
|
| 967 |
-
</div>
|
| 968 |
</div>
|
|
|
|
| 969 |
</div>
|
| 970 |
</div>
|
| 971 |
</aside>
|
|
@@ -974,459 +290,229 @@
|
|
| 974 |
<script>
|
| 975 |
(function() {
|
| 976 |
const SEARXNG_URL = "https://cjj-on-hf-searxng.hf.space/search";
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
// يمكن للمستخدم وضع API key هنا أو تركه فارغاً للعمل بدون AI
|
| 980 |
-
const GEMINI_API_KEY = ""; // ضع API key هنا إن وجد
|
| 981 |
-
|
| 982 |
-
// ── Theme ──
|
| 983 |
const themeBtn = document.getElementById('theme-toggle');
|
| 984 |
-
|
| 985 |
function setTheme(t) {
|
| 986 |
document.documentElement.setAttribute('data-theme', t);
|
| 987 |
localStorage.setItem('surfgo-theme', t);
|
| 988 |
-
themeBtn.innerHTML = t === 'dark' ?
|
| 989 |
-
'<i class="fa-solid fa-sun"></i>' :
|
| 990 |
-
'<i class="fa-solid fa-moon"></i>';
|
| 991 |
}
|
| 992 |
setTheme(localStorage.getItem('surfgo-theme') || 'light');
|
| 993 |
-
themeBtn.addEventListener('click', () =>
|
| 994 |
-
setTheme(document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' :
|
| 995 |
-
'dark');
|
| 996 |
-
});
|
| 997 |
|
| 998 |
-
//
|
| 999 |
const params = new URLSearchParams(window.location.search);
|
| 1000 |
let query = params.get('q') || '';
|
| 1001 |
let currentTab = params.get('tab') || 'all';
|
| 1002 |
-
let allResults =
|
| 1003 |
-
let displayedCount = 0;
|
| 1004 |
-
// عرض كل النتائج دفعة واحدة
|
| 1005 |
-
const PAGE_SIZE = 200;
|
| 1006 |
|
| 1007 |
const inputEl = document.getElementById('main-input');
|
| 1008 |
const resultsEl = document.getElementById('results-container');
|
| 1009 |
const loadingEl = document.getElementById('loading-text');
|
| 1010 |
const metaEl = document.getElementById('results-meta');
|
| 1011 |
-
const loadMoreBtn = document.getElementById('load-more-btn');
|
| 1012 |
|
| 1013 |
-
// ── Tabs ──
|
| 1014 |
function setActiveTab(tab) {
|
| 1015 |
-
document.querySelectorAll('.tab-pill').forEach(btn =>
|
| 1016 |
-
btn.classList.toggle('active', btn.dataset.tab === tab)
|
| 1017 |
-
);
|
| 1018 |
}
|
| 1019 |
setActiveTab(currentTab);
|
| 1020 |
|
| 1021 |
-
//
|
| 1022 |
-
|
| 1023 |
-
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
function setAILoading() {
|
| 1028 |
-
[aiBody, aiBodyMobile].forEach(el => {
|
| 1029 |
-
if (!el) return;
|
| 1030 |
-
el.className = 'ai-answer-body loading';
|
| 1031 |
-
el.innerHTML =
|
| 1032 |
-
'<div class="ai-skeleton"></div><div class="ai-skeleton"></div><div class="ai-skeleton"></div>';
|
| 1033 |
-
});
|
| 1034 |
-
[aiSrcDesktop, aiSrcMobile].forEach(el => { if (el) el.innerHTML = ''; });
|
| 1035 |
-
}
|
| 1036 |
-
|
| 1037 |
-
function setAIDone(text, sources = []) {
|
| 1038 |
-
[aiBody, aiBodyMobile].forEach(el => {
|
| 1039 |
-
if (!el) return;
|
| 1040 |
-
el.className = 'ai-answer-body';
|
| 1041 |
-
el.textContent = text || 'لا توجد إجابة مختصرة متاحة.';
|
| 1042 |
-
});
|
| 1043 |
-
|
| 1044 |
-
const chipsHTML = sources.slice(0, 4).map(s => {
|
| 1045 |
-
let domain = '';
|
| 1046 |
-
try { domain = new URL(s.url).hostname.replace('www.', ''); } catch { domain = s.url; }
|
| 1047 |
-
return `<a class="ai-source-chip" href="${s.url}" target="_blank" rel="noopener">
|
| 1048 |
-
<i class="fa-solid fa-link"></i>${escapeHTML(domain)}</a>`;
|
| 1049 |
-
}).join('');
|
| 1050 |
-
[aiSrcDesktop, aiSrcMobile].forEach(el => { if (el) el.innerHTML = chipsHTML; });
|
| 1051 |
-
}
|
| 1052 |
-
|
| 1053 |
-
// ── AI Answer via Gemini (مجاني) أو fallback محلي ──
|
| 1054 |
-
async function fetchAIAnswer(q, contextResults) {
|
| 1055 |
-
setAILoading();
|
| 1056 |
-
|
| 1057 |
-
// إذا كان هناك API key، استخدم Gemini
|
| 1058 |
-
if (GEMINI_API_KEY && GEMINI_API_KEY.trim() !== '') {
|
| 1059 |
-
try {
|
| 1060 |
-
const snippets = contextResults.slice(0, 5).map((r, i) =>
|
| 1061 |
-
`[${i + 1}] ${r.title || ''}: ${r.content || r.url || ''}`
|
| 1062 |
-
).join('\n');
|
| 1063 |
-
|
| 1064 |
-
const prompt =
|
| 1065 |
-
`أنت مساعد بحث ذكي. بناءً على نتائج البحث التالية، أجب على السؤال بإجابة مختصرة ومفيدة باللغة العربية (3-4 جمل فقط):\n\nالسؤال: "${q}"\n\nنتائج البحث:\n${snippets}\n\nأجب مباشرة دون مقدمة.`;
|
| 1066 |
-
|
| 1067 |
-
const resp = await fetch(`${GEMINI_API}?key=${GEMINI_API_KEY}`, {
|
| 1068 |
-
method: 'POST',
|
| 1069 |
-
headers: { 'Content-Type': 'application/json' },
|
| 1070 |
-
body: JSON.stringify({
|
| 1071 |
-
contents: [{ parts: [{ text: prompt }] }],
|
| 1072 |
-
generationConfig: { maxOutputTokens: 400, temperature: 0.4 }
|
| 1073 |
-
})
|
| 1074 |
-
});
|
| 1075 |
-
const data = await resp.json();
|
| 1076 |
-
const text = data.candidates?.[0]?.content?.parts?.[0]?.text || '';
|
| 1077 |
-
|
| 1078 |
-
// Typing effect
|
| 1079 |
-
typeAIResponse(text || 'لا توجد إجابة متاحة.', contextResults);
|
| 1080 |
-
return;
|
| 1081 |
-
} catch (err) {
|
| 1082 |
-
console.warn('Gemini API failed, using local summary:', err.message);
|
| 1083 |
-
// Fallback to local summary
|
| 1084 |
-
}
|
| 1085 |
-
}
|
| 1086 |
-
|
| 1087 |
-
// Fallback: استخدم أفضل نتيجة كإجابة
|
| 1088 |
-
const bestResult = contextResults[0];
|
| 1089 |
-
if (bestResult && bestResult.content) {
|
| 1090 |
-
const summary = bestResult.content.slice(0, 400).trim();
|
| 1091 |
-
const cleanSummary = summary.length > 350 ? summary.slice(0, 350) + '…' : summary;
|
| 1092 |
-
typeAIResponse(
|
| 1093 |
-
`🔍 أفضل نتيجة بحث:\n\n${cleanSummary}\n\n📎 المصدر: ${getDomain(bestResult.url)}`,
|
| 1094 |
-
contextResults.slice(0, 3)
|
| 1095 |
-
);
|
| 1096 |
-
} else {
|
| 1097 |
-
setAIDone('لم يتم العثور على إجابة مناسبة. حاول تحسين كلمات البحث.', []);
|
| 1098 |
-
}
|
| 1099 |
-
}
|
| 1100 |
-
|
| 1101 |
-
function typeAIResponse(fullText, sources) {
|
| 1102 |
-
[aiBody, aiBodyMobile].forEach(el => {
|
| 1103 |
-
if (!el) return;
|
| 1104 |
-
el.className = 'ai-answer-body';
|
| 1105 |
-
el.innerHTML = '<span class="ai-cursor"></span>';
|
| 1106 |
-
});
|
| 1107 |
-
|
| 1108 |
-
let i = 0;
|
| 1109 |
-
const interval = setInterval(() => {
|
| 1110 |
-
i += 3;
|
| 1111 |
-
const shown = fullText.slice(0, i);
|
| 1112 |
-
const stillTyping = i < fullText.length;
|
| 1113 |
-
[aiBody, aiBodyMobile].forEach(el => {
|
| 1114 |
-
if (!el) return;
|
| 1115 |
-
el.innerHTML = escapeHTML(shown) + (stillTyping ?
|
| 1116 |
-
'<span class="ai-cursor"></span>' : '');
|
| 1117 |
-
});
|
| 1118 |
-
if (!stillTyping) {
|
| 1119 |
-
clearInterval(interval);
|
| 1120 |
-
setAIDone(fullText, sources);
|
| 1121 |
-
}
|
| 1122 |
-
}, 18);
|
| 1123 |
-
}
|
| 1124 |
-
|
| 1125 |
-
// ── Helpers ──
|
| 1126 |
-
function escapeHTML(str) {
|
| 1127 |
-
if (!str) return '';
|
| 1128 |
-
return str.replace(/[&<>'"]/g, t => ({ '&': '&', '<': '<', '>': '>', "'": ''',
|
| 1129 |
-
'"': '"' } [t] || t));
|
| 1130 |
-
}
|
| 1131 |
-
|
| 1132 |
-
function getDomain(url) {
|
| 1133 |
-
try { return new URL(url).hostname.replace('www.', ''); } catch { return url || ''; }
|
| 1134 |
-
}
|
| 1135 |
-
|
| 1136 |
-
function showLoading(visible) {
|
| 1137 |
-
loadingEl.style.display = visible ? 'flex' : 'none';
|
| 1138 |
-
if (visible) loadingEl.classList.add('spinning');
|
| 1139 |
-
else loadingEl.classList.remove('spinning');
|
| 1140 |
-
}
|
| 1141 |
-
|
| 1142 |
-
// ── أفضل طريقة لاستخراج رابط الصورة ──
|
| 1143 |
function getBestImageUrl(r) {
|
| 1144 |
-
|
| 1145 |
-
const candidates =
|
| 1146 |
-
|
| 1147 |
-
r.thumbnail_src,
|
| 1148 |
-
r.thumbnail,
|
| 1149 |
-
r.image,
|
| 1150 |
-
r.url,
|
| 1151 |
-
r.source,
|
| 1152 |
-
r.img,
|
| 1153 |
-
r.thumb,
|
| 1154 |
-
r.preview,
|
| 1155 |
-
];
|
| 1156 |
-
for (const c of candidates) {
|
| 1157 |
-
if (c && typeof c === 'string' && c.match(/\.(jpg|jpeg|png|gif|webp|bmp|svg)/i)) {
|
| 1158 |
-
return c;
|
| 1159 |
-
}
|
| 1160 |
-
if (c && typeof c === 'string' && (c.startsWith('http://') || c.startsWith('https://')) && (
|
| 1161 |
-
c.includes('image') || c.includes('img') || c.includes('photo') || c.includes('pic') ||
|
| 1162 |
-
c.includes('thumb'))) {
|
| 1163 |
-
return c;
|
| 1164 |
-
}
|
| 1165 |
-
}
|
| 1166 |
-
// إذا لم نجد صورة واضحة، نرجع أول مرشح موجود
|
| 1167 |
-
for (const c of candidates) {
|
| 1168 |
-
if (c && typeof c === 'string' && (c.startsWith('http://') || c.startsWith('https://'))) {
|
| 1169 |
-
return c;
|
| 1170 |
-
}
|
| 1171 |
-
}
|
| 1172 |
-
return null;
|
| 1173 |
-
}
|
| 1174 |
-
|
| 1175 |
-
// ── Proxy للصور مع fallback ──
|
| 1176 |
-
function proxyImage(url) {
|
| 1177 |
-
if (!url) return null;
|
| 1178 |
-
if (url.startsWith('data:')) return url;
|
| 1179 |
-
// استخدام wsrv.nl كـ proxy موثوق
|
| 1180 |
-
return `https://wsrv.nl/?url=${encodeURIComponent(url)}&output=webp&maxage=7d&default=placeholder`;
|
| 1181 |
}
|
| 1182 |
|
| 1183 |
-
//
|
| 1184 |
-
function
|
| 1185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1186 |
}
|
| 1187 |
|
| 1188 |
-
//
|
| 1189 |
async function performSearch(q, tab = 'all') {
|
| 1190 |
-
resultsEl.innerHTML = '';
|
| 1191 |
-
|
| 1192 |
-
|
| 1193 |
-
|
| 1194 |
-
displayedCount = 0;
|
| 1195 |
-
showLoading(true);
|
| 1196 |
-
setAILoading();
|
| 1197 |
-
|
| 1198 |
-
const categoryMap = { all: 'general', news: 'news', images: 'images', videos: 'videos' };
|
| 1199 |
-
const category = categoryMap[tab] || 'general';
|
| 1200 |
-
const url =
|
| 1201 |
-
`${SEARXNG_URL}?q=${encodeURIComponent(q)}&format=json&categories=${category}&language=ar&safesearch=1`;
|
| 1202 |
-
|
| 1203 |
try {
|
| 1204 |
-
const response = await fetch(
|
| 1205 |
-
if (!response.ok) throw new Error('network');
|
| 1206 |
const data = await response.json();
|
| 1207 |
-
allResults = data.results ||
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
if (allResults.length > 0) {
|
| 1211 |
-
metaEl.style.display = 'flex';
|
| 1212 |
-
|
| 1213 |
-
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
|
| 1217 |
} else {
|
| 1218 |
-
|
| 1219 |
-
resultsEl.innerHTML = `<div class="empty-state">
|
| 1220 |
-
<i class="fa-solid fa-face-frown"></i>
|
| 1221 |
-
<p>لا توجد نتائج لـ "${escapeHTML(q)}"</p>
|
| 1222 |
-
</div>`;
|
| 1223 |
}
|
| 1224 |
} catch (error) {
|
| 1225 |
-
|
| 1226 |
-
|
| 1227 |
-
resultsEl.innerHTML = `<div class="empty-state">
|
| 1228 |
-
<i class="fa-solid fa-triangle-exclamation"></i>
|
| 1229 |
-
<p>تعذّر الاتصال. تحقق من اتصالك بالإنترنت أو جرب لاحقاً.</p>
|
| 1230 |
-
</div>`;
|
| 1231 |
}
|
| 1232 |
}
|
| 1233 |
|
| 1234 |
-
//
|
| 1235 |
-
function
|
| 1236 |
resultsEl.innerHTML = '';
|
| 1237 |
-
|
| 1238 |
-
|
| 1239 |
-
|
| 1240 |
-
|
| 1241 |
-
|
| 1242 |
-
|
| 1243 |
-
|
| 1244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1245 |
}
|
| 1246 |
|
| 1247 |
-
//
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
-
|
| 1255 |
-
|
| 1256 |
-
|
| 1257 |
-
|
| 1258 |
-
|
| 1259 |
-
|
| 1260 |
-
|
| 1261 |
-
|
| 1262 |
-
|
| 1263 |
-
|
| 1264 |
-
|
| 1265 |
-
|
| 1266 |
-
card.innerHTML = `
|
| 1267 |
-
<a class="image-card-link" href="${linkUrl}" target="_blank" rel="noopener" aria-label="${title}">
|
| 1268 |
-
<div class="img-skeleton"></div>
|
| 1269 |
-
<div class="image-error-state">
|
| 1270 |
-
<i class="fa-solid fa-image-slash"></i>
|
| 1271 |
-
<span>تعذّر تحميل الصورة</span>
|
| 1272 |
</div>
|
| 1273 |
-
|
| 1274 |
-
|
| 1275 |
-
<div class="image-info" title="${title}">${title}</div>`;
|
| 1276 |
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1280 |
|
| 1281 |
-
|
| 1282 |
-
img.addEventListener('load', () => {
|
| 1283 |
-
if (sk) sk.classList.add('hidden');
|
| 1284 |
-
img.style.opacity = '1';
|
| 1285 |
-
});
|
| 1286 |
-
img.addEventListener('error', function() {
|
| 1287 |
-
if (sk) sk.classList.add('hidden');
|
| 1288 |
-
img.style.display = 'none';
|
| 1289 |
-
if (err) err.classList.add('visible');
|
| 1290 |
-
// محاولة تحميل مباشر بدون proxy
|
| 1291 |
-
if (rawUrl && proxied && rawUrl !== proxied) {
|
| 1292 |
-
const directImg = document.createElement('img');
|
| 1293 |
-
directImg.src = rawUrl;
|
| 1294 |
-
directImg.alt = title;
|
| 1295 |
-
directImg.loading = 'lazy';
|
| 1296 |
-
directImg.style.cssText =
|
| 1297 |
-
'width:100%;height:100%;object-fit:cover;display:block;';
|
| 1298 |
-
directImg.addEventListener('load', function() {
|
| 1299 |
-
img.replaceWith(directImg);
|
| 1300 |
-
if (sk) sk.classList.add('hidden');
|
| 1301 |
-
if (err) err.classList.remove('visible');
|
| 1302 |
-
});
|
| 1303 |
-
directImg.addEventListener('error', function() {
|
| 1304 |
-
// فشل كل المحاولات
|
| 1305 |
-
});
|
| 1306 |
-
}
|
| 1307 |
-
});
|
| 1308 |
-
img.style.opacity = '0';
|
| 1309 |
-
img.style.transition = 'opacity 0.3s ease';
|
| 1310 |
-
} else {
|
| 1311 |
-
// لا يوجد رابط صورة
|
| 1312 |
-
if (sk) sk.classList.add('hidden');
|
| 1313 |
-
if (err) err.classList.add('visible');
|
| 1314 |
-
}
|
| 1315 |
|
| 1316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1317 |
});
|
| 1318 |
-
|
| 1319 |
-
resultsEl.appendChild(wrap);
|
| 1320 |
}
|
| 1321 |
|
| 1322 |
-
//
|
| 1323 |
-
function
|
| 1324 |
-
const wrap = document.createElement('div');
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
card.style.animationDelay = `${i * 0.03}s`;
|
| 1332 |
-
|
| 1333 |
-
card.innerHTML = `
|
| 1334 |
-
<a href="${escapeHTML(r.url)}" target="_blank" rel="noopener" class="video-thumb-wrap">
|
| 1335 |
-
${thumb ? `<img src="${escapeHTML(thumb)}" alt="${escapeHTML(r.title || '')}" loading="lazy"
|
| 1336 |
-
onerror="this.style.display='none';this.nextElementSibling.style.display='flex'">` : ''}
|
| 1337 |
-
<div class="play-overlay"><i class="fa-solid fa-play"></i></div>
|
| 1338 |
-
</a>
|
| 1339 |
-
<div class="video-details">
|
| 1340 |
-
<a class="video-title" href="${escapeHTML(r.url)}" target="_blank" rel="noopener">
|
| 1341 |
-
${escapeHTML(r.title || 'فيديو بدون عنوان')}
|
| 1342 |
-
</a>
|
| 1343 |
-
<div class="video-meta">
|
| 1344 |
-
${escapeHTML(getDomain(r.url))}
|
| 1345 |
-
${r.publishedDate ? ' · ' + escapeHTML(r.publishedDate) : ''}
|
| 1346 |
-
</div>
|
| 1347 |
</div>`;
|
| 1348 |
-
wrap.appendChild(card);
|
| 1349 |
});
|
| 1350 |
-
|
| 1351 |
resultsEl.appendChild(wrap);
|
| 1352 |
}
|
| 1353 |
|
| 1354 |
-
|
| 1355 |
-
|
| 1356 |
-
results.forEach(
|
| 1357 |
-
|
| 1358 |
-
|
| 1359 |
-
|
| 1360 |
-
article.style.animationDelay = `${index * 0.03}s`;
|
| 1361 |
-
article.innerHTML = `
|
| 1362 |
-
<div class="favicon-wrap">
|
| 1363 |
-
<img src="${faviconURL(domain)}" alt=""
|
| 1364 |
-
onerror="this.style.display='none';this.nextElementSibling.style.display='flex'"
|
| 1365 |
-
loading="lazy">
|
| 1366 |
-
<i class="fa-solid fa-globe fallback-icon" style="display:none"></i>
|
| 1367 |
-
</div>
|
| 1368 |
-
<div class="result-content">
|
| 1369 |
-
<div class="result-domain">
|
| 1370 |
-
<i class="fa-solid fa-link"></i>
|
| 1371 |
-
${escapeHTML(domain)}
|
| 1372 |
-
</div>
|
| 1373 |
-
<a class="result-title" href="${escapeHTML(r.url)}" target="_blank" rel="noopener noreferrer">
|
| 1374 |
-
${escapeHTML(r.title || 'بدون عنوان')}
|
| 1375 |
</a>
|
| 1376 |
-
<
|
| 1377 |
-
${escapeHTML(r.content || 'لا يوجد وصف متاح.')}
|
| 1378 |
-
</p>
|
| 1379 |
</div>`;
|
| 1380 |
-
resultsEl.appendChild(article);
|
| 1381 |
});
|
|
|
|
| 1382 |
}
|
| 1383 |
|
| 1384 |
-
//
|
| 1385 |
-
if (query) {
|
| 1386 |
-
inputEl.value = query;
|
| 1387 |
-
document.title = `${query} – SurfGO`;
|
| 1388 |
-
performSearch(query, currentTab);
|
| 1389 |
-
} else {
|
| 1390 |
-
showLoading(false);
|
| 1391 |
-
loadingEl.textContent = 'يرجى إدخال كلمة بحث للبدء.';
|
| 1392 |
-
loadingEl.style.display = 'block';
|
| 1393 |
-
loadingEl.classList.remove('spinning');
|
| 1394 |
-
}
|
| 1395 |
-
|
| 1396 |
-
// ── Form submit ──
|
| 1397 |
document.getElementById('search-form').addEventListener('submit', (e) => {
|
| 1398 |
-
e.preventDefault();
|
| 1399 |
-
const
|
| 1400 |
-
|
| 1401 |
-
const url = new URL(window.location);
|
| 1402 |
-
url.searchParams.set('q', q);
|
| 1403 |
-
url.searchParams.set('tab', currentTab);
|
| 1404 |
-
window.history.pushState({}, '', url);
|
| 1405 |
-
query = q;
|
| 1406 |
-
document.title = `${query} – SurfGO`;
|
| 1407 |
-
performSearch(q, currentTab);
|
| 1408 |
});
|
| 1409 |
-
|
| 1410 |
-
// ── Tab switch ──
|
| 1411 |
document.querySelectorAll('.tab-pill').forEach(btn => {
|
| 1412 |
btn.addEventListener('click', () => {
|
| 1413 |
-
const tab = btn.dataset.tab;
|
| 1414 |
-
|
| 1415 |
-
|
| 1416 |
-
|
| 1417 |
-
const url = new URL(window.location);
|
| 1418 |
-
url.searchParams.set('tab', tab);
|
| 1419 |
-
if (query) url.searchParams.set('q', query);
|
| 1420 |
-
window.history.pushState({}, '', url);
|
| 1421 |
-
if (query) performSearch(query, tab);
|
| 1422 |
});
|
| 1423 |
});
|
| 1424 |
-
|
| 1425 |
-
// ── Load more (احتياطي فقط) ──
|
| 1426 |
-
loadMoreBtn.addEventListener('click', () => {
|
| 1427 |
-
renderAllResults(currentTab);
|
| 1428 |
-
});
|
| 1429 |
-
|
| 1430 |
})();
|
| 1431 |
</script>
|
| 1432 |
</body>
|
|
|
|
| 49 |
--shadow-hover: 0 10px 36px rgba(130, 133, 255, 0.14);
|
| 50 |
}
|
| 51 |
|
| 52 |
+
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; outline: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
body {
|
| 55 |
+
font-family: 'Tajawal', sans-serif; background: var(--bg-base); color: var(--text-main);
|
| 56 |
+
min-height: 100vh; overflow-x: hidden; transition: background 0.35s, color 0.35s;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
}
|
| 58 |
|
| 59 |
+
.bg-mesh { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
|
| 60 |
+
.bg-mesh::before { content: ''; position: absolute; top: -20%; right: -15%; width: 55vw; height: 55vw; background: radial-gradient(circle, rgba(91, 94, 244, 0.13) 0%, transparent 70%); border-radius: 50%; animation: drift 18s ease-in-out infinite alternate; }
|
| 61 |
+
.bg-mesh::after { content: ''; position: absolute; bottom: -15%; left: -10%; width: 45vw; height: 45vw; background: radial-gradient(circle, rgba(224, 66, 122, 0.1) 0%, transparent 70%); border-radius: 50%; animation: drift 22s ease-in-out infinite alternate-reverse; }
|
| 62 |
+
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(4%, 3%) scale(1.06); } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
/* ===== NAVBAR ===== */
|
| 65 |
.navbar {
|
| 66 |
+
position: fixed; top: 14px; left: 50%; transform: translateX(-50%); width: 95%; max-width: 1280px;
|
| 67 |
+
height: auto; min-height: 68px; background: var(--bg-nav); backdrop-filter: blur(28px) saturate(1.6);
|
| 68 |
+
-webkit-backdrop-filter: blur(28px) saturate(1.6); border: 1px solid var(--border); border-radius: var(--radius-nav);
|
| 69 |
+
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 18px;
|
| 70 |
+
z-index: 1000; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
|
| 71 |
+
gap: 12px; transition: background 0.35s, border-color 0.35s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
+
.brand { font-family: 'Syne', sans-serif; font-weight: 400; font-size: 21px; text-decoration: none; color: var(--text-main); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
|
| 75 |
+
.brand-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; box-shadow: 0 4px 14px var(--accent-glow); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
.search-container { flex: 1; max-width: 580px; width: 100%; }
|
| 78 |
+
.search-bar { display: flex; align-items: center; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: var(--radius-pill); padding: 4px 4px 4px 16px; transition: var(--transition); width: 100%; }
|
| 79 |
+
.search-bar:focus-within { border-color: var(--accent); background: var(--bg-input-focus); box-shadow: 0 0 0 4px var(--accent-glow); }
|
| 80 |
+
.search-bar input { flex: 1; background: transparent; border: none; padding: 9px 0; color: var(--text-main); font-family: 'Tajawal', sans-serif; font-size: 14.5px; min-width: 0; }
|
| 81 |
+
.search-btn { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; cursor: pointer; width: 40px; height: 36px; border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; transition: var(--transition); }
|
| 82 |
+
.search-btn:hover { opacity: 0.88; transform: scale(1.06); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
.nav-actions { display: flex; align-items: center; gap: 8px; }
|
| 85 |
+
#theme-toggle { background: var(--bg-input); border: 1.5px solid var(--border); color: var(--text-sub); cursor: pointer; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
|
| 86 |
+
#theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
/* ===== TABS ===== */
|
| 89 |
.tabs-bar {
|
| 90 |
+
position: fixed; top: 98px; left: 50%; transform: translateX(-50%); width: 95%; max-width: 1280px;
|
| 91 |
+
display: flex; gap: 6px; z-index: 999; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
}
|
| 93 |
+
.tabs-bar::-webkit-scrollbar { display: none; }
|
| 94 |
+
.tab-pill { padding: 7px 16px; border-radius: var(--radius-pill); background: var(--bg-card); border: 1.5px solid var(--border); color: var(--text-sub); font-family: 'Tajawal', sans-serif; font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 6px; white-space: nowrap; box-shadow: var(--shadow-card); }
|
| 95 |
+
.tab-pill:hover { border-color: var(--border-hover); color: var(--accent); }
|
| 96 |
+
.tab-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 16px var(--accent-glow); }
|
| 97 |
|
| 98 |
/* ===== LAYOUT ===== */
|
| 99 |
+
.page-wrapper { position: relative; z-index: 1; max-width: 1280px; margin: 170px auto 60px; padding: 0 16px; display: flex; flex-direction: column; gap: 24px; }
|
| 100 |
+
.results-area { min-width: 0; width: 100%; }
|
| 101 |
+
|
| 102 |
+
#loading-text { color: var(--text-sub); font-size: 13.5px; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
|
| 103 |
+
#loading-text.spinning::before { content: ''; display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
|
| 104 |
+
@keyframes spin { to { transform: rotate(360deg); } }
|
| 105 |
+
|
| 106 |
+
/* ===== STANDARD RESULTS ===== */
|
| 107 |
+
.search-result { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-card); padding: 18px 20px; margin-bottom: 12px; transition: var(--transition); box-shadow: var(--shadow-card); display: flex; gap: 14px; align-items: flex-start; animation: fadeSlideIn 0.35s ease both; }
|
| 108 |
+
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
| 109 |
+
.search-result:hover { border-color: var(--border-hover); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
|
| 110 |
+
.favicon-wrap { width: 22px; height: 22px; border-radius: 5px; overflow: hidden; flex-shrink: 0; margin-top: 3px; background: var(--bg-input); display: flex; align-items: center; justify-content: center; }
|
| 111 |
+
.favicon-wrap img { width: 16px; height: 16px; object-fit: contain; }
|
| 112 |
+
.result-content { flex: 1; min-width: 0; }
|
| 113 |
+
.result-domain { font-size: 11.5px; color: var(--text-faint); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
|
| 114 |
+
.result-title { font-family: 'Tajawal', sans-serif; font-size: 16px; font-weight: 700; color: var(--accent) !important; text-decoration: none; display: inline-block; margin-bottom: 6px; line-height: 1.4; transition: color 0.2s; }
|
| 115 |
+
.result-title:hover { color: var(--accent-2) !important; }
|
| 116 |
+
.result-snippet { font-size: 13.5px; color: var(--text-sub); line-height: 1.65; }
|
| 117 |
+
|
| 118 |
+
/* ========================================= */
|
| 119 |
+
/* ===== RICH RESULTS (KNOWLEDGE GRAPH) ===== */
|
| 120 |
+
/* ========================================= */
|
| 121 |
+
.rich-graph-container { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; animation: fadeSlideIn 0.35s ease both; }
|
| 122 |
+
|
| 123 |
+
/* 1. Images Row */
|
| 124 |
+
.rich-images-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 5px; }
|
| 125 |
+
.rich-images-row::-webkit-scrollbar { display: none; }
|
| 126 |
+
.rich-img-card { display: block; height: 160px; border-radius: 14px; overflow: hidden; flex-shrink: 0; background: var(--bg-input); border: 1px solid var(--border); box-shadow: var(--shadow-card); transition: var(--transition); }
|
| 127 |
+
.rich-img-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--border-hover); }
|
| 128 |
+
.rich-img-card img { height: 100%; width: auto; object-fit: cover; display: block; }
|
| 129 |
+
.rich-img-skeleton { height: 160px; width: 140px; border-radius: 14px; background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; flex-shrink: 0; }
|
| 130 |
+
|
| 131 |
+
/* 2. Wiki/Main Card */
|
| 132 |
+
.wiki-card { margin-bottom: 0 !important; }
|
| 133 |
+
.wiki-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
|
| 134 |
+
.wiki-domain { font-size: 13px; font-weight: bold; color: var(--text-main); }
|
| 135 |
+
.wiki-url { font-size: 11px; color: var(--text-faint); text-decoration: none; }
|
| 136 |
+
|
| 137 |
+
/* 3. Section Titles */
|
| 138 |
+
.rich-section-title { font-size: 18px; font-weight: 700; margin: 10px 0; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
|
| 139 |
+
.rich-section-title i { font-size: 14px; color: var(--text-faint); margin-right: auto; }
|
| 140 |
+
|
| 141 |
+
/* 4. Videos Row */
|
| 142 |
+
.rich-videos-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
|
| 143 |
+
.rich-videos-row::-webkit-scrollbar { display: none; }
|
| 144 |
+
.rich-vid-card { flex: 0 0 240px; text-decoration: none; background: var(--bg-card); border-radius: 14px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-card); transition: var(--transition); }
|
| 145 |
+
.rich-vid-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
|
| 146 |
+
.rich-vid-thumb { height: 135px; position: relative; background: var(--bg-input); }
|
| 147 |
+
.rich-vid-thumb img { width: 100%; height: 100%; object-fit: cover; }
|
| 148 |
+
.rich-vid-play { position: absolute; bottom: 10px; left: 10px; background: rgba(0,0,0,0.7); color: #fff; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; backdrop-filter: blur(4px); }
|
| 149 |
+
.rich-vid-info { padding: 12px; }
|
| 150 |
+
.rich-vid-title { font-size: 13px; font-weight: 600; color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
|
| 151 |
+
.rich-vid-meta { font-size: 11px; color: var(--text-faint); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
|
| 152 |
+
.rich-vid-meta img { width: 14px; height: 14px; border-radius: 50%; }
|
| 153 |
+
|
| 154 |
+
/* 5. Discover Bubbles */
|
| 155 |
+
.discover-bubbles { display: flex; flex-direction: column; gap: 8px; }
|
| 156 |
+
.discover-bubble { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-pill); padding: 14px 20px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: var(--transition); font-family: 'Tajawal', sans-serif; font-size: 15px; font-weight: 500; color: var(--text-main); text-align: right; box-shadow: var(--shadow-card); }
|
| 157 |
+
.discover-bubble i { color: var(--text-faint); font-size: 15px; }
|
| 158 |
+
.discover-bubble:hover { background: var(--bg-input-focus); border-color: var(--accent); color: var(--accent); transform: translateX(-5px); }
|
| 159 |
+
|
| 160 |
+
/* ========================================= */
|
| 161 |
+
|
| 162 |
+
/* ===== GRID LAYOUTS (For pure Images/Videos tabs) ===== */
|
| 163 |
+
.images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; width: 100%; }
|
| 164 |
+
.image-card { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-card); overflow: hidden; transition: var(--transition); box-shadow: var(--shadow-card); animation: fadeSlideIn 0.35s ease both; display: flex; flex-direction: column; }
|
| 165 |
+
.image-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-hover); transform: translateY(-5px); }
|
| 166 |
+
.image-card-link { display: block; width: 100%; height: 170px; overflow: hidden; background: var(--bg-input); position: relative; }
|
| 167 |
+
.image-card-link img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; display: block; }
|
| 168 |
+
.image-card:hover .image-card-link img { transform: scale(1.06); }
|
| 169 |
+
.image-info { padding: 9px 10px; font-size: 11.5px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--border); background: var(--bg-card); }
|
| 170 |
+
|
| 171 |
+
.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; width: 100%; }
|
| 172 |
+
.video-card { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-card); overflow: hidden; transition: var(--transition); box-shadow: var(--shadow-card); animation: fadeSlideIn 0.35s ease both; }
|
| 173 |
+
.video-card:hover { border-color: var(--border-hover); transform: translateY(-3px); }
|
| 174 |
+
.video-thumb-wrap { position: relative; width: 100%; height: 170px; background: var(--bg-input); display: block; overflow: hidden; }
|
| 175 |
+
.video-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; display: block; }
|
| 176 |
+
.play-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; background: rgba(91, 94, 244, 0.92); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; box-shadow: 0 0 20px var(--accent-glow); transition: var(--transition); z-index: 2; }
|
| 177 |
+
.video-details { padding: 12px; }
|
| 178 |
+
.video-title { font-size: 14px; font-weight: 700; color: var(--text-main); text-decoration: none; display: block; margin-bottom: 5px; line-height: 1.4; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
/* ===== AI WIDGET ===== */
|
| 181 |
+
.sidebar { width: 100%; order: 2; margin-top: 12px; }
|
| 182 |
+
.ai-widget-wrap { position: relative; border-radius: var(--radius-card); }
|
| 183 |
+
.ai-glow-ring { position: absolute; inset: -2px; border-radius: calc(var(--radius-card) + 2px); background: conic-gradient(from var(--angle, 0deg), var(--accent), var(--accent-2), #a78bfa, var(--accent), var(--accent-2), var(--accent)); z-index: 0; animation: spin-glow 4s linear infinite; filter: blur(1px); }
|
| 184 |
+
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
|
| 185 |
+
@keyframes spin-glow { to { --angle: 360deg; } }
|
| 186 |
+
.ai-widget { position: relative; z-index: 1; background: var(--bg-card); border-radius: var(--radius-card); padding: 18px 18px 16px; box-shadow: var(--shadow-card); }
|
| 187 |
+
.ai-widget-header { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
|
| 188 |
+
.ai-widget-icon { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; }
|
| 189 |
+
.ai-widget-title { font-family: 'Syne', sans-serif; font-size: 13.5px; font-weight: 600; color: var(--text-main); }
|
| 190 |
+
.ai-widget-badge { margin-right: auto; font-size: 10px; padding: 2px 8px; border-radius: 20px; background: var(--accent-glow); color: var(--accent); font-weight: 600; border: 1px solid rgba(91, 94, 244, 0.2); }
|
| 191 |
+
.ai-answer-body { font-size: 13.5px; color: var(--text-sub); line-height: 1.75; min-height: 60px; }
|
| 192 |
+
.ai-skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; margin-bottom: 8px; }
|
| 193 |
+
.ai-widget-footer { font-size: 10.5px; color: var(--text-faint); margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 5px; }
|
| 194 |
+
|
| 195 |
+
.ai-mobile-wrap { display: none; position: relative; border-radius: var(--radius-card); margin-bottom: 16px; }
|
| 196 |
+
|
| 197 |
+
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-sub); }
|
| 198 |
+
.empty-state i { font-size: 40px; margin-bottom: 16px; color: var(--text-faint); display: block; }
|
| 199 |
+
|
| 200 |
+
.results-meta { font-size: 12px; color: var(--text-faint); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
|
| 201 |
+
.results-meta span { color: var(--accent); font-weight: 600; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
@media (max-width: 767px) {
|
| 204 |
+
.navbar { top: 10px; border-radius: 16px; padding: 10px 14px; gap: 10px; }
|
| 205 |
+
.brand { font-size: 18px; }
|
| 206 |
+
.tabs-bar { top: 125px; }
|
| 207 |
+
.page-wrapper { margin-top: 176px; gap: 16px; }
|
| 208 |
+
.sidebar { display: none !important; }
|
| 209 |
+
.ai-mobile-wrap { display: block; }
|
| 210 |
+
.rich-img-card { height: 120px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
}
|
| 212 |
@media (min-width: 768px) {
|
| 213 |
+
.navbar { flex-wrap: nowrap; padding: 0 22px; height: 68px; gap: 0; }
|
| 214 |
+
.search-container { margin: 0 20px; }
|
| 215 |
+
.tabs-bar { top: 98px; overflow-x: visible; padding-bottom: 0; }
|
| 216 |
+
.page-wrapper { display: grid; grid-template-columns: 1fr 300px; margin: 176px auto 60px; gap: 24px; }
|
| 217 |
+
.sidebar { order: unset; margin-top: 0; }
|
| 218 |
+
.ai-mobile-wrap { display: none !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
}
|
| 220 |
</style>
|
| 221 |
</head>
|
|
|
|
| 251 |
<main class="results-area" role="main">
|
| 252 |
<div id="loading-text" class="spinning">جاري جلب النتائج…</div>
|
| 253 |
|
|
|
|
| 254 |
<div class="ai-mobile-wrap" id="ai-mobile-wrap">
|
| 255 |
<div class="ai-glow-ring"></div>
|
| 256 |
<div class="ai-widget">
|
|
|
|
| 260 |
<span class="ai-widget-badge">AI</span>
|
| 261 |
</div>
|
| 262 |
<div class="ai-answer-body loading" id="ai-answer-body-mobile">
|
| 263 |
+
<div class="ai-skeleton"></div><div class="ai-skeleton"></div><div class="ai-skeleton"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
</div>
|
| 265 |
</div>
|
| 266 |
</div>
|
| 267 |
|
| 268 |
<div id="results-meta" class="results-meta" style="display:none"></div>
|
| 269 |
<div id="results-container"></div>
|
|
|
|
|
|
|
|
|
|
| 270 |
</main>
|
| 271 |
|
| 272 |
+
<aside class="sidebar">
|
| 273 |
+
<div class="ai-widget-wrap">
|
| 274 |
+
<div class="ai-glow-ring"></div>
|
| 275 |
+
<div class="ai-widget">
|
| 276 |
+
<div class="ai-widget-header">
|
| 277 |
+
<div class="ai-widget-icon"><i class="fa-solid fa-robot"></i></div>
|
| 278 |
+
<span class="ai-widget-title">إجابة الذكاء الاصطناعي</span>
|
| 279 |
+
<span class="ai-widget-badge">AI</span>
|
| 280 |
+
</div>
|
| 281 |
+
<div class="ai-answer-body loading" id="ai-answer-body">
|
| 282 |
+
<div class="ai-skeleton"></div><div class="ai-skeleton"></div><div class="ai-skeleton"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
</div>
|
| 284 |
+
<div class="ai-widget-footer"><i class="fa-solid fa-bolt"></i> مدعوم بواسطة AnesNT</div>
|
| 285 |
</div>
|
| 286 |
</div>
|
| 287 |
</aside>
|
|
|
|
| 290 |
<script>
|
| 291 |
(function() {
|
| 292 |
const SEARXNG_URL = "https://cjj-on-hf-searxng.hf.space/search";
|
| 293 |
+
|
| 294 |
+
// Theme
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
const themeBtn = document.getElementById('theme-toggle');
|
|
|
|
| 296 |
function setTheme(t) {
|
| 297 |
document.documentElement.setAttribute('data-theme', t);
|
| 298 |
localStorage.setItem('surfgo-theme', t);
|
| 299 |
+
themeBtn.innerHTML = t === 'dark' ? '<i class="fa-solid fa-sun"></i>' : '<i class="fa-solid fa-moon"></i>';
|
|
|
|
|
|
|
| 300 |
}
|
| 301 |
setTheme(localStorage.getItem('surfgo-theme') || 'light');
|
| 302 |
+
themeBtn.addEventListener('click', () => setTheme(document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark'));
|
|
|
|
|
|
|
|
|
|
| 303 |
|
| 304 |
+
// State
|
| 305 |
const params = new URLSearchParams(window.location.search);
|
| 306 |
let query = params.get('q') || '';
|
| 307 |
let currentTab = params.get('tab') || 'all';
|
| 308 |
+
let allResults =[];
|
|
|
|
|
|
|
|
|
|
| 309 |
|
| 310 |
const inputEl = document.getElementById('main-input');
|
| 311 |
const resultsEl = document.getElementById('results-container');
|
| 312 |
const loadingEl = document.getElementById('loading-text');
|
| 313 |
const metaEl = document.getElementById('results-meta');
|
|
|
|
| 314 |
|
|
|
|
| 315 |
function setActiveTab(tab) {
|
| 316 |
+
document.querySelectorAll('.tab-pill').forEach(btn => btn.classList.toggle('active', btn.dataset.tab === tab));
|
|
|
|
|
|
|
| 317 |
}
|
| 318 |
setActiveTab(currentTab);
|
| 319 |
|
| 320 |
+
// Helpers
|
| 321 |
+
function escapeHTML(str) { return str ? str.replace(/[&<>'"]/g, t => ({ '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' }[t] || t)) : ''; }
|
| 322 |
+
function getDomain(url) { try { return new URL(url).hostname.replace('www.', ''); } catch { return url || ''; } }
|
| 323 |
+
function proxyImage(url) { return url && !url.startsWith('data:') ? `https://wsrv.nl/?url=${encodeURIComponent(url)}&output=webp&maxage=7d&default=placeholder` : url; }
|
| 324 |
+
function faviconURL(domain) { return `https://www.google.com/s2/favicons?domain=${domain}&sz=32`; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
function getBestImageUrl(r) {
|
| 326 |
+
const candidates =[r.img_src, r.thumbnail_src, r.thumbnail, r.image, r.url, r.img];
|
| 327 |
+
for (const c of candidates) if (c && typeof c === 'string' && c.match(/\.(jpg|jpeg|png|gif|webp)/i)) return c;
|
| 328 |
+
return candidates.find(c => c && typeof c === 'string' && c.startsWith('http'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
}
|
| 330 |
|
| 331 |
+
// Dummy AI Fallback
|
| 332 |
+
function runAI(q, results) {
|
| 333 |
+
const els = [document.getElementById('ai-answer-body'), document.getElementById('ai-answer-body-mobile')];
|
| 334 |
+
els.forEach(el => { if(el) el.innerHTML = '<div class="ai-skeleton"></div><div class="ai-skeleton"></div>'; });
|
| 335 |
+
setTimeout(() => {
|
| 336 |
+
const text = results[0] ? `بناءً على البحث، ${results[0].content.slice(0, 150)}...` : 'لا توجد معلومات كافية.';
|
| 337 |
+
els.forEach(el => { if(el) el.textContent = text; });
|
| 338 |
+
}, 1500);
|
| 339 |
}
|
| 340 |
|
| 341 |
+
// Search Trigger
|
| 342 |
async function performSearch(q, tab = 'all') {
|
| 343 |
+
resultsEl.innerHTML = ''; metaEl.style.display = 'none';
|
| 344 |
+
loadingEl.style.display = 'flex'; loadingEl.classList.add('spinning');
|
| 345 |
+
const category = { all: 'general', news: 'news', images: 'images', videos: 'videos' }[tab] || 'general';
|
| 346 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
try {
|
| 348 |
+
const response = await fetch(`${SEARXNG_URL}?q=${encodeURIComponent(q)}&format=json&categories=${category}&language=ar&safesearch=1`, { signal: AbortSignal.timeout(15000) });
|
|
|
|
| 349 |
const data = await response.json();
|
| 350 |
+
allResults = data.results ||[];
|
| 351 |
+
loadingEl.style.display = 'none';
|
| 352 |
+
|
| 353 |
if (allResults.length > 0) {
|
| 354 |
+
metaEl.style.display = 'flex'; metaEl.innerHTML = `تقريباً <span>${allResults.length}</span> نتيجة`;
|
| 355 |
+
runAI(q, allResults);
|
| 356 |
+
|
| 357 |
+
if (tab === 'images') renderImages(allResults);
|
| 358 |
+
else if (tab === 'videos') renderVideos(allResults);
|
| 359 |
+
else renderWeb(q, allResults);
|
| 360 |
} else {
|
| 361 |
+
resultsEl.innerHTML = `<div class="empty-state"><i class="fa-solid fa-face-frown"></i><p>لا توجد نتائج لـ "${escapeHTML(q)}"</p></div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
}
|
| 363 |
} catch (error) {
|
| 364 |
+
loadingEl.style.display = 'none';
|
| 365 |
+
resultsEl.innerHTML = `<div class="empty-state"><i class="fa-solid fa-triangle-exclamation"></i><p>تعذّر الاتصال بالمحرك.</p></div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
}
|
| 367 |
}
|
| 368 |
|
| 369 |
+
// --- RICH RESULTS INJECTION (Knowledge Graph Style) ---
|
| 370 |
+
function renderWeb(q, results) {
|
| 371 |
resultsEl.innerHTML = '';
|
| 372 |
+
|
| 373 |
+
// 1. استخراج نتيجة ويكيبيديا أو أول نتيجة لتكون البطاقة الرئيسية
|
| 374 |
+
let mainCard = results.find(r => r.url.includes('wikipedia.org'));
|
| 375 |
+
if (!mainCard) mainCard = results.find(r => !r.url.includes('youtube.com')); // Fallback
|
| 376 |
+
|
| 377 |
+
// 2. استخراج الفيديوهات من النتائج العامة
|
| 378 |
+
const ytResults = results.filter(r => r.url.includes('youtube.com/watch')).slice(0, 4);
|
| 379 |
+
|
| 380 |
+
// حاوية النتائج الغنية
|
| 381 |
+
const richContainer = document.createElement('div');
|
| 382 |
+
richContainer.className = 'rich-graph-container';
|
| 383 |
+
|
| 384 |
+
// -- أ. شريط الصور العلوي (يتم جلبه في الخلفية) --
|
| 385 |
+
const imagesRow = document.createElement('div');
|
| 386 |
+
imagesRow.className = 'rich-images-row';
|
| 387 |
+
imagesRow.innerHTML = `<div class="rich-img-skeleton"></div><div class="rich-img-skeleton"></div><div class="rich-img-skeleton"></div><div class="rich-img-skeleton"></div>`;
|
| 388 |
+
richContainer.appendChild(imagesRow);
|
| 389 |
+
|
| 390 |
+
fetch(`${SEARXNG_URL}?q=${encodeURIComponent(q)}&format=json&categories=images&language=ar`)
|
| 391 |
+
.then(res => res.json())
|
| 392 |
+
.then(data => {
|
| 393 |
+
if (data.results && data.results.length > 0) {
|
| 394 |
+
imagesRow.innerHTML = data.results.slice(0, 6).map(r => {
|
| 395 |
+
const imgUrl = proxyImage(getBestImageUrl(r));
|
| 396 |
+
return `<a href="${imgUrl}" target="_blank" class="rich-img-card"><img src="${imgUrl}" alt="صورة" loading="lazy" /></a>`;
|
| 397 |
+
}).join('');
|
| 398 |
+
} else { imagesRow.style.display = 'none'; }
|
| 399 |
+
}).catch(() => imagesRow.style.display = 'none');
|
| 400 |
+
|
| 401 |
+
// -- ب. بطاقة المعرفة (ويكيبيديا غالباً) --
|
| 402 |
+
if (mainCard) {
|
| 403 |
+
const dmn = getDomain(mainCard.url);
|
| 404 |
+
const isWiki = dmn.includes('wikipedia');
|
| 405 |
+
richContainer.innerHTML += `
|
| 406 |
+
<div class="wiki-card search-result">
|
| 407 |
+
<div class="wiki-header">
|
| 408 |
+
<img src="${faviconURL(dmn)}" class="favicon-wrap" style="width:24px;height:24px;border-radius:4px" />
|
| 409 |
+
<div>
|
| 410 |
+
<div class="wiki-domain">${isWiki ? 'ويكيبيديا' : escapeHTML(dmn)}</div>
|
| 411 |
+
<a href="${mainCard.url}" target="_blank" class="wiki-url">${mainCard.url}</a>
|
| 412 |
+
</div>
|
| 413 |
+
</div>
|
| 414 |
+
<a href="${mainCard.url}" target="_blank" class="result-title" style="font-size:20px;">${escapeHTML(mainCard.title)}</a>
|
| 415 |
+
<p class="result-snippet">${escapeHTML(mainCard.content)}</p>
|
| 416 |
+
</div>
|
| 417 |
+
`;
|
| 418 |
}
|
| 419 |
|
| 420 |
+
// -- ج. الفيديوهات --
|
| 421 |
+
if (ytResults.length > 0) {
|
| 422 |
+
richContainer.innerHTML += `
|
| 423 |
+
<h3 class="rich-section-title">فيديوهات لـ ${escapeHTML(q)} <i class="fa-solid fa-chevron-left"></i></h3>
|
| 424 |
+
<div class="rich-videos-row">
|
| 425 |
+
${ytResults.map(r => {
|
| 426 |
+
const vidMatch = r.url.match(/v=([^&]+)/);
|
| 427 |
+
const thumb = vidMatch ? \`https://img.youtube.com/vi/\${vidMatch[1]}/mqdefault.jpg\` : proxyImage(r.thumbnail);
|
| 428 |
+
return \`<a href="\${r.url}" target="_blank" class="rich-vid-card">
|
| 429 |
+
<div class="rich-vid-thumb">
|
| 430 |
+
<img src="\${thumb}" alt="thumb" loading="lazy" />
|
| 431 |
+
<div class="rich-vid-play"><i class="fa-solid fa-play"></i></div>
|
| 432 |
+
</div>
|
| 433 |
+
<div class="rich-vid-info">
|
| 434 |
+
<div class="rich-vid-title">\${escapeHTML(r.title)}</div>
|
| 435 |
+
<div class="rich-vid-meta"><img src="\${faviconURL('youtube.com')}" /> YouTube</div>
|
| 436 |
+
</div>
|
| 437 |
+
</a>\`;
|
| 438 |
+
}).join('')}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
</div>
|
| 440 |
+
`;
|
| 441 |
+
}
|
|
|
|
| 442 |
|
| 443 |
+
// -- د. استكشف بالتفصيل (أزرار البحث) --
|
| 444 |
+
const discoverQueries =[`${q} جميلة جدا`, `أنواع ${q}`, `صور ${q}`, `فيديوهات ${q}`, `معلومات عن ${q}`];
|
| 445 |
+
richContainer.innerHTML += `
|
| 446 |
+
<h3 class="rich-section-title">استكشف ${escapeHTML(q)} بالتفصيل</h3>
|
| 447 |
+
<div class="discover-bubbles">
|
| 448 |
+
${discoverQueries.map(dq => \`
|
| 449 |
+
<button class="discover-bubble" onclick="document.getElementById('main-input').value='\${dq}'; document.getElementById('search-form').dispatchEvent(new Event('submit'));">
|
| 450 |
+
<i class="fa-solid fa-magnifying-glass"></i> \${dq}
|
| 451 |
+
</button>
|
| 452 |
+
\`).join('')}
|
| 453 |
+
</div>
|
| 454 |
+
`;
|
| 455 |
|
| 456 |
+
resultsEl.appendChild(richContainer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 457 |
|
| 458 |
+
// --- 3. عرض باقي النتائج العادية تحته ---
|
| 459 |
+
results.filter(r => r !== mainCard && !ytResults.includes(r)).forEach(r => {
|
| 460 |
+
const domain = getDomain(r.url);
|
| 461 |
+
const article = document.createElement('article');
|
| 462 |
+
article.className = 'search-result';
|
| 463 |
+
article.innerHTML = `
|
| 464 |
+
<div class="favicon-wrap"><img src="${faviconURL(domain)}" loading="lazy"></div>
|
| 465 |
+
<div class="result-content">
|
| 466 |
+
<div class="result-domain"><i class="fa-solid fa-link"></i> ${escapeHTML(domain)}</div>
|
| 467 |
+
<a class="result-title" href="${escapeHTML(r.url)}" target="_blank">${escapeHTML(r.title)}</a>
|
| 468 |
+
<p class="result-snippet">${escapeHTML(r.content)}</p>
|
| 469 |
+
</div>`;
|
| 470 |
+
resultsEl.appendChild(article);
|
| 471 |
});
|
|
|
|
|
|
|
| 472 |
}
|
| 473 |
|
| 474 |
+
// Normal Render functions for other tabs
|
| 475 |
+
function renderImages(results) {
|
| 476 |
+
const wrap = document.createElement('div'); wrap.className = 'images-grid';
|
| 477 |
+
results.forEach(r => {
|
| 478 |
+
const img = proxyImage(getBestImageUrl(r));
|
| 479 |
+
if(!img) return;
|
| 480 |
+
wrap.innerHTML += `<div class="image-card">
|
| 481 |
+
<a class="image-card-link" href="${r.url}" target="_blank"><img src="${escapeHTML(img)}" loading="lazy"></a>
|
| 482 |
+
<div class="image-info">${escapeHTML(r.title)}</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
</div>`;
|
|
|
|
| 484 |
});
|
|
|
|
| 485 |
resultsEl.appendChild(wrap);
|
| 486 |
}
|
| 487 |
|
| 488 |
+
function renderVideos(results) {
|
| 489 |
+
const wrap = document.createElement('div'); wrap.className = 'videos-grid';
|
| 490 |
+
results.forEach(r => {
|
| 491 |
+
wrap.innerHTML += `<div class="video-card">
|
| 492 |
+
<a href="${r.url}" target="_blank" class="video-thumb-wrap">
|
| 493 |
+
<img src="${proxyImage(r.thumbnail)}" loading="lazy"><div class="play-overlay"><i class="fa-solid fa-play"></i></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
</a>
|
| 495 |
+
<div class="video-details"><a class="video-title" href="${r.url}" target="_blank">${escapeHTML(r.title)}</a></div>
|
|
|
|
|
|
|
| 496 |
</div>`;
|
|
|
|
| 497 |
});
|
| 498 |
+
resultsEl.appendChild(wrap);
|
| 499 |
}
|
| 500 |
|
| 501 |
+
// Events
|
| 502 |
+
if (query) { inputEl.value = query; performSearch(query, currentTab); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
document.getElementById('search-form').addEventListener('submit', (e) => {
|
| 504 |
+
e.preventDefault(); const q = inputEl.value.trim(); if (!q) return;
|
| 505 |
+
const url = new URL(window.location); url.searchParams.set('q', q); url.searchParams.set('tab', currentTab);
|
| 506 |
+
window.history.pushState({}, '', url); query = q; performSearch(q, currentTab);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
});
|
|
|
|
|
|
|
| 508 |
document.querySelectorAll('.tab-pill').forEach(btn => {
|
| 509 |
btn.addEventListener('click', () => {
|
| 510 |
+
const tab = btn.dataset.tab; if (tab === currentTab) return;
|
| 511 |
+
currentTab = tab; setActiveTab(tab);
|
| 512 |
+
const url = new URL(window.location); url.searchParams.set('tab', tab); if (query) url.searchParams.set('q', query);
|
| 513 |
+
window.history.pushState({}, '', url); if (query) performSearch(query, tab);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 514 |
});
|
| 515 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 516 |
})();
|
| 517 |
</script>
|
| 518 |
</body>
|