Changeset View
Changeset View
Standalone View
Standalone View
extension/content-script.js
Show First 20 Lines • Show All 486 Lines • ▼ Show 20 Line(s) | 482 | mutation.removedNodes.forEach(function (node) { | |||
---|---|---|---|---|---|
487 | // Check whether the node itself or any of its children is the current player | 487 | // Check whether the node itself or any of its children is the current player | ||
488 | var players = Array.from(node.querySelectorAll("video,audio")); | 488 | var players = Array.from(node.querySelectorAll("video,audio")); | ||
489 | if (node.matches("video,audio")) { | 489 | if (node.matches("video,audio")) { | ||
490 | players.unshift(node); | 490 | players.unshift(node); | ||
491 | } | 491 | } | ||
492 | 492 | | |||
493 | players.forEach(function (player) { | 493 | players.forEach(function (player) { | ||
494 | if (player == activePlayer) { | 494 | if (player == activePlayer) { | ||
495 | // If the player is still in the visible DOM, don't consider it gone | ||||
496 | if (document.body.contains(player)) { | ||||
497 | return; // continue | ||||
498 | } | ||||
499 | | ||||
495 | sendPlayerGone(); | 500 | sendPlayerGone(); | ||
496 | return; | 501 | return; | ||
497 | } | 502 | } | ||
498 | }); | 503 | }); | ||
499 | }); | 504 | }); | ||
500 | }); | 505 | }); | ||
501 | }); | 506 | }); | ||
502 | 507 | | |||
▲ Show 20 Lines • Show All 193 Lines • Show Last 20 Lines |