-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlibraries.js
More file actions
192 lines (161 loc) · 6.04 KB
/
libraries.js
File metadata and controls
192 lines (161 loc) · 6.04 KB
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
$.ajaxSetup({ async: false })
// variables <<<
var Data = []
// var Categories = []
var DDMSelection = "ddmall" // DropDownMenu initialization
var Unknown = '<span title="Unknown" class="grey"><span class="glyphicon glyphicon-minus"></span></span>'
var Supported = '<span title="Supported" class="green"><span class="glyphicon glyphicon-ok"></span></span>'
var NotSupported = '<span title="Not supported "class="red"><span class="glyphicon glyphicon-remove"></span></span>'
var Active = '<span title="Active" class="glyphicon glyphicon-heart"></span>'
var Dead = '<span title="Unmaintained" class="glyphicon glyphicon-flag"></span>'
var HelpNeeded = '<span title="Help needed" class="glyphicon glyphicon-plus"></span>'
var NewMaintainer = '<span title="New maintainer" class="glyphicon glyphicon-user"></span>'
// >>>
function fillTable() // <<<
{
var tbody = document.getElementsByTagName('tbody')[0]
$("#databody").empty()
for(var i=0; i < Data.length; i++)
{
if(DDMSelection == "ddmout") { if(Data[i].lua["54"] == true){continue} }
else if(DDMSelection == "ddmlua54") { if(Data[i].lua["54"] == false){continue} }
else if(DDMSelection == "ddmlua53") { if(Data[i].lua["53"] == false){continue} }
else if(DDMSelection == "ddmlua52") { if(Data[i].lua["52"] == false){continue} }
else if(DDMSelection == "ddmlua51") { if(Data[i].lua["51"] == false){continue} }
else if(DDMSelection == "ddmactive") { if(Data[i].status.active == false){continue} }
else if(DDMSelection == "ddmdead") { if(Data[i].status.active == true){continue} }
else if(DDMSelection == "ddmhelp") { if(Data[i].status.help == false){continue} }
else if(DDMSelection == "ddmnew") { if(Data[i].status.maintainer == false){continue} }
// Add maintainance status
var modstatus = (Data[i].status.active ? Active : Dead )
+ (Data[i].status.help ? HelpNeeded : '' )
+ (Data[i].status.maintainer ? NewMaintainer : '')
// Adds support to Lua versions
var modluaver = '';
for (let ver=51; ver<=54; ver++) {
let info = Data[i].lua[ver.toString(10)]
let support = info ? Supported : ( info == false ? NotSupported : Unknown )
modluaver += `<td luaver="${ver.toString(10).replace(/^(.)/,"$1.")}">${support}</td>`
}
var tr = tbody.insertRow(-1)
tr.innerHTML += `<td><a href="${Data[i].link}" target="_blank">${Data[i].name}</a></td>`
tr.innerHTML += `<td>${Data[i].description}</td>`
tr.innerHTML += `<td title="status">${modstatus}</td>${modluaver}`
}
} // >>>
function loadData() // <<<
{
$.getJSON("data.json?_=" + new Date().getTime(), function(JSON_Data)
{
for(let Filename of JSON_Data)
{
$.getJSON(Filename + "?_=" + new Date().getTime(), function(Item)
{
Data[Data.length] = Item
})
}
})
fillTable()
} // >>>
function filterTable() // <<<
{
var input, filter, table, tr, tdproj, tddesc, i, project, description;
input = document.getElementById("searchbox");
filter = input.value.toUpperCase();
table = document.getElementsByClassName("data")[0];
tr = table.getElementsByTagName("tr");
for(i = 0; i < tr.length; i++)
{
tdproj = tr[i].getElementsByTagName("td")[0];
tddesc = tr[i].getElementsByTagName("td")[1];
if(tdproj)
{
project = tdproj.textContent // || tdproj.innerText;
description = tddesc.textContent // || tddesc.innerText;
if((project.toUpperCase().indexOf(filter) > -1) || (description.toUpperCase().indexOf(filter) > -1))
{
tr[i].style.display = "";
}
else
{
tr[i].style.display = "none";
}
}
}
} // >>>
$(document).ready(function() // <<<
{
loadData()
$('.dropdown').click(function()
{
$(this).attr('tabindex', 1).focus();
$(this).toggleClass('active');
$(this).find('.dropdown-menu').slideToggle(300);
});
$('.dropdown').focusout(function()
{
$(this).removeClass('active');
$(this).find('.dropdown-menu').slideUp(300);
});
$('.dropdown .dropdown-menu li').click(function()
{
$(this).parents('.dropdown').find('span').text($(this).text());
$(this).parents('.dropdown').find('input').attr('value', $(this).attr('id'));
});
$('.dropdown-menu li').click(function()
{
DDMSelection = $(this).parents('.dropdown').find('input').val()
fillTable()
});
}) // >>>
$(document).ready(function() // <<<
{
// $(".fldhead").click(function()
// {
// $(this)
// .nextUntil("tr.fldhead")
// .toggle();
//
// if($(this).next("tr").is(":hidden"))
// {
// $('span:first', this).replaceWith('<span class="glyphicon glyphicon-plus-sign"></span>');
// }
// else
// {
// $('span:first', this).replaceWith('<span class="glyphicon glyphicon-minus-sign"></span>');
// }
//
// });
//
// init()
$('.graph-bar').each(function()
{
var dataWidth = $(this).data('value');
$(this).css("width", dataWidth + "%");
});
}) // >>>
// $(document).keydown(function(k) // <<<
// {
// if(k.which == 67) #<{(| c |)}>#
// {
// $('.fldhead').each(function()
// {
// $('span:first', this).replaceWith('<span class="glyphicon glyphicon-plus-sign"></span>');
// $(this)
// .nextUntil("tr.fldhead")
// .hide();
// });
// }
//
// if(k.which == 69) #<{(| e |)}>#
// {
// $('.fldhead').each(function()
// {
// $('span:first', this).replaceWith('<span class="glyphicon glyphicon-minus-sign"></span>');
// $(this)
// .nextUntil("tr.fldhead")
// .show();
// });
// }
// }); // >>>
// vim: fmr=<<<,>>> fdm=marker sts=3 ts=3 sw=3