Skip to content

Commit

Permalink
fixed nativeroll's player collapse & resize bug (ampproject#23656)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
n-randin authored and lannka committed Aug 8, 2019
1 parent e137712 commit ddd07fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 11 additions & 2 deletions ads/nativeroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@
<input type="submit" value="Go">
</form>
</div>

<h2>1WO</h2>
<amp-embed
<amp-embed
width="400"
height="700"
type="1wo"
Expand All @@ -287,7 +287,7 @@ <h2>1WO</h2>
data-owo-mode="smart3"
src="https://frontend-qa.1worldonline.biz/poller-constructor.js">
</amp-embed>

<h2>24smi</h2>
<amp-embed width="250" height="250"
type="24smi"
Expand Down Expand Up @@ -1473,6 +1473,7 @@ <h2>myWidget</h2>

<h2>Nativeroll</h2>
<amp-ad width="480" height="340"
layout="responsive"
type="nativeroll"
data-gid="5d10df709762b6b31b8b461e"
>
Expand Down

0 comments on commit ddd07fd

Please sign in to comment.