-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
84 lines (76 loc) · 1.81 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html>
<head>
<title>Include Code Quality for Bitbucket API Specification</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
padding-top: 40px;
}
nav {
position: fixed;
top: 0;
width: 100%;
z-index: 100;
}
#links_container {
margin: 0;
padding: 0;
background-color: #7E4A95;
}
/*prevent distracting download spec button*/
.download-openapi {
display: none !important;
}
#links_container li {
display: inline-block;
padding: 10px;
color: white;
cursor: pointer;
font-family: Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<!-- Top navigation placeholder -->
<nav>
<ul id="links_container">
</ul>
</nav>
<redoc scroll-y-offset="body > nav"></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js"> </script>
<script>
// list of APIS
const apis = [
{
name: 'Include Code Quality for Bitbucket 6.x',
url: './openapi_sonar_6.x.yaml'
},
{
name: 'Include Code Quality for Bitbucket 5.x',
url: './openapi_sonar_5.x.yaml'
},
];
// initially render first API
Redoc.init(apis[0].url, {
hideDownloadButton: true
});
function onClick() {
var url = this.getAttribute('data-link');
Redoc.init(url, {
hideDownloadButton: true
});
}
// dynamically building navigation items
const $list = document.getElementById('links_container');
apis.forEach(function(api) {
const $listitem = document.createElement('li');
$listitem.setAttribute('data-link', api.url);
$listitem.innerText = api.name;
$listitem.addEventListener('click', onClick);
$list.appendChild($listitem);
});
</script>
</body>
</html>