-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.html
40 lines (36 loc) · 1.39 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>REDCap Dynamic Content</title>
</head>
<body>
<div id="content">Loading content...</div>
<script>
// Function to get URL parameters
function getQueryParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
// Get the version parameter from the URL
const versionTag = getQueryParam('version') || 'main'; // Defaults to 'main' if no version is provided
// Construct the URL to fetch content from the specified branch
const githubUrl = `https://raw.githubusercontent.com/4bbakers/redcap_rsvc/${versionTag}/content.html`;
// Fetch content from the URL and display it in the 'content' div
fetch(githubUrl)
.then(response => {
if (!response.ok) {
throw new Error(`Content not found for version ${versionTag}.`);
}
return response.text();
})
.then(data => {
document.getElementById('content').innerHTML = data;
})
.catch(error => {
document.getElementById('content').innerHTML = `<p>Error: ${error.message}</p>`;
});
</script>
</body>
</html>