Skip to content

Commit c369644

Browse files
committed
ad bad ads (sigh) + liscense + more words
1 parent 7f04382 commit c369644

File tree

2 files changed

+193
-34
lines changed

2 files changed

+193
-34
lines changed

src/routes/+layout.svelte

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { browser } from "$app/environment";
33
import { onMount } from "svelte";
44
import ServerSwitcher from "$lib/components/ServerSwitcher.svelte";
5+
import { initializeTooling, SessionState, State } from "$lib/state.js";
56
67
let { children } = $props();
78
@@ -15,14 +16,19 @@
1516
let idToUse = $state("");
1617
let useGA4 = $state(false);
1718
let mounted = $state(false);
19+
let adsEnabled = $state(false);
20+
let isAHost = $state(false);
1821
1922
onMount(() => {
2023
mounted = true;
21-
2224
if (browser) {
25+
initializeTooling().then(() => {
26+
adsEnabled = SessionState.adsEnabled;
27+
});
28+
isAHost = State.isAHost();
2329
let hostname = window.location.hostname;
2430
console.log("[R][LAYOUT][BASE] Hostname:", hostname);
25-
31+
2632
if (hostname in ga4Codes) {
2733
const code = ga4Codes[hostname as keyof typeof ga4Codes];
2834
console.log("[R][LAYOUT][BASE] GA4 Code:", code);
@@ -37,24 +43,37 @@
3743
useGA4 = true;
3844
}
3945
40-
console.log("[R][LAYOUT][BASE] Using GA4:", useGA4, "with ID:", idToUse);
46+
console.log(
47+
"[R][LAYOUT][BASE] Using GA4:",
48+
useGA4,
49+
"with ID:",
50+
idToUse,
51+
);
4152
4253
// Manually inject GA4 after mount to ensure it works
4354
if (useGA4 && idToUse) {
4455
injectGA4(idToUse);
4556
}
57+
if ((!isAHost && adsEnabled) || SessionState.devMode) {
58+
console.log("[R][LAYOUT][BASE] Bad Ads enabled");
59+
} else {
60+
if (isAHost && adsEnabled) {
61+
console.log("[R][LAYOUT][BASE] Good ads enabled");
62+
} else {
63+
console.log("[R][LAYOUT][BASE] No ads");
64+
}
65+
}
4666
}
4767
});
48-
4968
function injectGA4(trackingId: string) {
5069
// Inject the gtag script
51-
const script1 = document.createElement('script');
70+
const script1 = document.createElement("script");
5271
script1.async = true;
5372
script1.src = `https://www.googletagmanager.com/gtag/js?id=${trackingId}`;
5473
document.head.appendChild(script1);
5574
5675
// Inject the configuration script
57-
const script2 = document.createElement('script');
76+
const script2 = document.createElement("script");
5877
script2.innerHTML = `
5978
window.dataLayer = window.dataLayer || [];
6079
function gtag(){dataLayer.push(arguments);}
@@ -75,4 +94,11 @@
7594
<!-- Server Switcher - only show in browser -->
7695
{#if browser}
7796
<ServerSwitcher />
78-
{/if}
97+
{/if}
98+
99+
{#if (!isAHost && adsEnabled)}
100+
<script
101+
type="text/javascript"
102+
src="//pl27945770.effectivegatecpm.com/b0/88/ed/b088ed7c9240db179822a126a078b258.js"
103+
></script>
104+
{/if}

src/routes/+page.svelte

Lines changed: 160 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import { onMount } from "svelte";
88
import { loadGames } from "$lib/loadCards.js";
99
import { checkNotifications } from "$lib/checkNotifications.js";
10+
import { browser } from "$app/environment";
1011
1112
let isAHost = $state(State.isAHost());
1213
let devMode = $state(true);
1314
let adblockEnabled = $state(SessionState.adBlockEnabled);
1415
let adsEnabled = $state(SessionState.adsEnabled);
16+
let streamingContent = $state("");
1517
onMount(async () => {
1618
await initializeTooling();
1719
@@ -22,6 +24,35 @@
2224
devMode = SessionState.devMode;
2325
adblockEnabled = SessionState.adBlockEnabled;
2426
adsEnabled = SessionState.adsEnabled;
27+
28+
function injectBadAds() {
29+
const script = document.createElement("script");
30+
script.type = "text/javascript";
31+
script.src =
32+
"//pl27945791.effectivegatecpm.com/f9/0f/48/f90f487cd8f3cdf83690f6955c1b5655.js";
33+
document.body.appendChild(script);
34+
}
35+
if ((!isAHost && adsEnabled)) {
36+
console.log("[R][LAYOUT][BASE] Bad Ads enabled");
37+
injectBadAds();
38+
} else {
39+
if (isAHost && adsEnabled) {
40+
console.log("[R][LAYOUT][BASE] Good ads enabled");
41+
} else {
42+
console.log("[R][LAYOUT][BASE] No ads");
43+
}
44+
}
45+
46+
var chars = "~!@#$%^&*()_+{}|:'<>?`1234567890-=[]\\;/.,";
47+
48+
if (browser && window.innerWidth > 800) {
49+
setInterval(() => {
50+
streamingContent +=
51+
chars.split("")[Math.floor(Math.random() * chars.length)];
52+
53+
streamingContent = streamingContent.slice(-75);
54+
}, 50);
55+
}
2556
});
2657
</script>
2758

@@ -40,38 +71,140 @@
4071
</div>
4172

4273
<footer>
43-
<h3>
44-
<b
45-
>Can't find what you're looking for? <a
46-
href="https://discord.gg/GDEFRBTT3Z">Join the discord</a
47-
></b
48-
>
49-
</h3>
50-
<p>
51-
CCPorted is not affiliated with or endorsed by any game developers or
52-
publishers. All games are property of their respective owners.
53-
</p>
54-
<p>
55-
DMCA Requests can be sent to <a href="mailto:[email protected]"
56-
57-
>
58-
</p>
59-
<p>
60-
Site, design, and development are protected under common law copyright;
61-
© {new Date().getFullYear()} CCPorted
62-
</p>
63-
<p>
64-
<a href="/tos/privacy_policy">Privacy Policy</a> |
65-
<a href="/tos/terms_of_service">Terms of Service</a>
66-
</p>
67-
<Info />
74+
<div class="left">
75+
<h3>
76+
<b
77+
>Can't find what you're looking for? <a
78+
href="https://discord.gg/GDEFRBTT3Z">Join the discord</a
79+
></b
80+
>
81+
</h3>
82+
<p>
83+
CCPorted is not affiliated with or endorsed by any game developers
84+
or publishers. All games are property of their respective owners*
85+
</p>
86+
<p>
87+
DMCA Requests can be sent to <a
88+
89+
>
90+
</p>
91+
<p>
92+
Site, design, and development are protected under common law
93+
copyright; © {new Date().getFullYear()} CCPorted
94+
</p>
95+
<p>
96+
<a href="/tos/privacy_policy">Privacy Policy</a> |
97+
<a href="/tos/terms_of_service">Terms of Service</a>
98+
</p>
99+
<p>
100+
* BallZ, Nighttime Visitor, Tetris, Tic Tac Toe, Stack, and Reaction
101+
Rush are all owned and protected by CCPorted.
102+
</p>
103+
<p>
104+
For complaints about ad content, please contact us at <a
105+
106+
> or through the discord (see link above and in the navigation).
107+
</p>
108+
<h3>CCPORTED</h3>
109+
<p>CCPorted is the greatest place to play video games. The CCPorted team parses through hundreds of games and only adds the highest-quality games to our library, ensuring a high quality gaming experience for the users. Log in to get added to leaderboards and compete with your friends. Play all kinds of games from nostalgic classics to the latest hits. Our extensive ROM library also features over 300 titles from the late 90s and early 2000s. Join the Discord to get site updates and request games. New games are added each week, and games are updated regularly to ensure a bug-free experience.</p>
110+
<p>Join the discord to request the <i>Underground Document</i>, a Google Doc with information on how to access other links for the site.</p>
111+
<p>To view old notifications, visit the notifications page.</p>
112+
<h3>Partners</h3>
113+
<p>To become a partner, please contact us through the discord.</p>
114+
</div>
115+
<div class="license">
116+
<h3>CCPORTED SOFTWARE LICENSE INFORMATION</h3>
117+
<p>
118+
This software is licensed under the GNU Affero General Public
119+
License v3.0 (AGPL-3.0), with additional terms that restrict
120+
commercial use as described below.
121+
</p>
122+
123+
<h4>NONCOMMERCIAL CLAUSE</h4>
124+
<p>
125+
You may not use, modify, distribute, or otherwise exploit this
126+
software, in whole or in part, for commercial purposes.
127+
</p>
128+
<p>
129+
"Commercial purposes" means any use that is intended for or directed
130+
toward commercial advantage or monetary compensation, including but
131+
not limited to: - Selling or licensing copies of the software, -
132+
Hosting, operating, or distributing the software as part of a paid
133+
service, - Using the software to generate revenue (advertising,
134+
subscriptions, etc.), - Integrating the software into commercial
135+
products or services.
136+
</p>
137+
<p>
138+
You may use, modify, and share this software freely for personal,
139+
educational, research, or other noncommercial purposes, provided
140+
that all modified versions and derivative works are distributed
141+
under the same license and made publicly available.
142+
</p>
143+
144+
<h4>AGPL v3 LICENSE TERMS</h4>
145+
<p>
146+
This program is free software: you can redistribute it and/or modify
147+
it under the terms of the GNU Affero General Public License as
148+
published by the Free Software Foundation, either version 3 of the
149+
License, or (at your option) any later version.
150+
</p>
151+
<p>
152+
This program is distributed in the hope that it will be useful, but
153+
WITHOUT ANY WARRANTY; without even the implied warranty of
154+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
155+
Affero General Public License for more details.
156+
</p>
157+
<p>
158+
You should have received a copy of the GNU Affero General Public
159+
License along with this program. If not, see <a
160+
href="https://www.gnu.org/licenses/"
161+
>https://www.gnu.org/licenses/</a
162+
>.
163+
</p>
164+
<h4>LICENSE NOTICE</h4>
165+
<p>
166+
When redistributing this software or derivative works, you must
167+
include this full license text, clearly indicating that it is
168+
licensed under "AGPL v3 + NonCommercial Clause".
169+
</p>
170+
</div>
171+
<div class="info">
172+
<Info />
173+
</div>
68174
</footer>
175+
<div class="streaming-console">
176+
<code>{streamingContent}</code>
177+
</div>
69178

70179
<style>
71-
footer {
180+
.streaming-console {
181+
width: 100%;
72182
text-align: center;
183+
}
184+
footer {
185+
display: flex;
186+
flex-direction: row;
73187
color: #666;
74-
margin: 20px 0;
75188
font-size: 14px;
189+
justify-content: space-around;
190+
}
191+
footer div {
192+
margin: 20px;
193+
max-width: 600px;
194+
}
195+
196+
@media (max-width: 800px) {
197+
footer {
198+
flex-direction: column;
199+
align-items: center;
200+
text-align: center;
201+
}
202+
footer div {
203+
max-width: none;
204+
}
205+
footer .license {
206+
order: 1;
207+
text-align: left;
208+
}
76209
}
77210
</style>

0 commit comments

Comments
 (0)