Scriptlets icon indicating copy to clipboard operation
Scriptlets copied to clipboard

Improve `google-ima3` — getUserRequestContext()

Open AdamWr opened this issue 3 years ago • 0 comments

Related to - https://github.com/AdguardTeam/AdguardFilters/issues/127537

I have checked it with latest google-ima3 - https://github.com/AdguardTeam/Scriptlets/blob/master/src/redirects/google-ima3.js and it almost works fine, but the problem is that video player is not visible (it has opacity set to .001 !important).

To fix it, this part could be reverted (my bad) - https://github.com/AdguardTeam/Scriptlets/commit/40f82f7ae6e5a9064859e6249a11c760940db65c#diff-095e9fc48f08a8bbd57a536295162afb05edb56b0f7c2262e6d61a48cc4888e8R209-R212 but according to my tests it will cause problems on other websites, so it would be also necessary to change AdsManager.start function: https://github.com/AdguardTeam/Scriptlets/blob/8ebc17ae5419418ef7ac094863a45f3795421cda/src/redirects/google-ima3.js#L161-L181 to something like this:

AdsManager.start = function() {
    // eslint-disable-next-line no-restricted-syntax 
    for (const type of [
            AdEvent.Type.ALL_ADS_COMPLETED,
            AdEvent.Type.CONTENT_RESUME_REQUESTED,
        ]) {
        try {
            this._dispatch(new ima.AdEvent(type));
        } catch (e) {
            // eslint-disable-next-line no-console 
            console.error(e);
        }
    }
};

and if I'm not wrong it should fixes this issue and works correctly on other websites which I checked in this issue - https://github.com/AdguardTeam/Scriptlets/issues/217

AdamWr avatar Aug 19 '22 07:08 AdamWr