-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
64 lines (60 loc) · 2.17 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
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.1/swagger-ui.min.css">
<title>abfallnavi - OpenAPI Documentation</title>
<body>
<div><small><a href="index.html">[DE]</a><a id="en" href="#">/[EN]</a></small></div>
<div id="openapi">
<script src="//cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.1/swagger-ui-bundle.min.js"></script>
<script>
var xhr = new XMLHttpRequest();
xhr.open('HEAD', "openapi_en.yaml", true);
xhr.onreadystatechange = function(){
if (xhr.readyState === 4){
if (xhr.status === 404) {
document.getElementById('en').remove();
}
}
};
xhr.send();
if (document.getElementById('en') !== null)
document.getElementById('en').onclick = function() {
const ui = SwaggerUIBundle({
url: "openapi_en.yaml",
dom_id: "#openapi",
requestInterceptor: function(req) {
var mapping = {
// add mapping here
}
if(this.url !== "openapi_en.yaml") {
var url = new URL(req.url);
url.hostname = mapping[url.hostname];
req.url = url.href;
}
return req;
},
})
};
window.onload = function () {
const ui = SwaggerUIBundle({
url: "openapi.yaml",
dom_id: "#openapi",
requestInterceptor: function(req) {
var mapping = {
// add mapping here
}
if(this.url !== "openapi.yaml") {
var url = new URL(req.url);
url.hostname = mapping[url.hostname];
req.url = url.href;
}
return req;
},
})
}
</script>
</body>
</html>