More ads test

This commit is contained in:
Jai A
2024-11-03 20:35:04 -07:00
parent 7d614f7ac5
commit db145cd8ad
2 changed files with 118 additions and 177 deletions

View File

@@ -1,6 +1,6 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Modrinth App Ad</title> <title>Modrinth App Ad</title>
@@ -42,23 +42,13 @@
z-index: 2; z-index: 2;
} }
</style> </style>
</head> </head>
<body> <body>
<div class="ads-container"> <div class="ads-container">
<div id="plus-link"></div> <div id="plus-link"></div>
<div id="modrinth-rail-1"></div> <div id="modrinth-rail-1"></div>
</div> </div>
<script> <script>
function getCookie(name) {
function escape(s) {
return s.replace(/([.*+?\^$(){}|\[\]\/\\])/g, "\\$1");
}
const match = document.cookie.match(RegExp("(?:^|;\\s*)" + escape(name) + "=([^;]*)"));
return match ? match[1] : null;
}
function initAds(personalized) {
window.tude = window.tude || { cmd: [] }; window.tude = window.tude || { cmd: [] };
window.Raven = window.Raven || { cmd: [] }; window.Raven = window.Raven || { cmd: [] };
@@ -79,26 +69,7 @@
}, },
}, },
]); ]);
tude.setPrivacySettings({
personalizedAds: personalized ?? true,
}); });
});
}
try {
if (window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__
.invoke("plugin:ads|get_ads_personalization", {})
.then(initAds)
.catch(() => initAds(true));
} else {
initAds(true);
}
} catch (err) {
initAds(true);
console.error(err);
}
window.addEventListener( window.addEventListener(
"message", "message",
@@ -135,6 +106,6 @@
origin: "https://modrinth.com", origin: "https://modrinth.com",
}); });
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@@ -50,16 +50,6 @@
<div id="modrinth-rail-1"></div> <div id="modrinth-rail-1"></div>
</div> </div>
<script> <script>
function getCookie(name) {
function escape(s) {
return s.replace(/([.*+?\^$(){}|\[\]\/\\])/g, "\\$1");
}
const match = document.cookie.match(RegExp("(?:^|;\\s*)" + escape(name) + "=([^;]*)"));
return match ? match[1] : null;
}
function initAds(personalized) {
window.tude = window.tude || { cmd: [] }; window.tude = window.tude || { cmd: [] };
window.Raven = window.Raven || { cmd: [] }; window.Raven = window.Raven || { cmd: [] };
@@ -80,27 +70,7 @@
}, },
}, },
]); ]);
tude.setPrivacySettings({
personalizedAds: personalized ?? true,
}); });
});
}
try {
if (window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__
.invoke("plugin:ads|get_ads_personalization", {})
.then(initAds)
.catch(() => initAds(true));
} else {
initAds(true);
}
} catch (err) {
initAds(true);
console.error(err);
}
window.addEventListener( window.addEventListener(
"message", "message",
(event) => { (event) => {