GDBrowser/html/api.html
2022-05-19 22:30:54 -04:00

70 lines
2.8 KiB
HTML

<html>
<head>
<title>GD Level Browser API</title>
<meta charset="utf-8">
<link rel="icon" href="../assets/difficulties/auto.png">
<link href="../assets/css/api.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,600,700,800&display=swap" rel="stylesheet">
<meta id="meta-title" property="og:title" content="GDBrowser API">
<meta id="meta-desc" property="og:description" content="It's basically the Geometry Dash API, but not terrible!">
<meta id="meta-image" name="og:image" itemprop="image" content="https://gdbrowser.com/assets/difficulties/auto.png">
<meta name="twitter:card" content="summary">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="background-color: #3979b8">
<div id="intro" class="anchor"></div>
<main>
<div class="main-block">
<h1>Hi there!</h1>
<p>Please don't use this API.</p>
<p>It's slow, unreliable, stressful on my servers, and will likely be removed in the future.</p>
<p>I'm hoping to get this site whitelisted for CORs so that the website will be 100% client side. Probably just wishful thinking but hopefully it can happen in 2.2. In the meantime, check out <a href="https://github.com/Wyliemaster/gddocs/tree/client/docs/endpoints" target="_blank">gddocs</a> to learn how to send requests directly to Rob's servers!</p>
<p>- Colon :</p>
</div>
</main>
</html>
<script>
$('.subdiv').each(function() {
$(this).html($(this).html().replace(/(<p.*>)(.*:) /g, '$1<span class="param">$2</span> '))
})
// smooth scrolling through anchors
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// menu button
document.getElementById('menu-btn').onclick = function(){
document.getElementsByClassName('header-links')[0].classList.toggle('hid');
document.getElementById('menu-btn').classList.toggle('active');
}
for(let i = 0; i < document.getElementsByClassName('header-link').length; i++){
document.getElementsByClassName('header-link')[i].onclick = function(){
document.getElementsByClassName('header-links')[0].classList.toggle('hid');
document.getElementById('menu-btn').classList.toggle('active');
}
}
// revealing
function revealSection(element) {
let el = $(element)
el.slideToggle(100)
let foundFetch = el.find('.fetch:not(.fetched)')
if (foundFetch.length) {
foundFetch.addClass('fetched')
fetch(`..${foundFetch.attr('link')}`).then(res => res.json()).then(res => {
foundFetch.html(JSON.stringify(res, null, 2))
})
}
}
</script>