forked from SirRandoo/itemlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodlist.html
83 lines (70 loc) · 2.58 KB
/
modlist.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
---
title: Mod List
layout: page
permalink: /modlist
---
<link rel="stylesheet" href="{{- 'assets/css/core.css' | relative_url -}} " />
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
<input type="text" class="search" id="modInput" onkeyup="filterTable('mod')"
placeholder="{{- site.data.language.str_mod_search -}}">
<table style="display: table;" class="sortable" id="mod">
<tr>
<th>Mod Name</th>
{%- if site.mods.author -%}
<th style="width: 35%">Author</th>
{%- endif -%}
{%- if site.mods.version -%}
<th style="width: 20%">Version</th>
{%- endif -%}
</tr>
{%- for mod in site.data.modlist -%}
<tr>
<td>
{%- if mod.steamId != "" and mod.steamId != "0" -%}
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id={{- mod.steamId -}}">{{- mod.name -}}</a>
{%- else -%}
<a
href="https://steamcommunity.com/workshop/browse/?appid=294100&searchtext={{- mod.name | url_encode -}}&browsesort=textsearch§ion=home">{{-
mod.name -}}</a>
{%- endif -%}
</td>
{%- if site.mods.author -%}
<td>{{- mod.author -}}</td>
{%- endif -%}
{%- if site.mods.version -%}
<td>{{- mod.version -}}</td>
{%- endif -%}
</tr>
{%- endfor -%}
</table>
<script>
function filterTable(category) {
var input, filter, table, tr, td, i, textValue, column;
input = document.getElementById(category + "Input")
filter = input.value.toUpperCase();
table = document.getElementById(category);
tr = table.getElementsByTagName("tr");
column = 0;
if (category == "mod") {
if (filter.startsWith("AUTHOR:")) {
filter = filter.substring("AUTHOR".length + 1).trimLeft();
column = 1;
}
if (filter.startsWith("NAME:")) {
filter = filter.substring("NAME".length + 1).trimLeft();
column = 0;
}
}
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[column];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>