powered-ad-config 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # powered-ad-config
2
+ npm package for dynamic powered ad config
3
+
4
+ # instructions
5
+ 1. add `<header class="masthead"></header>`
6
+
7
+ # example
8
+ ```javascript
9
+ import poweredAdConfig from 'powered-ad-config'
10
+
11
+ //setup ad integration on Nine
12
+ if (window.frameElement) {
13
+ poweredAdConfig('fireplace');
14
+ }
15
+
16
+ ```
@@ -0,0 +1,160 @@
1
+ const L = (d) => {
2
+ const u = window.frameElement ? window.frameElement : null, r = {
3
+ siteBackgroundColor: "#ffffff",
4
+ fireplaceLeftMargin: 0,
5
+ adNodeMarginTop: -24,
6
+ adNodeMarginBottom: 0,
7
+ responsiveScroll: -124,
8
+ xPosHalfpage: function() {
9
+ return 695;
10
+ },
11
+ yPosHalfpage: function() {
12
+ return 72;
13
+ },
14
+ stickyMargin: { offset: 72, isSticky: !0 },
15
+ zIndex: function() {
16
+ var i, o, n, s, a, l, c, w, m, v, S;
17
+ const t = window.parent.document, e = (x, q) => x.forEach((A) => q.forEach(([k, H]) => A.style[k] = H));
18
+ (i = t.querySelector(".nk-demographics")) == null || i.setAttribute("style", "max-width:1190px;left:50%;transform:translate(-50%,0);"), (o = t.querySelector(".nk-footer")) == null || o.setAttribute("style", "position:relative;max-width:1190px;left:50%;transform:translate(-50%,0);"), (n = t.querySelector("article")) == null || n.setAttribute("style", "position:relative"), (s = t.querySelector("#article")) == null || s.setAttribute("style", "position:relative"), (a = t.querySelector("#VideoIndex")) == null || a.setAttribute("style", "position:relative"), (l = t.querySelector("#Index")) == null || l.setAttribute("style", "position:relative"), (c = t.querySelector(".show")) == null || c.setAttribute("style", "position:relative"), (w = t.querySelector("#adspot-desktop-banner-7-below")) == null || w.setAttribute("style", "position:relative"), e(t.querySelectorAll(".column"), [["position", "relative"]]), e(t.querySelectorAll(".advert"), [["position", "relative"]]), e(t.querySelectorAll("blockquote"), [["zIndex", "1"]]), (m = t.querySelector('div[class*="article__MyContainer"]')) == null || m.setAttribute("style", "max-width:1190px;margin-top:-24px"), (v = t.querySelector('div[type="BANNER"]')) == null || v.setAttribute("style", "display:none"), (S = t.querySelector('div[type="MBANNER"]')) == null || S.setAttribute("style", "display:none");
19
+ }
20
+ }, p = {
21
+ siteBackgroundColor: "#ffffff",
22
+ fireplaceLeftMargin: 0,
23
+ adNodeMarginTop: -24,
24
+ adNodeMarginBottom: 0,
25
+ responsiveScroll: -124,
26
+ xPosHalfpage: function() {
27
+ return 695;
28
+ },
29
+ yPosHalfpage: function() {
30
+ return 32;
31
+ },
32
+ stickyMargin: { offset: 32, isSticky: !0 },
33
+ zIndex: function() {
34
+ var i, o, n, s, a, l, c, w, m, v;
35
+ const t = window.parent.document, e = (S, x) => S.forEach((q) => x.forEach(([A, k]) => q.style[A] = k));
36
+ (i = t.querySelector(".nk-demographics")) == null || i.setAttribute("style", "max-width:1190px;left:50%;transform:translate(-50%,0);"), (o = t.querySelector(".nk-footer")) == null || o.setAttribute("style", "position:relative;max-width:1190px;left:50%;transform:translate(-50%,0);"), (n = t.querySelector("article")) == null || n.setAttribute("style", "position:relative"), (s = t.querySelector("#article")) == null || s.setAttribute("style", "position:relative"), (a = t.querySelector("#VideoIndex")) == null || a.setAttribute("style", "position:relative"), (l = t.querySelector("#Index")) == null || l.setAttribute("style", "position:relative"), (c = t.querySelector(".show")) == null || c.setAttribute("style", "position:relative"), e(t.querySelectorAll(".column"), [["position", "relative"]]), e(t.querySelectorAll(".advert"), [["position", "relative"]]), e(t.querySelectorAll("blockquote"), [["zIndex", "1"]]), (w = t.querySelector('div[class^="component__StrapContainer"]')) == null || w.setAttribute("style", "position:relative"), (m = t.querySelector('section[class^="WatchNow__Container"]')) == null || m.setAttribute("style", "margin-left:calc(50% - 49vw);margin-right:calc(50% - 49vw + 10px);"), (v = t.querySelector('div[class*="ArticleContainer"]')) == null || v.setAttribute("style", "max-width:1190px;margin-top:0px");
37
+ }
38
+ }, y = {
39
+ siteBackgroundColor: "#ffffff",
40
+ fireplaceLeftMargin: 0,
41
+ adNodeMarginTop: -24,
42
+ adNodeMarginBottom: -10,
43
+ responsiveScroll: -120,
44
+ xPosHalfpage: 722,
45
+ yPosHalfpage: 32,
46
+ stickyMargin: { offset: 8, isSticky: !0 },
47
+ zIndex: function() {
48
+ var i, o, n, s, a, l;
49
+ const t = window.parent.document;
50
+ if ((i = t.querySelector('section[data-section="marketing-banner"]')) == null || i.setAttribute("style", "position:relative"), (n = (o = t.querySelector('div[data-testid="live-tv"]')) == null ? void 0 : o.parentNode) == null || n.setAttribute("style", "position:relative"), (a = (s = t.querySelector('div[data-contentunit-id="stan"]')) == null ? void 0 : s.parentNode) == null || a.setAttribute("style", "position:relative"), (l = t.querySelector("small")) == null || l.setAttribute("style", "position:inherit"), t.querySelector('div[id*="tablet"][id*="takeover"]')) {
51
+ let c = t.createElement("style");
52
+ c.innerHTML = `
53
+ div:has(#adspot-tablet-takeover-2-above) {
54
+ position: static;
55
+ }
56
+ `, t.head.appendChild(c);
57
+ }
58
+ }
59
+ }, h = {
60
+ siteBackgroundColor: "#ffffff",
61
+ fireplaceLeftMargin: 0,
62
+ adNodeMarginTop: -24,
63
+ adNodeMarginBottom: 0,
64
+ responsiveScroll: -124,
65
+ xPosHalfpage: 720,
66
+ yPosHalfpage: 32,
67
+ stickyMargin: { offset: 104, isSticky: !0 },
68
+ zIndex: function() {
69
+ const t = window.parent.document;
70
+ if (t.querySelector('div[id*="tablet"][id*="takeover"]')) {
71
+ let n = t.createElement("style");
72
+ n.innerHTML = `
73
+ #app header + div{
74
+ position: static;
75
+ }
76
+ `, t.head.appendChild(n);
77
+ }
78
+ const o = t.querySelector("footer").previousElementSibling;
79
+ o && o.tagName.toLowerCase() === "div" && (o.style.position = "relative");
80
+ }
81
+ }, M = {
82
+ siteBackgroundColor: "#ffffff",
83
+ fireplaceLeftMargin: 0,
84
+ adNodeMarginTop: -32,
85
+ adNodeMarginBottom: 16,
86
+ responsiveScroll: -124,
87
+ xPosHalfpage: function() {
88
+ return 720;
89
+ },
90
+ yPosHalfpage: function() {
91
+ return 16;
92
+ },
93
+ stickyMargin: { offset: 16, isSticky: !0 },
94
+ zIndex: function() {
95
+ var e, i, o, n, s, a;
96
+ const t = window.parent.document;
97
+ (e = t.querySelector(".header-wrapper")) == null || e.setAttribute("style", "height:124px"), (i = t.querySelector(".weather-widget-wrapper")) == null || i.setAttribute("style", "bottom:0px"), (o = t.querySelector(".content")) == null || o.setAttribute("style", "padding-top:32px"), (n = t.querySelector(".layout")) == null || n.setAttribute("style", "position:relative;background-color:transparent;"), (s = t.querySelector(".footer-ad")) == null || s.setAttribute("style", "position:relative"), (a = t.querySelector(".footer-netkit")) == null || a.setAttribute("style", "position:relative;max-width:1190px;left:50%;transform:translate(-50%,0);");
98
+ }
99
+ }, b = [
100
+ { site: "https://www.nine.com.au/sport", config: h },
101
+ { site: "https://www.nine.com.au/product-reviews", config: p },
102
+ { site: "https://www.nine.com.au/property", config: p },
103
+ { site: "https://www.nine.com.au/entertainment", config: p },
104
+ { site: "https://staging.nine.com.au/sport", config: h },
105
+ { site: "https://staging.nine.com.au/product-reviews", config: p },
106
+ { site: "https://staging.nine.com.au/property", config: p },
107
+ { site: "https://staging.nine.com.au/entertainment", config: p },
108
+ { site: "https://render-web-nine-staging-v1.ffxblue.com.au", config: y },
109
+ { site: "https://render-web-nine-production-v1.ffxblue.com.au", config: y },
110
+ { site: "https://preview.nine.com.au/", config: y },
111
+ { site: "https://www.nine", config: y },
112
+ { site: "https://staging.nine", config: y },
113
+ { site: "https://entertainment", config: r },
114
+ { site: "https://celebrity", config: r },
115
+ { site: "https://homes", config: r },
116
+ { site: "https://travel", config: r },
117
+ { site: "https://honey", config: r },
118
+ { site: "https://style", config: r },
119
+ { site: "https://coach", config: r },
120
+ { site: "https://kitchen", config: r },
121
+ { site: "https://finance", config: r },
122
+ { site: "https://wwos", config: h },
123
+ { site: "https://staging.wwos", config: h },
124
+ { site: "https://www.9news", config: M },
125
+ { site: "https://staging.9news", config: M },
126
+ { site: "https://www.yourtv", config: r },
127
+ { site: "https://staging.yourtv", config: r },
128
+ { site: "https://9now", config: p },
129
+ { site: "https://creative-preview-an.com", config: r }
130
+ ], E = () => {
131
+ const t = window.document.getElementById("nineContent");
132
+ t && (t.style.backgroundColor = f.siteBackgroundColor), D(), T(), window.parent.window.addEventListener("scroll", C), setTimeout(C, 50);
133
+ }, I = () => {
134
+ let t = null;
135
+ return window.parent && (t = window.parent.document.querySelector('div[id*="billboard"][id*="above"]')), t;
136
+ }, P = () => {
137
+ const t = window.parent.location.href;
138
+ for (let e = 0; e < b.length; e += 1)
139
+ if (t.indexOf(b[e].site) >= 0)
140
+ return b[e].config;
141
+ }, T = () => {
142
+ if (!u) return;
143
+ const t = u.style;
144
+ t.width = "100%", t.height = "1000px", t.position = "fixed", t.left = "50%", t.transform = "translate(-50%, 0)";
145
+ }, D = () => {
146
+ if (!N) return;
147
+ const t = N.style;
148
+ t.minHeight = "250px", t.marginTop = f.adNodeMarginTop + "px", t.marginBottom = f.adNodeMarginBottom + "px", t.position = "static", t.display = "block", window.parent && f.zIndex && f.zIndex();
149
+ }, C = (t) => {
150
+ const e = window.parent.scrollY, i = u.style, o = document.getElementById("siteContent") ? document.getElementById("siteContent").style : {};
151
+ e >= 0 && e <= g ? (i.transform = `translate(-50%, ${-e}px)`, o.transform = "translateY(0)") : e > g && e <= B ? (i.transform = `translate(-50%, ${-g}px)`, o.transform = `translateY(${g - e}px)`) : e > B && (i.transform = `translate(-50%, ${-(void 0).mastheadTop}px)`, o.transform = "translateY(-250px)");
152
+ }, N = I(), f = P(), g = -f.responsiveScroll + (d || 0), B = g + 250;
153
+ E();
154
+ };
155
+ function z({ adFormat: d = "", stickyOffset: u = 0 } = {}) {
156
+ console.log(d), d === "fireplace" && (console.log("54545455"), L(u));
157
+ }
158
+ export {
159
+ z as default
160
+ };
@@ -0,0 +1,9 @@
1
+ (function(d,u){typeof exports=="object"&&typeof module<"u"?module.exports=u():typeof define=="function"&&define.amd?define(u):(d=typeof globalThis<"u"?globalThis:d||self,d.poweredAdConfig=u())})(this,function(){"use strict";const d=y=>{const g=window.frameElement?window.frameElement:null,r={siteBackgroundColor:"#ffffff",fireplaceLeftMargin:0,adNodeMarginTop:-24,adNodeMarginBottom:0,responsiveScroll:-124,xPosHalfpage:function(){return 695},yPosHalfpage:function(){return 72},stickyMargin:{offset:72,isSticky:!0},zIndex:function(){var i,o,n,s,a,l,c,h,v,S,x;const t=window.parent.document,e=(q,k)=>q.forEach(M=>k.forEach(([C,z])=>M.style[C]=z));(i=t.querySelector(".nk-demographics"))==null||i.setAttribute("style","max-width:1190px;left:50%;transform:translate(-50%,0);"),(o=t.querySelector(".nk-footer"))==null||o.setAttribute("style","position:relative;max-width:1190px;left:50%;transform:translate(-50%,0);"),(n=t.querySelector("article"))==null||n.setAttribute("style","position:relative"),(s=t.querySelector("#article"))==null||s.setAttribute("style","position:relative"),(a=t.querySelector("#VideoIndex"))==null||a.setAttribute("style","position:relative"),(l=t.querySelector("#Index"))==null||l.setAttribute("style","position:relative"),(c=t.querySelector(".show"))==null||c.setAttribute("style","position:relative"),(h=t.querySelector("#adspot-desktop-banner-7-below"))==null||h.setAttribute("style","position:relative"),e(t.querySelectorAll(".column"),[["position","relative"]]),e(t.querySelectorAll(".advert"),[["position","relative"]]),e(t.querySelectorAll("blockquote"),[["zIndex","1"]]),(v=t.querySelector('div[class*="article__MyContainer"]'))==null||v.setAttribute("style","max-width:1190px;margin-top:-24px"),(S=t.querySelector('div[type="BANNER"]'))==null||S.setAttribute("style","display:none"),(x=t.querySelector('div[type="MBANNER"]'))==null||x.setAttribute("style","display:none")}},p={siteBackgroundColor:"#ffffff",fireplaceLeftMargin:0,adNodeMarginTop:-24,adNodeMarginBottom:0,responsiveScroll:-124,xPosHalfpage:function(){return 695},yPosHalfpage:function(){return 32},stickyMargin:{offset:32,isSticky:!0},zIndex:function(){var i,o,n,s,a,l,c,h,v,S;const t=window.parent.document,e=(x,q)=>x.forEach(k=>q.forEach(([M,C])=>k.style[M]=C));(i=t.querySelector(".nk-demographics"))==null||i.setAttribute("style","max-width:1190px;left:50%;transform:translate(-50%,0);"),(o=t.querySelector(".nk-footer"))==null||o.setAttribute("style","position:relative;max-width:1190px;left:50%;transform:translate(-50%,0);"),(n=t.querySelector("article"))==null||n.setAttribute("style","position:relative"),(s=t.querySelector("#article"))==null||s.setAttribute("style","position:relative"),(a=t.querySelector("#VideoIndex"))==null||a.setAttribute("style","position:relative"),(l=t.querySelector("#Index"))==null||l.setAttribute("style","position:relative"),(c=t.querySelector(".show"))==null||c.setAttribute("style","position:relative"),e(t.querySelectorAll(".column"),[["position","relative"]]),e(t.querySelectorAll(".advert"),[["position","relative"]]),e(t.querySelectorAll("blockquote"),[["zIndex","1"]]),(h=t.querySelector('div[class^="component__StrapContainer"]'))==null||h.setAttribute("style","position:relative"),(v=t.querySelector('section[class^="WatchNow__Container"]'))==null||v.setAttribute("style","margin-left:calc(50% - 49vw);margin-right:calc(50% - 49vw + 10px);"),(S=t.querySelector('div[class*="ArticleContainer"]'))==null||S.setAttribute("style","max-width:1190px;margin-top:0px")}},m={siteBackgroundColor:"#ffffff",fireplaceLeftMargin:0,adNodeMarginTop:-24,adNodeMarginBottom:-10,responsiveScroll:-120,xPosHalfpage:722,yPosHalfpage:32,stickyMargin:{offset:8,isSticky:!0},zIndex:function(){var i,o,n,s,a,l;const t=window.parent.document;if((i=t.querySelector('section[data-section="marketing-banner"]'))==null||i.setAttribute("style","position:relative"),(n=(o=t.querySelector('div[data-testid="live-tv"]'))==null?void 0:o.parentNode)==null||n.setAttribute("style","position:relative"),(a=(s=t.querySelector('div[data-contentunit-id="stan"]'))==null?void 0:s.parentNode)==null||a.setAttribute("style","position:relative"),(l=t.querySelector("small"))==null||l.setAttribute("style","position:inherit"),t.querySelector('div[id*="tablet"][id*="takeover"]')){let c=t.createElement("style");c.innerHTML=`
2
+ div:has(#adspot-tablet-takeover-2-above) {
3
+ position: static;
4
+ }
5
+ `,t.head.appendChild(c)}}},b={siteBackgroundColor:"#ffffff",fireplaceLeftMargin:0,adNodeMarginTop:-24,adNodeMarginBottom:0,responsiveScroll:-124,xPosHalfpage:720,yPosHalfpage:32,stickyMargin:{offset:104,isSticky:!0},zIndex:function(){const t=window.parent.document;if(t.querySelector('div[id*="tablet"][id*="takeover"]')){let n=t.createElement("style");n.innerHTML=`
6
+ #app header + div{
7
+ position: static;
8
+ }
9
+ `,t.head.appendChild(n)}const o=t.querySelector("footer").previousElementSibling;o&&o.tagName.toLowerCase()==="div"&&(o.style.position="relative")}},N={siteBackgroundColor:"#ffffff",fireplaceLeftMargin:0,adNodeMarginTop:-32,adNodeMarginBottom:16,responsiveScroll:-124,xPosHalfpage:function(){return 720},yPosHalfpage:function(){return 16},stickyMargin:{offset:16,isSticky:!0},zIndex:function(){var e,i,o,n,s,a;const t=window.parent.document;(e=t.querySelector(".header-wrapper"))==null||e.setAttribute("style","height:124px"),(i=t.querySelector(".weather-widget-wrapper"))==null||i.setAttribute("style","bottom:0px"),(o=t.querySelector(".content"))==null||o.setAttribute("style","padding-top:32px"),(n=t.querySelector(".layout"))==null||n.setAttribute("style","position:relative;background-color:transparent;"),(s=t.querySelector(".footer-ad"))==null||s.setAttribute("style","position:relative"),(a=t.querySelector(".footer-netkit"))==null||a.setAttribute("style","position:relative;max-width:1190px;left:50%;transform:translate(-50%,0);")}},A=[{site:"https://www.nine.com.au/sport",config:b},{site:"https://www.nine.com.au/product-reviews",config:p},{site:"https://www.nine.com.au/property",config:p},{site:"https://www.nine.com.au/entertainment",config:p},{site:"https://staging.nine.com.au/sport",config:b},{site:"https://staging.nine.com.au/product-reviews",config:p},{site:"https://staging.nine.com.au/property",config:p},{site:"https://staging.nine.com.au/entertainment",config:p},{site:"https://render-web-nine-staging-v1.ffxblue.com.au",config:m},{site:"https://render-web-nine-production-v1.ffxblue.com.au",config:m},{site:"https://preview.nine.com.au/",config:m},{site:"https://www.nine",config:m},{site:"https://staging.nine",config:m},{site:"https://entertainment",config:r},{site:"https://celebrity",config:r},{site:"https://homes",config:r},{site:"https://travel",config:r},{site:"https://honey",config:r},{site:"https://style",config:r},{site:"https://coach",config:r},{site:"https://kitchen",config:r},{site:"https://finance",config:r},{site:"https://wwos",config:b},{site:"https://staging.wwos",config:b},{site:"https://www.9news",config:N},{site:"https://staging.9news",config:N},{site:"https://www.yourtv",config:r},{site:"https://staging.yourtv",config:r},{site:"https://9now",config:p},{site:"https://creative-preview-an.com",config:r}],P=()=>{const t=window.document.getElementById("nineContent");t&&(t.style.backgroundColor=f.siteBackgroundColor),L(),H(),window.parent.window.addEventListener("scroll",B),setTimeout(B,50)},T=()=>{let t=null;return window.parent&&(t=window.parent.document.querySelector('div[id*="billboard"][id*="above"]')),t},D=()=>{const t=window.parent.location.href;for(let e=0;e<A.length;e+=1)if(t.indexOf(A[e].site)>=0)return A[e].config},H=()=>{if(!g)return;const t=g.style;t.width="100%",t.height="1000px",t.position="fixed",t.left="50%",t.transform="translate(-50%, 0)"},L=()=>{if(!E)return;const t=E.style;t.minHeight="250px",t.marginTop=f.adNodeMarginTop+"px",t.marginBottom=f.adNodeMarginBottom+"px",t.position="static",t.display="block",window.parent&&f.zIndex&&f.zIndex()},B=t=>{const e=window.parent.scrollY,i=g.style,o=document.getElementById("siteContent")?document.getElementById("siteContent").style:{};e>=0&&e<=w?(i.transform=`translate(-50%, ${-e}px)`,o.transform="translateY(0)"):e>w&&e<=I?(i.transform=`translate(-50%, ${-w}px)`,o.transform=`translateY(${w-e}px)`):e>I&&(i.transform=`translate(-50%, ${-(void 0).mastheadTop}px)`,o.transform="translateY(-250px)")},E=T(),f=D(),w=-f.responsiveScroll+(y||0),I=w+250;P()};function u({adFormat:y="",stickyOffset:g=0}={}){console.log(y),y==="fireplace"&&(console.log("54545455"),d(g))}return u});
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "powered-ad-config",
3
+ "version": "0.0.1",
4
+ "description": "Configure Ads to load smoothly and at the right position on All Nine's websites",
5
+ "main": "dist/powered-ad-config.umd.js",
6
+ "module": "dist/powered-ad-config.es.js",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build",
14
+ "preview": "vite preview"
15
+ },
16
+ "devDependencies": {
17
+ "vite": "^5.4.2"
18
+ },
19
+ "dependencies": {
20
+ },
21
+ "author": "Joffrey Lyon",
22
+ "license": "MIT"
23
+ }