-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
92 lines (75 loc) · 3.34 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
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Config Schema</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" href="assets/styles.css">
<link rel="stylesheet" href="assets/highlightjs-default.css">
<link href="https://fonts.googleapis.com/css?family=Cutive+Mono|Montserrat" rel="stylesheet">
<script src="libs/code-highlight/highlight.js"></script>
</head>
<body>
<div id="schema-body"></div>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Schema JSON Sample</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="index.js"></script>
<script>
function toggle(elem) {
elem = $(elem);
const nextElem = elem.siblings('ul').find('> li, li > ul.array > li');
const displayType = nextElem.css('display') === 'none' ? 'block' : 'none';
nextElem.css('display', displayType);
if (displayType === 'block') {
elem.children('div.svg').first().addClass('open');
} else {
elem.children('div.svg').first().removeClass('open');
}
}
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
const a = new Schema();
a.load(`https://raw.githubusercontent.com/fgpv-vpgf/fgpv-vpgf/${getParameterByName('v') || 'develop'}/schema.json`).then(() => {
a.render().then(html => {
$('#schema-body').html(html);
hljs.initHighlightingOnLoad();
$('div#schema-body > ul > li.object').css('display', 'block');
});
});
$('#exampleModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
var htmlExample = button.data('example');
var modal = $(this);
modal.find('.modal-body').html(htmlExample);
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
</script>
</body>
</html>