From ddd07fdbba8985d968b1c2d495500a8c1d4607a9 Mon Sep 17 00:00:00 2001 From: n-randin <52823116+n-randin@users.noreply.github.com> Date: Thu, 8 Aug 2019 07:03:45 +0300 Subject: [PATCH] fixed nativeroll's player collapse & resize bug (#23656) * fixed nativeroll's player collapse bug * window from global * use global & adding requestResize on content load * use global & adding requestResize on content load * /*ok*/ to the offsetHeight * pass global as param --- ads/nativeroll.js | 13 +++++++++++-- examples/ads.amp.html | 7 ++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ads/nativeroll.js b/ads/nativeroll.js index d4cfde308fa4..9ab41d6c4dbc 100644 --- a/ads/nativeroll.js +++ b/ads/nativeroll.js @@ -26,19 +26,28 @@ export function nativeroll(global, data) { global, 'https://cdn01.nativeroll.tv/js/seedr-player.min.js', () => { - initPlayer(data); + initPlayer(global, data); } ); } /** + * @param {!Window} global * @param {!Object} data */ -function initPlayer(data) { +function initPlayer(global, data) { const config = { container: '#c', desiredOffset: 50, gid: data.gid, + onError: () => { + global.context.noContentAvailable(); + }, + onLoad: () => { + const height = global.document.getElementsByClassName('nr-player')[0] + ./* OK */ offsetHeight; + global.context.requestResize(undefined, height); + }, }; // eslint-disable-next-line no-undef SeedrPlayer(config); diff --git a/examples/ads.amp.html b/examples/ads.amp.html index c66d66493a7d..5badea1abd16 100644 --- a/examples/ads.amp.html +++ b/examples/ads.amp.html @@ -276,9 +276,9 @@ - +