forked from SirRandoo/itemlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.html
111 lines (93 loc) · 3.41 KB
/
commands.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
---
layout: page
title: Commands
permalink: /commands
---
<link rel="stylesheet" href="{{- 'assets/css/core.css' | relative_url -}} " />
{%- assign showCommands = site.data.commands.size -%}
{%- assign buy = "" -%}
{%- assign commands_sorted = site.data.commands | sort: "name" -%}
{%- for command in commands_sorted -%}
{%- if command.name == "Buy" -%}
{%- capture buy -%}
{{- command.usage | split: " " | first -}}
{%- endcapture -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- if showCommands > 0 -%}
<input type="text" class="search" id="commandsInput" onkeyup="filterTable('commands')"
placeholder="{{- site.data.language.str_commands_search -}}">
<table style="display: table" class="sortable" id="commands">
<tr>
<th style="width: 35%">Command</th>
{%- if site.commands.userlevel -%}
<th style="width: 18%">User Level</th>
{%- endif -%}
<th>Description</th>
</tr>
{%- for command in commands_sorted -%}
<tr>
<td id="{{- command.name | slugify -}}">
<a href="#{{- command.name | slugify -}}">{{- command.name -}}</a>
{%- if site.commands.usage -%}
<span class="metadata">
<br />
{{- site.data.language.str_usage -}}: {{- command.usage | prepend: " " | replace: "(", "<" |
replace: ")", ">" -}}
</span>
{%- endif -%}
</td>
{%- if site.commands.userlevel -%}
<td>{{- command.userLevel -}}</td>
{%- endif -%}
<td>
{{- command.description -}}
{%- if site.commands.shortcut and command.shortcut -%}
<br />
<span class="metadata">
{{- site.data.language.str_shortcut -}} {{- buy -}}
{%- capture prefix -%}
{{- command.usage | slice: 0 -}}
{%- endcapture -%}
{{- command.usage | remove_first: prefix | prepend: " " | replace: "(", "<" | replace: ")", ">"
-}}
</span>
{%- endif -%}
</td>
</tr>
{%- endfor -%}
</table>
{%- else -%}
<p align="center">{{- site.data.languages.str_no_commands -}}</p>
{%- endif -%}
<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 (filter.startsWith("LEVEL:")) {
filter = filter.substring("LEVEL".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>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>