Update html/watch.ejs

This commit is contained in:
ashley 2025-11-07 12:53:02 +01:00
parent 276d698626
commit 145cd1a694

View File

@ -2481,42 +2481,22 @@ if (/[?&]autoplay=/.test(location.search)) {
</script>
<script>
function sendStats(videoId) {
if (!videoId) return
(function addStats() {
const url = "/static/improving-poke.js"
// respect per-browser opt-out
try {
if (localStorage.getItem("poke_stats_optout") === "1") return
} catch (e) {
// if localStorage is blocked, just don't send anything
return
}
if (document.querySelector(`script[src="${url}"]`)) return
let userId
const s = document.createElement("script")
s.src = url
s.type = "text/javascript"
s.async = true
s.defer = true
try {
userId = localStorage.getItem("poke_uid")
if (!userId) {
userId = "u_" + Math.random().toString(36).slice(2) + Date.now()
localStorage.setItem("poke_uid", userId)
}
} catch (e) {
// if we can't read/write localStorage, don't send stats
return
}
const payload = { videoId, userId }
fetch("/api/stats", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
keepalive: true
}).catch(() => {})
}
sendStats(new URLSearchParams(location.search).get("v"))
s.onload = () => console.log("[Poke] improving-poke.js loaded successfully")
s.onerror = () => console.warn("[Poke] failed to load improving-poke.js")
document.head.appendChild(s)
})()
function toggleTheaterMode() {
var videoPlayerContainer = document.querySelector('.video-player-container');
if (videoPlayerContainer.classList.contains('theatermodeon')) {