1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00

does this work

This commit is contained in:
zumbiepig 2024-08-21 18:21:09 -07:00
parent e391b54810
commit e0c4d471c6
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE
4 changed files with 35 additions and 6 deletions

View File

@ -11,6 +11,9 @@
<script src="/resources/scripts/main.js"></script> <script src="/resources/scripts/main.js"></script>
</head> </head>
<body> <body>
<div class="ads-container">
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1132419379737567" data-ad-slot="3280170072" data-ad-format="auto" data-full-width-responsive="true"></ins>
</div>
<div class="launcher"> <div class="launcher">
<div class="title-bar"> <div class="title-bar">
<span>MineXLauncher 1.5</span> <span>MineXLauncher 1.5</span>
@ -116,5 +119,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="ads-container">
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1132419379737567" data-ad-slot="3280170072" data-ad-format="auto" data-full-width-responsive="true"></ins>
</div>
<script>
if (storage.local.get('showAds') !== false) {
(adsbygoogle = window.adsbygoogle || []).push({});
}
</script>
</body> </body>
</html> </html>

View File

@ -11,6 +11,15 @@ body {
overflow: hidden; overflow: hidden;
background-image: none; background-image: none;
background-size: cover; background-size: cover;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.ads-container {
display: none;
} }
.launcher { .launcher {

View File

@ -327,11 +327,20 @@ if (window.location.pathname === '/') {
serviceworker.register('/sw.js'); serviceworker.register('/sw.js');
} else { } else {
if (storage.local.get('showAds') !== false) { if (storage.local.get('showAds') !== false) {
const adsense = document.createElement('script'); const googleAdsScript = document.createElement('script');
adsense.async = true; googleAdsScript.async = true;
adsense.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1132419379737567'; googleAdsScript.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1132419379737567';
adsense.crossOrigin = 'anonymous'; googleAdsScript.crossOrigin = 'anonymous';
document.head.appendChild(adsense); document.head.appendChild(googleAdsScript);
document.addEventListener('DOMContentLoaded', () => {
const adsContainers = document.getElementsByClassName('ads-container');
for (let i = 0; i < adsContainers.length; i++) {
const adsContainer = adsContainers[i] as HTMLElement;
adsContainer.style.display = 'block';
}
});
} }
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {

View File

@ -9,7 +9,7 @@ if (window.location.pathname === '/settings/') {
usernameInput.placeholder = storage.local.get('username') ?? ''; usernameInput.placeholder = storage.local.get('username') ?? '';
themeSelect.value = storage.local.get('theme') ?? ''; themeSelect.value = storage.local.get('theme') ?? '';
// offlineCheckbox.checked = storage.local.get('offlineCache') ?? false; // offlineCheckbox.checked = storage.local.get('offlineCache') ?? false;
adsCheckbox.checked = storage.local.get('showAds'); adsCheckbox.checked = storage.local.get('showAds') !== false;
usernameInput.addEventListener('input', () => { usernameInput.addEventListener('input', () => {
let username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16); let username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16);