Skip to content

Commit fe488e4

Browse files
Add code for less ads in footer
1 parent b9c07c9 commit fe488e4

2 files changed

Lines changed: 80 additions & 31 deletions

File tree

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ GEM
4545
logger
4646
faraday-net_http (3.4.0)
4747
net-http (>= 0.5.0)
48-
ffi (1.17.0-x64-mingw-ucrt)
49-
ffi (1.17.0-x86_64-linux-gnu)
48+
ffi (1.17.2-x64-mingw-ucrt)
49+
ffi (1.17.2-x86_64-linux-gnu)
5050
forwardable-extended (2.6.0)
5151
gemoji (4.1.0)
5252
github-pages (232)
@@ -240,9 +240,9 @@ GEM
240240
minitest (5.25.2)
241241
net-http (0.5.0)
242242
uri
243-
nokogiri (1.16.7-x64-mingw-ucrt)
243+
nokogiri (1.18.9-x64-mingw-ucrt)
244244
racc (~> 1.4)
245-
nokogiri (1.16.7-x86_64-linux)
245+
nokogiri (1.18.9-x86_64-linux-gnu)
246246
racc (~> 1.4)
247247
octokit (4.25.1)
248248
faraday (>= 1, < 3)

_includes/footer_custom.html

Lines changed: 76 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,92 @@
44
<!-- I'm just building an economy -->
55
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4468899728405672"
66
crossorigin="anonymous"></script>
7-
<!-- KMC Footer Single Ad -->
8-
<ins class="adsbygoogle"
9-
style="display:block"
10-
data-ad-client="ca-pub-4468899728405672"
11-
data-ad-slot="9487924817"
12-
data-ad-format="auto"
13-
data-full-width-responsive="true"></ins>
14-
<script>
15-
(adsbygoogle = window.adsbygoogle || []).push({});
16-
</script>
17-
187

19-
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4468899728405672"
20-
crossorigin="anonymous"></script>
21-
<ins class="adsbygoogle"
8+
<div id="ads">
9+
<!-- KMC Footer Single Ad -->
10+
<ins class="adsbygoogle"
2211
style="display:block"
23-
data-ad-format="autorelaxed"
2412
data-ad-client="ca-pub-4468899728405672"
25-
data-matched-content-ui-type="image_stacked"
26-
data-matched-content-rows-num="3"
27-
data-matched-content-columns-num="3"
28-
data-ad-slot="1868153772"></ins>
29-
<script>
30-
(adsbygoogle = window.adsbygoogle || []).push({});
31-
</script>
13+
data-ad-slot="9487924817"
14+
data-ad-format="auto"
15+
data-full-width-responsive="true"></ins>
3216

33-
34-
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4468899728405672"
35-
crossorigin="anonymous"></script>
36-
<ins class="adsbygoogle"
17+
<ins class="adsbygoogle"
3718
style="display:block"
3819
data-ad-format="autorelaxed"
3920
data-ad-client="ca-pub-4468899728405672"
4021
data-matched-content-ui-type="image_stacked"
4122
data-matched-content-rows-num="3"
4223
data-matched-content-columns-num="3"
4324
data-ad-slot="1868153772"></ins>
25+
26+
<ins class="adsbygoogle"
27+
style="display:block"
28+
data-ad-format="autorelaxed"
29+
data-ad-client="ca-pub-4468899728405672"
30+
data-matched-content-ui-type="image_stacked"
31+
data-matched-content-rows-num="3"
32+
data-matched-content-columns-num="3"
33+
data-ad-slot="1868153772"></ins>
34+
</div>
4435
<script>
4536
(adsbygoogle = window.adsbygoogle || []).push({});
46-
</script>
37+
38+
function lessAds()
39+
{
40+
document.getElementById("ads").children[document.getElementById("ads").children.length - 1].remove();
41+
42+
localStorage.setItem("ads", document.getElementById("ads").children.length)
43+
}
44+
45+
function noAds()
46+
{
47+
document.getElementById("ads").innerHTML = "";
48+
localStorage.setItem("ads", 0);
49+
}
50+
51+
function moreAds()
52+
{
53+
let advertNode = document.createElement("ins");
54+
advertNode.classList.add("adsbygoogle");
55+
advertNode.style.display = 'block';
56+
advertNode.setAttribute("data-ad-client", "ca-pub-4468899728405672");
57+
58+
if (document.getElementById("ads").children.length == 0)
59+
{
60+
61+
advertNode.setAttribute("data-ad-slot", "9487924817");
62+
advertNode.setAttribute("data-ad-format", "auto");
63+
advertNode.setAttribute("data-full-width-responsive", "true");
64+
}
65+
else
66+
{
67+
advertNode.setAttribute("data-ad-format", "autorelaxed");
68+
advertNode.setAttribute("data-matched-content-ui-type", "image_stacked");
69+
advertNode.setAttribute("data-matched-content-rows-num", "3");
70+
advertNode.setAttribute("data-matched-content-columns-num", "3");
71+
advertNode.setAttribute("data-ad-slot", "1868153772");
72+
}
73+
74+
document.getElementById("ads").appendChild(advertNode);
75+
(adsbygoogle = window.adsbygoogle || []).push({});
76+
localStorage.setItem("ads", document.getElementById("ads").children.length)
77+
}
78+
79+
if (localStorage.getItem("ads") !== null)
80+
{
81+
while (localStorage.getItem("ads") < document.getElementById("ads").children.length)
82+
{
83+
lessAds()
84+
}
85+
86+
while (localStorage.getItem("ads") > document.getElementById("ads").children.length)
87+
{
88+
moreAds()
89+
}
90+
}
91+
</script>
92+
93+
<button onclick="lessAds()" class="btn">Less Ads</button>
94+
<button onclick="moreAds()" class="btn">More Ads</button>
95+
<button onclick="noAds()" class="btn">No Ads</button>

0 commit comments

Comments
 (0)