added/changed around a few scripts

This commit is contained in:
awex 3
2022-04-30 19:58:41 -04:00
parent 35c57dcc8d
commit 723686dc90
3 changed files with 21 additions and 23 deletions
+2 -1
View File
@@ -12,7 +12,7 @@
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body onload="setClip()">
<body>
<div class="welcome"></div>
<div id="querydiv"></div>
@@ -54,6 +54,7 @@
<script src="https://thatalex.dev/static/js/paramSearch.js"></script>
<script src="https://thatalex.dev/static/js/spotifyWidget.js"></script>
<script src="https://thatalex.dev/static/js/medalClip.js"></script>
<script>
if (document.readyState === 'interactive' || document.readyState === 'complete') {
+11
View File
@@ -0,0 +1,11 @@
const clipSpan = document.getElementById("clip");
fetch("https://developers.medal.tv/v1/latest?userId=215577&limit=1", {
method: "GET",
headers: {
"authorization": "pub_ecEyOlY5G2u9476DMGOxcxiNcaOTEjmq",
"Content-Type": "application/json"
}
}).then(async function(response) {
const data = await response.json();
clipSpan.innerHTML = `${data.contentObjects[0].embedIframeCode}<br>${data.contentObjects[0].contentTitle}`;
});
+5 -19
View File
@@ -1,24 +1,10 @@
async function paramSearch() {
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
const div = document.getElementById("querydiv");
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
const div = document.getElementById("querydiv");
if (params.reason) {
console.log(params)
if (params.reason) {
if (params.reason == "old_domain") {
div.innerHTML = '<p style="color:red;">You have been redirected here from an old domain. Please use this domain.</p>';
}
}
const clipSpan = document.getElementById("clip");
const response = await fetch("https://developers.medal.tv/v1/latest?userId=215577&limit=1", {
method: "GET",
headers: {
"authorization": "pub_ecEyOlY5G2u9476DMGOxcxiNcaOTEjmq",
"Content-Type": "application/json"
}
});
const data = await response.json();
clipSpan.innerHTML = `${data.contentObjects[0].embedIframeCode}<br>${data.contentObjects[0].contentTitle}`;
}
window.onload = paramSearch();