Skip to content

Commit

Permalink
✨ add new configuration for grx (#39649)
Browse files Browse the repository at this point in the history
* add new configuration for grx

* fix: previous errors
  • Loading branch information
nikolaospanagopoulos authored Dec 21, 2023
1 parent fc1a20a commit 0425729
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 8 deletions.
25 changes: 17 additions & 8 deletions ads/vendors/adman.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ import {validateData} from '#3p/3p';
* @param {!Object} data
*/
export function adman(global, data) {
validateData(data, ['ws', 'host', 's'], []);

validateData(data, ['ws', 'host'], []);
const {host, s, ws} = data;
const script = global.document.createElement('script');
script.setAttribute('data-ws', data.ws);
script.setAttribute('data-h', data.host);
script.setAttribute('data-s', data.s);
script.setAttribute('data-tech', 'amp');

script.src = 'https://static.adman.gr/adman.js';

global.document.body.appendChild(script);

if (host.match(/grxchange/)) {
script.onload = function () {
window.Adman.adunit({
id: ws,
h: 'https://' + host,
elementId: 'c',
});
};
return;
}
script.setAttribute('data-ws', ws);
script.setAttribute('data-h', host);
script.setAttribute('data-s', s);
script.setAttribute('data-tech', 'amp');
}
107 changes: 107 additions & 0 deletions examples/adman.amp.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sample document</title>
<link rel="canonical" href="./regular-html-version.html" />
<meta
name="viewport"
content="width=device-width,minimum-scale=1,initial-scale=1"
/>
<style amp-custom>
h1 {
color: red;
}
</style>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "Article headline",
"image": ["thumbnail1.jpg"],
"datePublished": "2015-02-05T08:00:00+08:00"
}
</script>
<script
async
custom-element="amp-carousel"
src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"
></script>
<script
async
custom-element="amp-ad"
src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"
></script>
<style amp-boilerplate>
body {
-webkit-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
-moz-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
-ms-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
animation: -amp-start 8s steps(1, end) 0s 1 normal both;
}
@-webkit-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@-moz-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@-ms-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@-o-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
</style>
<noscript
><style amp-boilerplate>
body {
-webkit-animation: none;
-moz-animation: none;
-ms-animation: none;
animation: none;
}
</style></noscript
>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<h1>Sample document</h1>
<p>Some text</p>
<amp-ad
width="300"
height="250"
type="adman"
data-ws="802"
data-host="staging.grxchange.gr"
>
</amp-ad>
</body>
</html>

0 comments on commit 0425729

Please sign in to comment.