switched the ad provider

This commit is contained in:
Miodec 2021-01-30 21:26:51 +00:00
parent cb71092d65
commit 31048637dd
3 changed files with 234 additions and 77 deletions

View file

@ -1551,72 +1551,181 @@ function applyConfig(configObj) {
setStrictSpace(configObj.strictSpace, true);
setMode(configObj.mode, true);
setEnableAds(configObj.enableAds, true);
if (config.enableAds != "off") {
Notifications.add(
"Ads are temporairly disabled due to moving to a different ad provider.",
0,
5
);
}
try {
setEnableAds(configObj.enableAds, true);
let addemo = false;
if (
firebase.app().options.projectId === "monkey-type-dev-67af4" ||
window.location.hostname === "localhost"
) {
addemo = true;
}
// try {
// setEnableAds(configObj.enableAds, true);
// if (config.enableAds === "on") {
// $("#ad1").removeClass("hidden");
// $("#ad1")
// .html(`<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
// <!-- Horizontal Ad -->
// <ins class="adsbygoogle"
// style="display:inline-block;width:850px;height:90px"
// data-ad-client="ca-pub-7261919841327810"
// data-ad-slot="2225821478"></ins>`);
// const adsbygoogle = window.adsbygoogle || [];
// adsbygoogle.push({});
// } else if (config.enableAds === "max") {
// $("#ad1").removeClass("hidden");
// $("#ad2").removeClass("hidden");
// $("#ad3").removeClass("hidden");
// $("#ad1").html(`<script
// async
// src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
// ></script>
// <!-- Horizontal Ad -->
// <ins
// class="adsbygoogle"
// style="display: inline-block; width: 1000px; height: 90px"
// data-ad-client="ca-pub-7261919841327810"
// data-ad-slot="2225821478"
// ></ins>`);
// $("#ad2")
// .html(`<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
// <!-- Vertical 1 -->
// <ins class="adsbygoogle"
// style="display:inline-block;width:160px;height:600px"
// data-ad-client="ca-pub-7261919841327810"
// data-ad-slot="6376286644"></ins>`);
// $("#ad3")
// .html(`<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
// <!-- Vertical 2 -->
// <ins class="adsbygoogle"
// style="display:inline-block;width:160px;height:600px"
// data-ad-client="ca-pub-7261919841327810"
// data-ad-slot="1159796595"></ins>`);
// const adsbygoogle = window.adsbygoogle || [];
// adsbygoogle.push({});
// adsbygoogle.push({});
// adsbygoogle.push({});
// } else {
// $("#ad1").remove();
// $("#ad2").remove();
// $("#ad3").remove();
// }
// } catch (e) {
// console.log("error initialising ads " + e.message);
// $("#ad1").remove();
// $("#ad2").remove();
// $("#ad3").remove();
// }
if (config.enableAds === "max" || config.enableAds === "on") {
if (config.enableAds === "max") {
window["nitroAds"].createAd("nitropay_ad_left", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
sizes: [["160", "600"]],
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
mediaQuery: "(min-width: 1330px)",
demo: addemo,
});
$("#nitropay_ad_left").removeClass("hidden");
window["nitroAds"].createAd("nitropay_ad_right", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
sizes: [["160", "600"]],
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
mediaQuery: "(min-width: 1330px)",
demo: addemo,
});
$("#nitropay_ad_right").removeClass("hidden");
} else {
$("#nitropay_ad_left").remove();
$("#nitropay_ad_right").remove();
}
window["nitroAds"].createAd("nitropay_ad_footer", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
sizes: [["970", "90"]],
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
mediaQuery: "(min-width: 1025px)",
demo: addemo,
});
$("#nitropay_ad_footer").removeClass("hidden");
window["nitroAds"].createAd("nitropay_ad_footer2", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
sizes: [["728", "90"]],
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
mediaQuery: "(min-width: 730px) and (max-width: 1024px)",
demo: addemo,
});
$("#nitropay_ad_footer2").removeClass("hidden");
window["nitroAds"].createAd("nitropay_ad_footer3", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
sizes: [["320", "50"]],
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
mediaQuery: "(max-width: 730px)",
demo: addemo,
});
$("#nitropay_ad_footer3").removeClass("hidden");
window["nitroAds"].createAd("nitropay_ad_about", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
demo: addemo,
});
$("#nitropay_ad_about").removeClass("hidden");
window["nitroAds"].createAd("nitropay_ad_settings1", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
demo: addemo,
});
$("#nitropay_ad_settings1").removeClass("hidden");
window["nitroAds"].createAd("nitropay_ad_settings2", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
demo: addemo,
});
$("#nitropay_ad_settings2").removeClass("hidden");
window["nitroAds"].createAd("nitropay_ad_account", {
refreshLimit: 10,
refreshTime: 30,
renderVisibleOnly: false,
refreshVisibleOnly: true,
report: {
enabled: true,
wording: "Report Ad",
position: "bottom-right",
},
demo: addemo,
});
$("#nitropay_ad_account").removeClass("hidden");
} else {
$("#nitropay_ad_left").remove();
$("#nitropay_ad_right").remove();
$("#nitropay_ad_footer").remove();
$("#nitropay_ad_footer2").remove();
$("#nitropay_ad_footer3").remove();
$("#nitropay_ad_settings1").remove();
$("#nitropay_ad_settings2").remove();
$("#nitropay_ad_account").remove();
$("#nitropay_ad_about").remove();
}
} catch (e) {
Notifications.add("Error initialising ads: " + e.message);
console.log("error initialising ads " + e.message);
$("#nitropay_ad_left").remove();
$("#nitropay_ad_right").remove();
$("#nitropay_ad_footer").remove();
$("#nitropay_ad_footer2").remove();
$("#nitropay_ad_footer3").remove();
$("#nitropay_ad_settings1").remove();
$("#nitropay_ad_settings2").remove();
$("#nitropay_ad_account").remove();
$("#nitropay_ad_about").remove();
}
}
updateTestModesNotice();
}

View file

@ -3570,3 +3570,28 @@ key {
display: block;
}
}
#nitropay_ad_left,
#nitropay_ad_right {
margin-top: 1rem;
}
// .adcontainer{
// position: relative;
// &>div{
// top: 0px;
// left: 0px;
// position: absolute;
// }
// .bg{
// background: var(--bg-color);
// color: var(--sub-color);
// display: grid;
// align-items: center;
// justify-content: center;
// height: 100%;
// width: 100%;
// font-size: .75rem;
// user-select: none;
// }
// }

View file

@ -40,6 +40,15 @@
<meta name="twitter:title" content="Monkeytype" />
<meta name="twitter:image" content="https://monkeytype.com/mtsocial.png" />
<meta name="twitter:card" content="summary_large_image" />
<script type="text/javascript">
window["nitroAds"] = window["nitroAds"] || {
createAd: function () {
window.nitroAds.queue.push(["createAd", arguments]);
},
queue: [],
};
</script>
<script async src="https://s.nitropay.com/ads-693.js"></script>
</head>
<body>
@ -832,7 +841,7 @@
<div id="timer"></div>
</div>
<div style="display: flex; justify-content: space-around">
<div id="ad2" class="hidden"></div>
<div id="nitropay_ad_left" class="hidden"></div>
<div id="centerContent" class="hidden">
<div id="top">
<div class="logo">
@ -1446,6 +1455,7 @@
raw wpm and mapped onto a scale from 0 to 100.
</p>
</div>
<div id="nitropay_ad_about" class="hidden"></div>
<div class="section">
<h1>results screen</h1>
<p>
@ -1886,6 +1896,8 @@
<div class="sectionSpacer"></div>
</div>
<div id="nitropay_ad_settings1" class="hidden"></div>
<div id="group_input" class="sectionGroupTitle" group="input">
input
<i class="fas fa-chevron-down"></i>
@ -2710,6 +2722,8 @@
<div class="sectionSpacer"></div>
</div>
<div id="nitropay_ad_settings2" class="hidden"></div>
<div id="group_theme" class="sectionGroupTitle" group="theme">
theme
<i class="fas fa-chevron-down"></i>
@ -3269,6 +3283,9 @@
</div>
</div>
</div>
<div id="nitropay_ad_account" class="hidden"></div>
<div class="group topFilters">
<!-- <div
class="button"
@ -3613,18 +3630,24 @@
</div>
</div>
</div>
<div
id="ad1"
class="hidden"
style="
display: flex;
justify-content: center;
width: 1px;
justify-self: center;
"
></div>
<div class="footerads">
<div
id="nitropay_ad_footer"
style="display: flex; justify-content: center; justify-self: center"
></div>
<div
id="nitropay_ad_footer2"
class="hidden"
style="display: flex; justify-content: center; justify-self: center"
></div>
<div
id="nitropay_ad_footer3"
class="hidden"
style="display: flex; justify-content: center; justify-self: center"
></div>
</div>
</div>
<div id="ad3" class="hidden"></div>
<div id="nitropay_ad_right" class="hidden"></div>
</div>
</body>
<!-- The core Firebase JS SDK is always required and must be listed first -->