Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Engadget workaround from google-ima shim #36

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions surrogates/google-ima.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ if (!window.google || !window.google.ima || !window.google.ima.VERSION) {
}
}

// eslint-disable-next-line no-unused-vars
class Ad {
constructor() {
this._pi = new AdPodInfo();
Expand Down Expand Up @@ -650,22 +651,9 @@ if (!window.google || !window.google.ima || !window.google.ima.VERSION) {
AdError.ErrorCode = {};
AdError.Type = {};

const isEngadget = () => {
try {
for (const ctx of Object.values(window.vidible._getContexts())) {
const player = ctx.getPlayer();
if (!player) { continue; }
const div = player.div;
if (!div) { continue; }
if (div.innerHTML.includes("www.engadget.com")) {
return true;
}
}
} catch (_) {}
return false;
};

const currentAd = isEngadget() ? undefined : new Ad();
// TODO: Consider setting this to `new Ad()` when AdEvent.Type.LOADED fires
// and clearing it again after AdEvent.Type.ALL_ADS_COMPLETED fires.
const currentAd = null;

class AdEvent {
constructor(type) {
Expand Down
Loading