-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.html
108 lines (98 loc) · 4.32 KB
/
test.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
<html><head><script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://kit.fontawesome.com/198c1100f0.js" crossorigin="anonymous"></script>
<style>
body {background-color: powderblue;}
<!-- custom styling for all icons -->
i.fas,
i.fab {
border: 1px solid red;
}
<!-- custom styling for specific icons -->
.fa-fish {
color: salmon;
}
.fa-frog {
color: green;
}
</style>
</head><body><script>
/*
A simple, lightweight jQuery plugin for creating sortable tables.
https://github.com/kylefox/jquery-tablesort
Version 0.0.11
*/
!function(t){t.tablesort=function(e,s){var i=this;this.$table=e,this.$thead=this.$table.find("thead"),this.settings=t.extend({},t.tablesort.defaults,s),this.$sortCells=this.$thead.length>0?this.$thead.find("th:not(.no-sort)"):this.$table.find("th:not(.no-sort)"),this.$sortCells.on("click.tablesort",function(){i.sort(t(this))}),this.index=null,this.$th=null,this.direction=null},t.tablesort.prototype={sort:function(e,s){var i=new Date,n=this,o=this.$table,l=o.find("tbody").length>0?o.find("tbody"):o,a=l.find("tr").has("td, th"),r=a.find(":nth-child("+(e.index()+1)+")").filter("td, th"),d=e.data().sortBy,h=[],c=r.map(function(s,i){return d?"function"==typeof d?d(t(e),t(i),n):d:null!=t(this).data().sortValue?t(this).data().sortValue:t(this).text()});0!==c.length&&(this.index!==e.index()?(this.direction="asc",this.index=e.index()):"asc"!==s&&"desc"!==s?this.direction="asc"===this.direction?"desc":"asc":this.direction=s,s="asc"==this.direction?1:-1,n.$table.trigger("tablesort:start",[n]),n.log("Sorting by "+this.index+" "+this.direction),n.$table.css("display"),setTimeout(function(){n.$sortCells.removeClass(n.settings.asc+" "+n.settings.desc);for(var o=0,d=c.length;o<d;o++)h.push({index:o,cell:r[o],row:a[o],value:c[o]});h.sort(function(t,e){return n.settings.compare(t.value,e.value)*s}),t.each(h,function(t,e){l.append(e.row)}),e.addClass(n.settings[n.direction]),n.log("Sort finished in "+((new Date).getTime()-i.getTime())+"ms"),n.$table.trigger("tablesort:complete",[n]),n.$table.css("display")},c.length>2e3?200:10))},log:function(e){(t.tablesort.DEBUG||this.settings.debug)&&console&&console.log&&console.log("[tablesort] "+e)},destroy:function(){return this.$sortCells.off("click.tablesort"),this.$table.data("tablesort",null),null}},t.tablesort.DEBUG=!1,t.tablesort.defaults={debug:t.tablesort.DEBUG,asc:"sorted ascending",desc:"sorted descending",compare:function(t,e){return t>e?1:t<e?-1:0}},t.fn.tablesort=function(e){var s,i;return this.each(function(){s=t(this),i=s.data("tablesort"),i&&i.destroy(),s.data("tablesort",new t.tablesort(s,e))})}}(window.Zepto||window.jQuery);
$( document ).ready(function() {
$('table').tablesort();
});
</script>
<table>
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="Makefile">Makefile</a></td>
<td>230247-01-08 22:20:19 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="Makefile~">Makefile~</a></td>
<td>230228-12-08 22:20:129 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="README.md">README.md</a></td>
<td>23028-11-08 22:20:119 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-folder-open"></i></td>
<td><a href="assets/">assets/</a></td>
<td>230241-12-08 22:20:129 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="assets.go">assets.go</a></td>
<td>230243-01-08 22:20:19 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-folder-open"></i></td>
<td><a href="ext/">ext/</a></td>
<td>23024-12-08 22:20:129 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="go.mod">go.mod</a></td>
<td>230228-12-08 22:20:129 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="go.mod~">go.mod~</a></td>
<td>230231-12-08 22:20:129 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="go.sum">go.sum</a></td>
<td>23025-12-08 22:20:129 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="index.htmlx">index.htmlx</a></td>
<td>230243-01-08 22:20:19 -0800 PST</td>
</tr>
<tr>
<td> <i class="fas fa-file-alt"></i></td>
<td><a href="main.go">main.go</a></td>
<td>230218-01-08 22:20:19 -0800 PST</td>
</tr>
<tr>
<td></td>
...
</tr>
</tbody>
</table></body></html>