الرئيسية
تسجيل الدخول
هل نسيت كلمة المرور؟
تسجيل عضوية جديدة
0
// انسخ هذا الكود كاملًا — يلصق شريط أيقونات تواصل ثابت على اليسار مع tooltip/animation (function injectLeftSocialBar(){ if (window.__leftSocialInjected) return console.log('[left-social] موجود بالفعل'); window.__leftSocialInjected = true; const html = `
`; const css = ` /* BEGIN left social bar styles (unique class names) */ .lsb-wrap { position: fixed !important; left: 12px !important; top: 50% !important; transform: translateY(-50%) !important; z-index: 2147483647 !important; pointer-events: auto !important; font-family: "Segoe UI", Tahoma, Arial, sans-serif !important; } .lsb-list { margin: 0 !important; padding: 6px !important; list-style: none !important; display: flex !important; flex-direction: column !important; gap: 12px !important; align-items: flex-start !important; } .lsb-item { position: relative !important; display: flex !important; align-items: center !important; gap: 10px !important; background: rgba(0,0,0,0.45) !important; padding: 8px !important; border-radius: 12px !important; min-width: 48px !important; height: 48px !important; box-shadow: 0 8px 22px rgba(0,0,0,0.25) !important; cursor: pointer !important; transition: transform .18s ease, background .18s ease !important; overflow: visible !important; } .lsb-item:focus { outline: none !important; box-shadow: 0 0 0 3px rgba(88, 222, 238, .18) !important; transform: translateX(0) !important; } .lsb-icon { width: 32px !important; height: 32px !important; object-fit: contain !important; display: block !important; margin-left: 4px !important; border-radius: 6px !important; background: transparent !important; } /* tooltip that slides out to the right of the bar */ .lsb-tooltip { position: absolute !important; left: 58px !important; top: 50% !important; transform: translateY(-50%) translateX(-8px) !important; background: rgba(18,18,20,0.96) !important; color: #fff !important; padding: 10px 12px !important; border-radius: 10px !important; min-width: 160px !important; max-width: 220px !important; box-shadow: 0 10px 30px rgba(2,6,23,0.6) !important; opacity: 0 !important; pointer-events: none !important; transition: opacity .18s ease, transform .22s cubic-bezier(.2,.9,.3,1) !important; transform-origin: left center !important; } .lsb-tooltip strong { display: block !important; font-size: 14px !important; line-height: 1.1 !important; margin-bottom: 4px !important; } .lsb-tooltip .lsb-sub { font-size: 12px !important; color: rgba(255,255,255,0.85) !important; } /* visible state */ .lsb-item.lsb-open { background: linear-gradient(90deg, rgba(88,222,238,0.12), rgba(244,183,146,0.03)) !important; transform: translateX(0) !important; } .lsb-item.lsb-open .lsb-tooltip { opacity: 1 !important; transform: translateY(-50%) translateX(0) !important; pointer-events: auto !important; } /* hover reveal (desktop) */ .lsb-item:hover { transform: translateX(6px) !important; background: rgba(0,0,0,0.6) !important; } .lsb-item:hover .lsb-tooltip { opacity: 1 !important; transform: translateY(-50%) translateX(0) !important; pointer-events: auto !important; } /* caret (triangle) */ .lsb-tooltip::before { content: "" !important; position: absolute !important; left: -6px !important; top: 50% !important; transform: translateY(-50%) !important; border-width: 6px !important; border-style: solid !important; border-color: transparent rgba(18,18,20,0.96) transparent transparent !important; } /* small screens: collapse to icons only; tap to toggle tooltip */ @media (max-width: 720px) { .lsb-wrap { left: 6px !important; } .lsb-item { min-width: 44px !important; padding: 6px !important; border-radius: 50% !important; justify-content: center !important; height: 44px !important; } .lsb-item .lsb-tooltip { display: block !important; left: 56px !important; min-width: 140px !important; } } /* prevent inherited transforms from hiding it inside fancy containers */ .lsb-wrap, .lsb-wrap * { transform: none !important; } /* END left social bar styles */ `; // add styles const styleId = '__lsb_styles__'; if (!document.getElementById(styleId)) { const style = document.createElement('style'); style.id = styleId; style.textContent = css; (document.head || document.documentElement).appendChild(style); } // add html const container = document.createElement('div'); container.innerHTML = html; // append to body or to top-level if body not ready const appendTarget = document.body || document.documentElement; appendTarget.appendChild(container.firstElementChild); // behavior: hover / focus / click / touch support function openItem(li) { closeAll(); li.classList.add('lsb-open'); } function closeItem(li) { li.classList.remove('lsb-open'); } function closeAll() { document.querySelectorAll('.lsb-item.lsb-open').forEach(i => i.classList.remove('lsb-open')); } // click behavior: فتح الرابط في تبويب جديد document.querySelectorAll('.lsb-item').forEach(li => { // open on click li.addEventListener('click', (e) => { const href = li.getAttribute('data-href'); if (!href) return; // لو كان المستخدم ضغط للمرة الأولى على الموبايل (tooltip toggle) ونريد فقط الفتح لو كان already open: if (li.classList.contains('lsb-open')) { window.open(href, '_blank', 'noopener'); } else { // افتح الـ tooltip كإشارة أولى openItem(li); } }); // hover/focus for desktop li.addEventListener('mouseenter', () => openItem(li)); li.addEventListener('mouseleave', () => closeItem(li)); li.addEventListener('focus', () => openItem(li)); li.addEventListener('blur', () => closeItem(li)); // keyboard: Enter يفتح الرابط فورا li.addEventListener('keydown', (ev) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); const href = li.getAttribute('data-href'); if (href) window.open(href, '_blank', 'noopener'); } }); // touch support: أول لمس يفتح Tooltip، لمس ثاني يفتح الرابط let touchTimer = null; li.addEventListener('touchstart', (ev) => { ev.stopPropagation(); if (li.classList.contains('lsb-open')) { // لو مفتوح، اذهب للرابط const href = li.getAttribute('data-href'); if (href) window.open(href, '_blank', 'noopener'); return; } openItem(li); // اغلاق تلقائي بعد 4 ثواني لو لم يتفاعل المستخدم if (touchTimer) clearTimeout(touchTimer); touchTimer = setTimeout(() => closeItem(li), 4000); }); }); // اغلاق عند النقر في أي مكان خارجي document.addEventListener('click', (e) => { if (!e.target.closest || !document.querySelector('.lsb-wrap')) return; if (!e.target.closest('.lsb-wrap')) closeAll(); }, {passive:true}); console.log('[left-social] شريط التواصل تمّ إضافته. لو تبي أغيّر اتجاهه لليمين غيّر left في CSS إلى right أو ارسل "يمين".'); })();
تصميم وبرمجة