tv / index.html
eslammsd's picture
Update index.html
5a35366 verified
Raw History Blame Contribute Delete
15.2 kB
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>Family TV — Smart Adaptive IPTV</title>
<!-- الإعلان الثاني في رأس الصفحة -->
<script>
(function(osk){
var d = document,
s = d.createElement('script'),
l = d.currentScript || d.scripts[d.scripts.length - 1];
s.settings = osk || {};
s.src = "\/\/quarrelsomebitter.com\/bJXiV.szdGGtlP0dY\/WHcn\/Necmd9tu\/ZoUUlVkMPCT-cR1aNHDwccwNMkzHcwtbN\/zvUr0/NozKAL0qMoQR";
s.async = true;
s.referrerPolicy = 'no-referrer-when-downgrade';
l.parentNode.insertBefore(s, l);
})({})
</script>
<style>
.post-body, .entry-content, .post, .post-outer {
padding: 0 !important; margin: 0 !important; border: none !important;
background: transparent !important; max-width: 100% !important;
}
* { box-sizing: border-box; }
body { margin: 0; background: #0b0d10; color: #fff; font-family: Cairo, 'Segoe UI', sans-serif; }
#iptv-app { max-width: 980px; margin: 8px auto; padding: 14px; background: #13161c; border-radius: 18px; border: 1px solid #232730; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.header { text-align: center; padding: 10px 0 14px; border-bottom: 1px solid #222631; margin-bottom: 12px; }
.header h2 { margin: 0; color: #f1b931; font-size: 22px; }
.header p { margin: 4px 0 0; color: #8a909a; font-size: 12px; }
.sources { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.sources::-webkit-scrollbar { display: none; }
.source-btn { white-space: nowrap; border: 1px solid #232730; background: #1a1e26; color: #ccc; border-radius: 20px; padding: 8px 16px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
.source-btn.active { background: #f1b931; color: #000; border-color: #f1b931; font-weight: bold; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.player-section { display: flex; flex-direction: column; gap: 10px; }
.player-container { background: #000; border: 1px solid #232730; border-radius: 14px; overflow: hidden; position: relative; width: 100%; aspect-ratio: 16/9; min-height: 250px; }
video { display: block; width: 100%; height: 100%; background: #000; }
.now { padding: 10px; text-align: center; background: #181c24; border-top: 1px solid #232730; }
.now strong { display: block; color: #f1b931; font-size: 13px; }
.now small { color: #8a909a; font-size: 11px; }
.server-controls { display: flex; gap: 8px; justify-content: center; background: #181c24; padding: 8px; border: 1px solid #232730; border-radius: 10px; }
.server-btn { background: #222732; border: 1px solid #2f3542; color: #e2e8f0; font-size: 11px; padding: 6px 12px; border-radius: 6px; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.server-btn:hover { border-color: #f1b931; color: #f1b931; }
/* صندوق الإعلان الأول (Banner) أسفل أزرار السيرفرات بعيداً عن القنوات */
.main-banner-ad { background: #181c24; border: 1px solid #232730; border-radius: 10px; padding: 10px; text-align: center; }
.list-box { background: #181c24; border: 1px solid #232730; border-radius: 14px; display: flex; flex-direction: column; height: 560px; overflow: hidden; }
.tools { padding: 10px; border-bottom: 1px solid #232730; }
input, select { width: 100%; background: #0e1014; color: #fff; border: 1px solid #232730; border-radius: 9px; padding: 9px; outline: none; font-size: 12px; }
select { margin-top: 6px; }
.list { overflow-y: auto; flex: 1; }
.channel { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #222631; cursor: pointer; }
.channel:hover { background: #212630; }
.channel-main { min-width: 0; flex: 1; }
.channel-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-cat { color: #8a909a; font-size: 10px; margin-top: 3px; }
.fav { width: 28px; border: 0; background: none; color: #8a909a; font-size: 16px; cursor: pointer; }
.fav.on { color: #f1b931; }
.status { padding: 20px; text-align: center; color: #8a909a; font-size: 12px; }
.count { font-size: 11px; color: #8a909a; padding: 8px 12px; border-bottom: 1px solid #232730; }
@media(max-width:760px){
#iptv-app { margin: 0; border-radius: 0; border: none; min-height: 100vh; }
.layout { grid-template-columns: 1fr; }
.list-box { height: 440px; }
}
</style>
</head>
<body>
<div id="iptv-app">
<div class="header">
<h2>📺 Family TV — IPTV World Premium</h2>
<p>البث المباشر للقنوات العالمية والرياضية بأعلى جودة</p>
</div>
<div class="sources" id="sources">
<button class="source-btn active" data-url="https://iptv-org.github.io/iptv/categories/general.m3u">عام</button>
<button class="source-btn" data-url="https://iptv-org.github.io/iptv/categories/entertainment.m3u">ترفيه</button>
<button class="source-btn" data-url="https://iptv-org.github.io/iptv/categories/movies.m3u">أفلام</button>
<button class="source-btn" data-url="https://iptv-org.github.io/iptv/categories/sports.m3u">رياضة</button>
<button class="source-btn" data-url="https://iptv-org.github.io/iptv/categories/news.m3u">أخبار</button>
<button class="source-btn" data-url="https://iptv-org.github.io/iptv/categories/kids.m3u">أطفال</button>
<button class="source-btn" data-url="favorites">⭐ المفضلة</button>
</div>
<div class="layout">
<div class="player-section">
<div class="player-container" id="player-box">
<video id="main-video" controls playsinline></video>
<div class="now" id="current-channel-info">
<strong>اختر قناة للبدء</strong>
<small>اضغط على أي قناة من القائمة المجاورة</small>
</div>
</div>
<div class="server-controls">
<a href="https://asiafilm.org/4/d0e355a77df4d0f9a5ae1e03257d6ab9" target="_blank" class="server-btn">⚡ سيرفر HD رئيسي</a>
<a href="https://asiafilm.org/4/d0e355a77df4d0f9a5ae1e03257d6ab9" target="_blank" class="server-btn">🚀 سيرفر احتياطي (Fast)</a>
<a href="https://asiafilm.org/4/d0e355a77df4d0f9a5ae1e03257d6ab9" target="_blank" class="server-btn">🔊 تفعيل الصوت والجودة</a>
</div>
<!-- إعلان البنر الثابت أسفل المشغل بعيداً عن القنوات -->
<div class="main-banner-ad">
<script async="async" data-cfasync="false" src="https://dcengg.org/21/8bf844c67c7efa09f8e79bd1dce1fbc7"></script>
<div id="container-8bf844c67c7efa09f8e79bd1dce1fbc7"></div>
</div>
</div>
<!-- قائمة القنوات أصبحت نظيفة وبالكامل مخصصة للقنوات فقط -->
<div class="list-box">
<div class="tools">
<input id="search-channels" placeholder="🔎 ابحث عن قناة..." oninput="applyFilters()">
<select id="category-select" onchange="applyFilters()">
<option value="all">كل الأقسام</option>
</select>
</div>
<div class="count" id="count">جاري التجهيز...</div>
<div class="list" id="channels-list">
<div class="status">جاري جلب القنوات...</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script>
let allChannels = [];
let favorites = JSON.parse(localStorage.getItem('iptv_favs') || '[]');
let currentChannel = null;
let hlsInstance = null;
const fallbackChannels = [
{ name: "العربية الحدث (بث مباشر)", category: "أخبار", url: "https://live.alarabiya.net/alarabiya/aldashat.m3u8" },
{ name: "الجزيرة الإخبارية", category: "أخبار", url: "https://live-hls-web-aje.getaj.net/AJE/03.m3u8" },
{ name: "فرانس 24 عربي", category: "أخبار", url: "https://f24hls.live.cf.ww.aiv-cdn.net/hls/live/2016335/f24ar_hls/master.m3u8" },
{ name: "سكاي نيوز عربية", category: "أخبار", url: "https://skynewsarabia.live.hls.adaptive.level3.net/skynewsarabia/index.m3u8" }
];
// عند تحميل الصفحة، نتحقق هل عاد المستخدم من صفحة الإعلانات لاستئناف تشغيل قناته
window.addEventListener('DOMContentLoaded', () => {
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('resume') === '1') {
const savedChannelJson = localStorage.getItem('pending_channel');
if (savedChannelJson) {
const ch = JSON.parse(savedChannelJson);
playChan(ch);
}
}
});
// دالة التحكم (الشرطين: مرور 30 دقيقة أو تبديل قناتين)
function handleChannelClick(ch) {
const lastAdTime = parseInt(localStorage.getItem('last_ad_time') || '0');
let switchCount = parseInt(localStorage.getItem('switch_count') || '0') + 1;
const now = Date.now();
const thirtyMinutes = 30 * 60 * 1000; // 30 دقيقة
const maxSwitchesBeforeAd = 2; // يظهر الإعلان بعد تبديل قناتين
localStorage.setItem('pending_channel', JSON.stringify(ch));
if ((now - lastAdTime > thirtyMinutes) || (switchCount >= maxSwitchesBeforeAd)) {
localStorage.setItem('switch_count', '0');
window.location.href = 'ads.html';
} else {
localStorage.setItem('switch_count', switchCount);
playChan(ch);
}
}
function playChan(ch) {
currentChannel = ch;
document.getElementById('current-channel-info').innerHTML = `<strong>▶ ${escapeHtml(ch.name)}</strong><small>${escapeHtml(ch.category)}</small>`;
const video = document.getElementById('main-video');
if (hlsInstance) {
hlsInstance.destroy();
hlsInstance = null;
}
if (window.Hls && Hls.isSupported() && /\.m3u8($|\?)/i.test(ch.url)) {
hlsInstance = new Hls({ enableWorker: true });
hlsInstance.loadSource(ch.url);
hlsInstance.attachMedia(video);
hlsInstance.on(Hls.Events.MANIFEST_PARSED, () => {
video.play().catch(()=>{});
});
} else {
video.src = ch.url;
video.play().catch(()=>{});
}
}
const sourceButtons = document.querySelectorAll('.source-btn');
sourceButtons.forEach(btn => {
btn.addEventListener('click', () => {
sourceButtons.forEach(x => x.classList.remove('active'));
btn.classList.add('active');
const url = btn.dataset.url;
if(url === 'favorites') {
selectedSource = 'favorites';
applyFilters();
} else {
selectedSource = url;
loadM3U(url);
}
});
});
async function loadM3U(url) {
const list = document.getElementById('channels-list');
list.innerHTML = '<div class="status">جاري جلب القنوات...</div>';
document.getElementById('count').textContent = 'تحميل...';
allChannels = [];
const proxies = [
url,
'https://api.allorigins.win/raw?url=' + encodeURIComponent(url),
'https://corsproxy.io/?' + encodeURIComponent(url)
];
for (let pUrl of proxies) {
try {
const response = await fetch(pUrl, {cache: 'no-store'});
if(!response.ok) continue;
const data = await response.text();
if(data && data.includes('#EXTINF')) {
parseM3U(data);
return;
}
} catch(e) {}
}
allChannels = fallbackChannels;
updateCategories(allChannels);
renderChannels(allChannels);
}
function parseM3U(content) {
const lines = content.split(/\r?\n/);
const result = [];
let current = null;
for(const raw of lines) {
const line = raw.trim();
if(!line) continue;
if(line.startsWith('#EXTINF:')) {
const comma = line.indexOf(',');
const name = comma >= 0 ? line.slice(comma+1).trim() : 'قناة';
const groupMatch = line.match(/group-title="([^"]*)"/i);
const group = groupMatch ? groupMatch[1] : 'عام';
current = {name, category: group};
} else if(current && !line.startsWith('#') && /^https?:\/\//i.test(line)) {
current.url = line;
result.push(current);
current = null;
}
}
if (result.length === 0) {
allChannels = fallbackChannels;
} else {
allChannels = result;
}
updateCategories(allChannels);
renderChannels(allChannels);
}
let selectedSource = 'https://iptv-org.github.io/iptv/categories/general.m3u';
function updateCategories(channels) {
const cats = new Set(channels.map(c => c.category));
const select = document.getElementById('category-select');
select.innerHTML = '<option value="all">كل الأقسام</option>';
[...cats].sort().forEach(cat => {
const option = document.createElement('option');
option.value = cat;
option.textContent = cat;
select.appendChild(option);
});
}
function applyFilters() {
let filtered = allChannels;
const search = document.getElementById('search-channels').value.trim().toLowerCase();
const category = document.getElementById('category-select').value;
if(selectedSource === 'favorites') {
filtered = allChannels.filter(c => favorites.includes(c.url));
} else if(category !== 'all') {
filtered = filtered.filter(c => c.category === category);
}
if(search) {
filtered = filtered.filter(c =>
c.name.toLowerCase().includes(search) ||
c.category.toLowerCase().includes(search)
);
}
renderChannels(filtered);
}
function renderChannels(channels) {
const list = document.getElementById('channels-list');
document.getElementById('count').textContent = 'عدد القنوات: ' + channels.length;
if(!channels.length) {
list.innerHTML = '<div class="status">لا توجد قنوات</div>';
return;
}
const frag = document.createDocumentFragment();
channels.forEach((ch) => {
const item = document.createElement('div');
item.className = 'channel';
const fav = document.createElement('button');
fav.className = 'fav ' + (favorites.includes(ch.url) ? 'on' : '');
fav.textContent = favorites.includes(ch.url)?'★':'☆';
fav.onclick = e => { e.stopPropagation(); toggleFav(ch.url); };
const main = document.createElement('div');
main.className = 'channel-main';
main.innerHTML = `<div class="channel-name">${escapeHtml(ch.name)}</div><div class="channel-cat">${escapeHtml(ch.category)}</div>`;
main.onclick = () => {
handleChannelClick(ch);
};
item.appendChild(fav);
item.appendChild(main);
frag.appendChild(item);
});
list.innerHTML = '';
list.appendChild(frag);
}
function toggleFav(url) {
if(favorites.includes(url)) {
favorites = favorites.filter(x => x!==url);
} else {
favorites.push(url);
}
localStorage.setItem('iptv_favs', JSON.stringify(favorites));
applyFilters();
}
let escapeHtml = (value) => String(value||'').replace(/[&<>"']/g, char => ({ '&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;','\039':'&#039;' }[char]));
loadM3U(selectedSource);
</script>
</body>
</html>