mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:10:42 +00:00
Revert "add addinplay ads" (#897)
This reverts commit 95919d2392.
## Description:
## Please complete the following:
- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors
## Please put your Discord username so you can be contacted if a bug or
regression is found:
<DISCORD USERNAME>
This commit is contained in:
@@ -15,7 +15,6 @@ import { EventsDisplay } from "./layers/EventsDisplay";
|
||||
import { FxLayer } from "./layers/FxLayer";
|
||||
import { Layer } from "./layers/Layer";
|
||||
import { Leaderboard } from "./layers/Leaderboard";
|
||||
import { LeftInGameAd } from "./layers/LeftInGameAd";
|
||||
import { MultiTabModal } from "./layers/MultiTabModal";
|
||||
import { NameLayer } from "./layers/NameLayer";
|
||||
import { OptionsMenu } from "./layers/OptionsMenu";
|
||||
@@ -172,14 +171,6 @@ export function createRenderer(
|
||||
}
|
||||
playerTeamLabel.game = game;
|
||||
|
||||
const leftInGameAd = document.querySelector(
|
||||
"left-in-game-ad",
|
||||
) as LeftInGameAd;
|
||||
if (!(leftInGameAd instanceof LeftInGameAd)) {
|
||||
console.error("left in game ad not found");
|
||||
}
|
||||
leftInGameAd.g = game;
|
||||
|
||||
const layers: Layer[] = [
|
||||
new TerrainLayer(game, transformHandler),
|
||||
new TerritoryLayer(game, eventBus),
|
||||
@@ -213,7 +204,6 @@ export function createRenderer(
|
||||
playerPanel,
|
||||
playerTeamLabel,
|
||||
multiTabModal,
|
||||
leftInGameAd,
|
||||
];
|
||||
|
||||
return new GameRenderer(
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
import { LitElement, css, html } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import { GameView } from "../../../core/game/GameView";
|
||||
import { Layer } from "./Layer";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
aiptag: {
|
||||
cmd: {
|
||||
display: {
|
||||
push: (callback: () => void) => void;
|
||||
};
|
||||
};
|
||||
};
|
||||
aipDisplayTag: {
|
||||
display: (id: string) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const BREAKPOINT = {
|
||||
width: 1000,
|
||||
height: 800,
|
||||
};
|
||||
|
||||
const AD_SIZE = "openfront-io_300x250_game";
|
||||
|
||||
@customElement("left-in-game-ad")
|
||||
export class LeftInGameAd extends LitElement implements Layer {
|
||||
public g: GameView;
|
||||
|
||||
@state()
|
||||
private isVisible: boolean = false;
|
||||
|
||||
// Override createRenderRoot to disable shadow DOM
|
||||
createRenderRoot() {
|
||||
return this;
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
.ad-container {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 9000;
|
||||
pointer-events: auto;
|
||||
}
|
||||
`;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
public show(): void {
|
||||
this.isVisible = true;
|
||||
this.requestUpdate();
|
||||
// Refresh the ad when showing
|
||||
setTimeout(() => this.refreshAd(), 100);
|
||||
}
|
||||
|
||||
public hide(): void {
|
||||
this.isVisible = false;
|
||||
this.requestUpdate();
|
||||
}
|
||||
|
||||
public async tick() {
|
||||
if (!this.isVisible && !this.g.inSpawnPhase() && this.screenLargeEnough()) {
|
||||
console.log("showing left in game ad");
|
||||
this.show();
|
||||
}
|
||||
if (this.isVisible && !this.screenLargeEnough()) {
|
||||
console.log("hiding left in game ad");
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
|
||||
private screenLargeEnough(): boolean {
|
||||
return (
|
||||
window.innerWidth > BREAKPOINT.width &&
|
||||
window.innerHeight > BREAKPOINT.height
|
||||
);
|
||||
}
|
||||
|
||||
private refreshAd(): void {
|
||||
if (window.aiptag && window.aiptag.cmd && window.aiptag.cmd.display) {
|
||||
window.aiptag.cmd.display.push(
|
||||
function () {
|
||||
if (window.aipDisplayTag) {
|
||||
window.aipDisplayTag.display(AD_SIZE);
|
||||
}
|
||||
}.bind(this),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.isVisible) {
|
||||
return html``;
|
||||
}
|
||||
|
||||
return html`
|
||||
<div
|
||||
class="ad-container"
|
||||
style="position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 9999;"
|
||||
>
|
||||
<div id="${AD_SIZE}"></div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
@@ -135,25 +135,6 @@
|
||||
|
||||
gtag("config", "G-WQGQQ8RDN4");
|
||||
</script>
|
||||
<!-- AdinPlay Ads -->
|
||||
<script>
|
||||
var aiptag = aiptag || {};
|
||||
aiptag.cmd = aiptag.cmd || [];
|
||||
aiptag.cmd.display = aiptag.cmd.display || [];
|
||||
aiptag.cmd.player = aiptag.cmd.player || [];
|
||||
|
||||
//CMP tool settings
|
||||
aiptag.cmp = {
|
||||
show: true,
|
||||
button: true,
|
||||
buttonText: "Privacy settings",
|
||||
buttonPosition: "top-right", //bottom-left, bottom-right, top-left, top-right
|
||||
};
|
||||
</script>
|
||||
<script
|
||||
async
|
||||
src="//api.adinplay.com/libs/aiptag/pub/OFI/openfront.io/tag.min.js"
|
||||
></script>
|
||||
</head>
|
||||
|
||||
<body
|
||||
@@ -222,26 +203,6 @@
|
||||
</header>
|
||||
<div class="bg-image"></div>
|
||||
|
||||
<!-- Left gutter ad placement - full height, no empty space -->
|
||||
<div class="left-gutter-ad ad">
|
||||
<div id="openfront-io_300x600">
|
||||
<script type="text/javascript">
|
||||
aiptag.cmd.display.push(function () {
|
||||
aipDisplayTag.display("openfront-io_300x600");
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-gutter-ad ad">
|
||||
<div id="openfront-io_300x600_2">
|
||||
<script type="text/javascript">
|
||||
aiptag.cmd.display.push(function () {
|
||||
aipDisplayTag.display("openfront-io_300x600_2");
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main container with responsive padding -->
|
||||
<main class="flex justify-center flex-grow">
|
||||
<div class="container pt-12">
|
||||
|
||||
Reference in New Issue
Block a user