document.addEventListener("DOMContentLoaded", function () {
try {
// استدعاء الخط
const fontLink = document.createElement("link");
fontLink.rel = "stylesheet";
fontLink.href = "https://fonts.googleapis.com/css2?family=Scheherazade+New:wght@600&display=swap";
document.head.appendChild(fontLink);
// تنسيقات الفيديو والنصوص
const style = document.createElement("style");
style.innerHTML = `
.custom-video-banner {
position: relative;
width: 100%;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
height: 500px;
opacity: 0;
transform: translateY(50px);
transition: all 1s ease;
}
.custom-video-banner.visible {
opacity: 1;
transform: translateY(0);
}
.custom-video-banner video {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
filter: brightness(0.65);
}
/* النص */
.custom-video-banner .banner-text {
position: absolute;
color: #fff;
font-family: 'Scheherazade New', serif;
text-align: center;
padding: 20px;
border-radius: 12px;
-webkit-backdrop-filter: blur(4px);
max-width: 90%;
font-size: 1.6rem;
line-height: 1.8;
}
.custom-video-banner .typing-text {
display: inline-block;
overflow: hidden;
white-space: nowrap;
border-right: 2px solid rgba(255,255,255,0.75);
animation: typing 5s steps(50, end) forwards, blink 0.8s step-end infinite;
}
@keyframes typing {
from { width: 0 }
to { width: 100% }
}
@keyframes blink {
50% { border-color: transparent }
}
.custom-video-banner .banner-btn {
display: inline-block;
margin-top: 16px;
padding: 12px 28px;
border-radius: 50px;
background: #315955;
color: #fff;
font-weight: bold;
text-decoration: none;
font-size: 1.1rem;
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
transition: all 0.3s ease;
}
.custom-video-banner .banner-btn:hover {
background: #8c6e34;
transform: translateY(-3px);
}
@media(max-width: 767px) {
.custom-video-banner { height: 300px; }
.custom-video-banner .banner-text { font-size: 1.1rem; padding: 15px; }
.custom-video-banner .banner-btn { font-size: 0.9rem; padding: 10px 20px; }
}
`;
document.head.appendChild(style);
// استبدال الصورة بالفيديو + النص
const targetBanner = document.querySelector('section.s-block.s-block--fixed-banner img[src*="M2jdnqw00L7UZVZoLQS4ETSZLWnLBkAxnsjDplBX.png"]');
if (targetBanner) {
const parentSection = targetBanner.closest("section.s-block.s-block--fixed-banner");
parentSection.innerHTML = `
استكشف أحدث الأجهزة الإلكترونية وابدأ بتجديد منزلك بأناقة وذكاء ✨
تسوق الآن
`;
}
// تأثير الظهور عند التمرير
const banner = document.querySelector(".custom-video-banner");
if (banner) {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
banner.classList.add("visible");
}
});
}, { threshold: 0.3 });
observer.observe(banner);
}
} catch (error) {
console.error("خطأ في كود البانر المخصص:", error);
}
});
document.addEventListener("DOMContentLoaded", function () {
try {
// استدعاء الخطوط
const fontLink = document.createElement("link");
fontLink.rel = "stylesheet";
fontLink.href = "https://fonts.googleapis.com/css2?family=Scheherazade+New:wght@700&display=swap";
document.head.appendChild(fontLink);
const style = document.createElement("style");
style.innerHTML = `
.coffee-hero {
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #f6f1ea 0%, #e3d5c2 50%, #d2b48c 100%);
border-radius: 20px;
padding: 60px 40px;
margin: 40px auto;
max-width: 90%;
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
gap: 40px;
opacity: 0;
transform: translateY(30px);
transition: opacity 0.8s ease, transform 0.8s ease;
}
.coffee-hero.show {
opacity: 1;
transform: translateY(0);
}
.coffee-hero-left {
flex: 1;
text-align: left;
direction: rtl;
}
.coffee-hero-left h1 {
font-family: 'Scheherazade New', serif;
font-size: 2.4rem;
color: #4b3a2f;
margin-bottom: 15px;
border-right: 3px solid #8b5e3c;
white-space: nowrap;
overflow: hidden;
width: 0;
}
.coffee-hero.show .coffee-hero-left h1 {
animation: typing 3s steps(40, end) forwards, blink 0.8s step-end infinite;
}
.coffee-hero-left p {
font-size: 1.2rem;
color: #5c4b3b;
max-width: 500px;
line-height: 1.8;
margin-bottom: 20px;
opacity: 0;
}
.coffee-hero.show .coffee-hero-left p {
animation: fadeIn 1s ease forwards;
animation-delay: 3.2s;
}
.coffee-btn {
display: inline-block;
background: #8b5e3c;
color: #fffaf5;
font-weight: bold;
padding: 14px 40px;
border-radius: 40px;
font-size: 1.2rem;
letter-spacing: 0.5px;
box-shadow: 0 6px 20px rgba(0,0,0,0.2);
transition: 0.3s ease;
opacity: 0;
}
.coffee-hero.show .coffee-btn {
animation: fadeInUp 0.8s ease forwards;
animation-delay: 4.3s;
}
.coffee-btn:hover {
background: #6b4429;
transform: translateY(-3px) scale(1.05);
box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
.coffee-hero-right {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}
.coffee-hero-right img {
width: 300px;
max-width: 90%;
animation: slowSpin 12s linear infinite;
}
/* Animations */
@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes blink { 50% { border-color: transparent; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes fadeInUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes slowSpin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@media(max-width: 900px) {
.coffee-hero {
flex-direction: column-reverse;
text-align: center;
gap: 20px;
padding: 40px 20px;
}
.coffee-hero-left h1 { font-size: 2rem; }
.coffee-hero-left p { font-size: 1rem; max-width: 100%; }
.coffee-hero-right img { width: 200px; }
}
`;
document.head.appendChild(style);
// استبدال السيكشن عند العثور على الصورة
const targetBanner = document.querySelector(
'section.s-block.s-block--fixed-banner img[src*="R0itkPax9Uipqy7Q8Qln5ja4fFlUjj0WZbgMhbPg.png"]'
);
if (targetBanner) {
const parentSection = targetBanner.closest("section.s-block.s-block--fixed-banner");
if (parentSection) {
parentSection.innerHTML = `
ابدأ يومك مع القهوة المثالية ☕
استمتع بمذاق قهوة طازجة محمصة بعناية، تمنحك بداية مليئة بالنشاط والحيوية كل صباح.
تسوق الآن
`;
// مراقبة ظهور السيكشن
const coffeeHero = parentSection.querySelector(".coffee-hero");
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
coffeeHero.classList.add("show");
observer.disconnect();
}
});
},
{ threshold: 0.5 }
);
observer.observe(coffeeHero);
}
}
} catch (error) {
console.error("خطأ في كود هيرو القهوة:", error);
}
});
document.addEventListener("DOMContentLoaded", () => {
const cards = document.querySelectorAll(".about-page .card");
cards.forEach((card, i) => {
card.style.opacity = "0";
card.style.transform = "translateY(30px)";
setTimeout(() => {
card.style.transition = "all 0.6s ease";
card.style.opacity = "1";
card.style.transform = "translateY(0)";
}, i * 200);
});
});
console.log("صفحة لعبوبة تم تحميلها ✅");
const section = document.querySelector('#app > div.app-inner.flex.flex-col.min-h-full > section.s-block.s-block--categories');
const faqData = [
{
question: "كم يستغرق توصيل الطلب ؟",
answer: "عادة ما يتم توصيل الطلب خلال 7-14 يوم اعمل"
},
{
question: "هل يمكن ارجاع المنتج في حالة لم يعجبني؟",
answer: "نعم ندعم في متجرنا سياسة الاسترجاع بشرط أن لا تتجاوز المدة 10 أيام من استلام المنتج"
},
{
question: "هل منتجاتكم أصلية؟",
answer: "أكيد نحن نفخر بأن منتجاتنا أصلية وذات جودة عالية"
}
];
// هنشيك قبل ما يدخل علي الكود اذا موجود او لا ( عشان ال performance )
if (section) {
// هنا بنمسح كل الي مكتوب في السكشن (عشان احنا مش عاوزين الي جوا عاوزين بس الdiv الي فيها ال section نكتب فيها )
section.innerHTML = '';
let questionsHTML = faqData.map(({ question, answer }) => `
`).join('');
section.innerHTML = `
`;
const script = document.createElement('script');
script.textContent = `
document.querySelectorAll('.question-item .question').forEach(question => {
question.addEventListener('click', function() {
const answer = this.nextElementSibling;
const isVisible = answer.style.display === 'block';
document.querySelectorAll('.answer').forEach(a => a.style.display = 'none');
answer.style.display = isVisible ? 'none' : 'block';
});
});
`;
section.appendChild(script);
} else {
console.warn('العنصر المطلوب غير موجود في الصفحة.');
}
document.addEventListener("DOMContentLoaded", function () {
const images = document.querySelectorAll(".banner--fixed img");
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("show");
}
});
}, { threshold: 0.2 });
images.forEach(img => observer.observe(img));
});
document.addEventListener("DOMContentLoaded", () => {
const bannerImages = document.querySelectorAll(".banner--fixed img");
const bannerObserver = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("visible");
observer.unobserve(entry.target);
}
});
}, { threshold: 0.1 });
bannerImages.forEach(image => bannerObserver.observe(image));
document.addEventListener("scroll", () => {
const sliders = document.querySelectorAll(".s-slider-container");
sliders.forEach((slider) => {
const rect = slider.getBoundingClientRect();
const isInViewport = rect.top < window.innerHeight && rect.bottom >= 0;
if (isInViewport) {
slider.classList.add("show");
}
});
});
document.addEventListener("DOMContentLoaded", function () {
const images = document.querySelectorAll(".banner--fixed img");
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("show");
}
});
}, { threshold: 0.2 });
images.forEach(img => observer.observe(img));
});
const menuButton = document.createElement('button');
menuButton.classList.add('menu-button');
const smallLogo = document.createElement('img');
smallLogo.classList.add('menu-button-logo');
smallLogo.src = 'https://i.ibb.co/KjJfYj3g/LOGO-PNG-DEVOLOP-copy.png';
smallLogo.alt = 'Logo';
const buttonText = document.createElement('span');
buttonText.innerText = 'القائمة الرئيسية';
menuButton.appendChild(smallLogo);
menuButton.appendChild(buttonText);
document.body.appendChild(menuButton);
const overlayMenu = document.createElement('div');
overlayMenu.classList.add('overlay-menu');
overlayMenu.innerHTML = `
`;
document.body.appendChild(overlayMenu);
menuButton.addEventListener('click', function () {
overlayMenu.classList.toggle('active');
});
menuButton.style.position = 'fixed';
menuButton.style.top = '0px';
menuButton.style.left = '0';
menuButton.style.width = '100%';
menuButton.style.zIndex = '1000';
const backToTopButton = document.createElement("div");
backToTopButton.id = "backToTop";
backToTopButton.innerHTML = `
`;
document.body.appendChild(backToTopButton);
const style = `
#backToTop {
position: fixed;
bottom: 20%;
right: 20px;
width: 60px;
height: 60px;
display: none;
z-index: 1000;
}
#backToTop .icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
color: var(--main-color);
}
.circular-chart {
width: 100%;
height: 100%;
transform: rotate(-90deg);
}
.circle-bg {
fill: none;
stroke: var(--third-color);
stroke-width: 3.8;
}
.circle {
fill: none;
stroke: var(--main-color);
stroke-width: 3.8;
stroke-dasharray: 100, 100;
stroke-linecap: round;
transition: stroke-dasharray 0.1s linear;
}
#backToTop:hover .icon {
color: var(--second-color);
}
`;
const styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.textContent = style;
document.head.appendChild(styleSheet);
window.addEventListener("scroll", () => {
const scrollTop = window.scrollY;
const docHeight = document.documentElement.scrollHeight - window.innerHeight;
const scrollPercent = (scrollTop / docHeight) * 100;
if (scrollPercent > 1) {
backToTopButton.style.display = "block";
} else {
backToTopButton.style.display = "none";
}
const circle = document.querySelector(".circle");
const offset = 100 - scrollPercent;
circle.style.strokeDasharray = `${scrollPercent}, 100`;
});
backToTopButton.addEventListener("click", () => {
window.scrollTo({
top: 0,
behavior: "smooth",
});
});
});
window.addEventListener('scroll', function () {
const currentScroll = window.pageYOffset || document.documentElement.scrollTop;
if (currentScroll > lastScrollTop) {
menuButton.style.top = '65px';
} else {
menuButton.style.top = '0px';
}
lastScrollTop = currentScroll <= 0 ? 0 : currentScroll;
});
document.addEventListener("DOMContentLoaded", function () {
if (!sessionStorage.getItem("welcomeShown")) {
const overlay = document.createElement("div");
overlay.innerHTML = `
`;
document.body.appendChild(overlay);
const style = document.createElement("style");
style.innerHTML = `
.welcome-popup {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255, 255, 255, 0.97);
color: #000;
font-size: 1.2rem;
text-align: center;
padding: 35px 50px;
border-radius: 22px;
box-shadow: 0 8px 30px rgba(0,0,0,0.3);
z-index: 99999;
animation: fadeOut 1s ease forwards;
animation-delay: 2.5s;
max-width: 400px;
}
.welcome-popup h1 {
font-size: 2rem;
margin: 10px 0;
color: #A6823F;
font-weight: bold;
}
.welcome-popup p {
font-size: 1rem;
margin: 5px 0;
line-height: 1.6;
}
.welcome-popup .welcome-sub {
font-size: 0.95rem;
color: #555;
}
.welcome-logo {
display: block;
margin: 0 auto 15px auto;
max-width: 90px;
}
@keyframes fadeOut {
to { opacity: 0; visibility: hidden; }
}
@media (max-width: 768px) {
.welcome-popup {
max-width: 90%;
padding: 20px;
font-size: 1rem;
}
.welcome-popup h1 {
font-size: 1.5rem;
}
.welcome-popup p {
font-size: 0.9rem;
}
.welcome-logo {
max-width: 70px;
margin-bottom: 10px;
}
}
`;
document.head.appendChild(style);
setTimeout(() => {
overlay.style.display = "none";
}, 3500);
sessionStorage.setItem("welcomeShown", "true");
}
});
document.addEventListener("DOMContentLoaded", function () {
const style = document.createElement("style");
style.innerHTML = `
.custom-footer {
position:relative;
width:100%;
height:500px;
overflow:hidden;
color:#fff;
background:#f4e9da;
display:flex;
align-items:center;
justify-content:center;
}
.custom-footer video {
position:absolute;
top:50%; left:50%;
width:100%; height:100%;
object-fit:cover;
z-index:0;
transform:translate(-50%,-50%);
}
.custom-footer .overlay {
position:absolute;
top:0; left:0;
width:100%; height:100%;
background:rgba(0,0,0,0.4);
z-index:1;
}
.footer-content {
position:relative;
z-index:2;
display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
padding:30px 15px;
text-align:center;
gap:18px;
height:100%;
}
.footer-logo {
max-height:90px;
width:10rem;
margin-bottom:15px;
opacity:0;
transform:translateY(-20px);
animation: logoAppear 1.2s ease forwards;
}
@keyframes logoAppear {
from {opacity:0; transform:translateY(-30px) scale(0.9);}
to {opacity:1; transform:translateY(0) scale(1);}
}
.footer-links a {
color:#fff;
font-size:15px;
text-decoration:none;
background:rgba(255,255,255,0.15);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
padding:12px 16px;
border-radius:12px;
transition:all 0.3s ease;
font-weight:bold;
margin:8px 0;
display:block;
}
.footer-links a:hover {
background:rgba(255,255,255,0.3);
color:#ffd700;
transform:scale(1.05);
box-shadow:0 0 15px rgba(255,215,0,0.6);
}
.footer-links a:active {
transform:scale(0.95);
box-shadow:0 0 8px rgba(255,215,0,0.8);
}
.footer-copy {
font-size:13px;
margin-top:10px;
opacity:0.9;
}
.footer-advaz {
font-size:14px;
font-weight:bold;
margin-top:8px;
color:#fff;
text-shadow:0 0 10px rgba(255,215,0,0.8);
}
@media (max-width:767px){
.footer-logo { max-height:90px; }
.footer-links {
display:flex;
flex-direction:column;
gap:12px;
width:100%;
}
.footer-links a {
width:100%;
}
.custom-footer video {
object-fit:cover;
}
}
@media (min-width:768px){
.footer-links {
display:flex;
flex-direction:column;
align-items:center;
width:100%;
}
.footer-links a {
width:100%;
}
.custom-footer {
position:relative;
width:100%;
height:600px;
overflow:hidden;
color:#fff;
background:#f4e9da;
display:flex;
align-items:center;
justify-content:center;
}
}
`;
document.head.appendChild(style);
const footerHTML = `
`;
const oldFooter = document.querySelector("footer.store-footer");
if (oldFooter) oldFooter.remove();
document.body.insertAdjacentHTML("beforeend", footerHTML);
});