-
Notifications
You must be signed in to change notification settings - Fork 31
/
compatibility-homebrew.html
175 lines (170 loc) · 8.77 KB
/
compatibility-homebrew.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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
---
layout: compatibility
texts: compatibility
nav: compat
---
<script>
function get(name) {
if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
angular.module('Vita3K', []).controller("angularController", async function ($scope, $filter, $http) {
$scope.views = []
$scope.views.push([])
$scope.views.push([])
$scope.views.push([])
$scope.views.push([])
$scope.views.push([])
{% include languagescript.js %}
var numberOfPages = 0;
await $http.get("https://github.com/repos/Vita3K/homebrew-compatibility")
.success(function(json) {
var numberOfEntries = json.open_issues_count;
numberOfPages = Math.ceil(numberOfEntries / 100);
});
var pagination = true
var page = 1
while (pagination) {
if (page == numberOfPages) pagination = false
$http.get("https://github.com/repos/Vita3K/homebrew-compatibility/issues?state=open&page=" + page++ + "&per_page=100")
.success(function (data) {
var i = 0,
j = 0
for (i = 0; i < data.length; i++) {
data[i].status = 0
data[i].color = "000000"
for (j = 0; j < data[i].labels.length; j++) {
if (data[i].labels[j].name == "crash") { // Fatal label, breaking recursion
data[i].color = data[i].labels[j].color
data[i].status = 1
break;
} else if (data[i].labels[j].name == "playable") {
if (data[i].status != 0) continue;
data[i].color = data[i].labels[j].color
data[i].status = 4
} else if (data[i].labels[j].name.indexOf("bug") >= 0) {
data[i].color = data[i].labels[j].color
data[i].status = 2
} else if (data[i].labels[j].name == "slow") {
if ((data[i].status != 0) && data[i].status != 4) continue;
data[i].color = data[i].labels[j].color
data[i].status = 3
}
}
if (data[i].status > 0) {
$scope.views[data[i].status].push(data[i])
}
$scope.views[0].push(data[i])
$scope.data = $scope.views[0];
$scope.data = $filter('orderBy')($scope.data, 'title', false);
}
})
.error(function () {
pagination = false;
});
}
$scope.changeView = function (field) {
$scope.data = $scope.views[field]
$scope.data = $filter('orderBy')($scope.data, 'title', false);
}
// Angular filter
$scope.filterEntries = function (val) {
return function (entry) {
if (val == undefined) return true;
return (entry.title.toLowerCase().indexOf(val.toLowerCase() || '') !== -1);
}
}
var game = get("g");
if (game) {
$scope.field = game;
$scope.$apply();
}
})
</script>
{% raw %}
<section class="text-white" id="compatibility">
<div class="container">
<div class="row">
<div class="col-lg-12 mx-auto text-center">
<h2 class="section-heading">{{texts[13]}}</h2>
<hr class="my-4">
{{texts[34]}}
<br><br>
<p class="mb-5">
<input style="display:inline-block;vertical-align:middle;" type="text" ng-model="field" class="form-control" placeholder="{{texts[24]}}..." required="true" />
<br>
<br>{{texts[14]}}:
<a href="#" class="plate" ng-click="changeView(1)" style="background-color: red">{{texts[1]}} ({{views[1].length}})</a>
<a href="#" class="plate" ng-click="changeView(2)" style="background-color: #d93f0b">{{texts[2]}} ({{views[2].length}})</a>
<a href="#" class="plate" ng-click="changeView(3)" style="background-color: #fbca04">{{texts[3]}} ({{views[3].length}})</a>
<a href="#" class="plate" ng-click="changeView(4)" style="background-color: #0e8a16">{{texts[4]}} ({{views[4].length}})</a>
<a href="#" class="plate" ng-click="changeView(0)" style="background-color: blue">{{texts[11]}} ({{views[0].length}})</a>
<center>
<table>
<tr>
<td>
<small><font color=red>{{texts[1]}} ({{((views[1].length/views[0].length)*100).toFixed(2)}}%):</font> <font color=#ffffff>{{texts[15]}}</font></small></td>
<td width="50%">
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" style="width:{{(views[1].length/views[0].length)*100}}%">
</div>
</div>
</td>
</tr>
<tr>
<td>
<small><font color=#d93f0b>{{texts[2]}} ({{((views[2].length/views[0].length)*100).toFixed(2)}}%):</font> <font color=#ffffff>{{texts[16]}}</font></small>
</td>
<td width="50%">
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-warning" style="width:{{(views[2].length/views[0].length)*100}}%">
</div>
</div>
</td>
</tr>
<tr>
<td>
<small><font color=#fbca04>{{texts[3]}} ({{((views[3].length/views[0].length)*100).toFixed(2)}}%):</font> <font color=#ffffff>{{texts[17]}}</font></small>
</td>
<td width="50%">
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-warning" style="width:{{(views[3].length/views[0].length)*100}}%">
</div>
</div>
</td>
</tr>
<tr>
<td>
<small><font color=#0e8a16>{{texts[4]}} ({{((views[4].length/views[0].length)*100).toFixed(2)}}%):</font> <font color=#ffffff>{{texts[18]}}</font></small>
</td>
<td width="50%">
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-success" style="width:{{(views[4].length/views[0].length)*100}}%">
</div>
</div>
</td>
</tr>
</table>
<br>
<br>
<table class="table-hover table-bordered table-striped">
<thead>
<tr>
<td><font color=yellow><small>{{texts[19]}}</small></font></td>
<td><font color=yellow><small>{{texts[20]}}</small></font></td>
</tr>
</thead>
<tbody>
<tr ng-repeat="entry in data | filter: filterEntries(field)">
<td align="left"><a href="{{entry.html_url}}"><small>{{entry.title}}</small></a></td>
<td bgcolor="{{entry.color}}"><font color="white"><small>{{texts[entry.status]}}</small></font></td>
</tr>
</tbody>
</table>
</center>
</p>
</div>
</div>
</div>
</section>
{% endraw %}