Update html/watch.ejs
This commit is contained in:
parent
5bc604c420
commit
4bbe3f3161
@ -2431,10 +2431,25 @@ if (/[?&]autoplay=/.test(location.search)) {
|
||||
function sendStats(videoId) {
|
||||
if (!videoId) return
|
||||
|
||||
let userId = localStorage.getItem("poke_uid")
|
||||
if (!userId) {
|
||||
userId = "u_" + Math.random().toString(36).slice(2) + Date.now()
|
||||
localStorage.setItem("poke_uid", userId)
|
||||
// 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
|
||||
}
|
||||
|
||||
let userId
|
||||
|
||||
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 }
|
||||
@ -2447,7 +2462,6 @@ function sendStats(videoId) {
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
sendStats(new URLSearchParams(location.search).get("v"))
|
||||
|
||||
function toggleTheaterMode() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user