-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathabout.hbs
127 lines (116 loc) · 3.27 KB
/
about.hbs
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<html>
<head>
<style>
@media (prefers-color-scheme: dark) {
body {
background: #333;
color: white;
}
a {
color: skyblue;
}
}
html {
font-family: sans-serif;
margin: 0;
}
.intro {
text-align: center;
}
.license-id {
display: none;
}
.license-tabbed-container {
display: flex;
flex-direction: row;
margin-top: 8px;
}
.license-list {
min-width: 250px;
min-height: 500px;
overflow-x: auto;
background: #eee;
margin-right: 24px;
}
.license-list-item {
white-space: nowrap;
cursor: pointer;
color: inherit;
text-decoration: none;
}
.license-list-item:hover {
background: #ddd;
}
.license-list-item.selected {
background: #ccc;
}
.license-list-item, .license {
display: none;
}
.license-used-by {
margin-top: -10px;
}
.license-text {
white-space: pre-wrap;
}
</style>
</head>
<body>
<div class="intro">
<h1>Third Party Licenses</h1>
</div>
<div class="licenses-overview">
{{#each overview}}
<div><a href="javascript:filter_licenses('{{id}}')">{{name}}</a> ({{count}})</div>
{{/each}}
</div>
<div class="license-tabbed-container">
<div class="license-list">
{{#each licenses}}
{{#each used_by}}
<a href="javascript:" class="license-list-item {{../id}}" onclick="javascript:view_license(this, '{{crate.name}}')">
{{crate.name}}
</a>
{{/each}}
{{/each}}
</div>
{{#each licenses}}
{{#each used_by}}
<div class="license" id="{{crate.name}}">
<h3>
{{crate.name}} {{crate.version}}<br />
<a href="{{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}}">
(project link)
</a>
</h3>
<pre class="license-text">{{../text}}</pre>
</div>
{{/each}}
{{/each}}
</div>
</body>
<script>
let current_license = null;
let current_filter = null;
function view_license(button, id) {
if (current_license) {
document.getElementById(current_license.id).style.display = null;
current_license.button.classList.remove("selected");
}
document.getElementById(id).style.display = "block";
button.classList.add("selected");
current_license = { button, id };
}
function filter_licenses(id) {
if (current_filter) {
for (const element of document.querySelectorAll(current_filter)) {
element.style.display = null;
}
}
current_filter = '.' + id.replace('.', '\\.');
for (const element of document.querySelectorAll(current_filter)) {
element.style.display = "block";
}
}
</script>
</html>