-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.html
More file actions
149 lines (139 loc) · 6.09 KB
/
Copy pathplayer.html
File metadata and controls
149 lines (139 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Player</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body class="player-page">
<script>
(function () {
const block = () => {
try {
Object.defineProperty(window, 'location', {
configurable: false,
writable: false
});
} catch (e) {}
};
block();
})();
</script>
<div class="player-shell">
<iframe id="playerFrame" src="about:blank" frameborder="0" allowfullscreen allow="autoplay; fullscreen" ></iframe>
</div>
<div class="player-info" id="playerInfo" aria-live="polite" hidden>
<h1 id="playerTitle">Loading…</h1>
<p id="playerOverview"></p>
<p style="margin-top:8px;font-size:13px;color:var(--muted)">Link: <a id="playerLink" href="#" target="_blank" rel="noopener noreferrer">-</a></p>
</div>
<div class="player-footer">Press Back to return • This product uses the OMDb API but is not endorsed or certified by OMDb. <a id="playerFooterLink" href="#" target="_blank" rel="noopener noreferrer" style="color:var(--muted);font-size:13px;word-break:break-all;margin-left:8px">-</a></div>
<script>(function () {
const originalOpen = window.open;
window.open = function () {
console.warn('Popup blocked:', arguments);
return null;
};
})();
</script>
<script src="js/tmdb.js"></script>
<script src="js/anti-ads.js"></script>
<script>
// Parse query parameters: ?type=movie&id=123 or ?movie/123 (slash-separated)
let type = '';
let id = '';
let season = '1';
let episode = '1';
// Try query parameter format first (?type=movie&id=123)
const params = new URLSearchParams(location.search);
if (params.has('type') && params.has('id')) {
type = params.get('type') || '';
id = params.get('id') || '';
season = params.get('season') || '1';
episode = params.get('episode') || '1';
} else {
// Fall back to slash-separated format (?movie/123 or #movie/123)
let raw = location.search || '';
if (raw.startsWith('?')) raw = raw.slice(1);
if (!raw && location.hash && location.hash.startsWith('#')) raw = location.hash.slice(1);
const parts = raw.split('/').filter(Boolean);
type = parts[0] || '';
id = parts[1] || '';
season = parts[2] || '1';
episode = parts[3] || '1';
}
const frame = document.getElementById('playerFrame');
if (typeof blockPlayerAds === 'function') {
blockPlayerAds(frame, { allowedHosts: ['vidking.net','www.vidking.net'], allowSameOrigin: false });
}
const infoEl = document.getElementById('playerInfo');
const titleEl = document.getElementById('playerTitle');
const overviewEl = document.getElementById('playerOverview');
// Helper to show info overlay
function showInfo(title, overview) {
if (!title && !overview) return;
titleEl.textContent = title || '';
overviewEl.textContent = overview || '';
infoEl.hidden = false;
}
// Load details from OMDb and set up embed
async function loadPlayerDetails() {
try {
if (type === 'tv' && id && TMDB.getEpisode) {
// Fetch TV episode details
const ep = await TMDB.getEpisode(id, season, episode);
if (ep) {
showInfo(ep.title || `Season ${ep.season} Episode ${ep.episode}`, ep.overview || '');
document.title = ep.title || document.title;
}
// Build TV embed URL: /embed/tv/id/season/episode
frame.src = `https://www.vidking.net/embed/tv/${encodeURIComponent(id)}/${encodeURIComponent(season)}/${encodeURIComponent(episode)}?color=e50914&autoPlay=true&nextEpisode=true&episodeSelector=true`;
// show full link (overlay + footer)
frame.sandbox='';
frame.style.pointerEvents = 'none';
const linkEl = document.getElementById('playerLink');
const footerEl = document.getElementById('playerFooterLink');
if (linkEl) { linkEl.href = frame.src; linkEl.textContent = frame.src; }
if (footerEl) { footerEl.href = frame.src; footerEl.textContent = frame.src; }
} else if (type === 'movie' && id && TMDB.getById) {
// Fetch movie details
const movie = await TMDB.getById(id);
if (movie) {
showInfo(movie.title || movie.name || '', movie.overview || '');
document.title = movie.title || movie.name || document.title;
}
// Build movie embed URL: /embed/movie/id
frame.src = `https://www.vidking.net/embed/movie/${encodeURIComponent(id)}?color=e50914&autoPlay=true&nextEpisode=true&episodeSelector=true`;
// show full link (overlay + footer)
frame.sandbox='';
frame.style.pointerEvents = 'none';
const linkEl = document.getElementById('playerLink');
const footerEl = document.getElementById('playerFooterLink');
if (linkEl) { linkEl.href = frame.src; linkEl.textContent = frame.src; }
if (footerEl) { footerEl.href = frame.src; footerEl.textContent = frame.src; }
// For movies, focus the iframe when it loads; do NOT request fullscreen programmatically
frame.addEventListener('load', () => {
try { frame.contentWindow && frame.contentWindow.focus(); } catch (e) {}
}, { once: true });
}
} catch (err) {
console.warn('Failed to load details:', err);
}
}
// Handle Back/Escape keys
window.addEventListener('keydown', async (e) => {
if (e.key === 'Backspace' || e.key === 'Escape') {
if (document.fullscreenElement) {
const exit = document.exitFullscreen || document.webkitExitFullscreen || document.mozCancelFullScreen || document.msExitFullscreen;
if (exit) await exit.call(document).catch(() => {});
} else {
history.back();
}
}
});
// Initialize
loadPlayerDetails();
</script>
</body>
</html>