commit: deb0f7f770e2020b1d69003a88c4d8bf535f9ef5
parent: 151e4a0d8654c7013e6252b99341c9b250fbfd5b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 17 May 2018 06:59:34 +0200
sorttable: Add assets
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/sorttable/sorttable.css b/sorttable/sorttable.css
@@ -0,0 +1,13 @@
+table.sortable th.made_sortable {
+ cursor: pointer;
+}
+table.sortable th.made_sortable:not(.sorttable_sorted):not(.sorttable_sorted_reverse):not(.sorttable_nosort)::after {
+ content: "⭥";
+ opacity: 0.5;
+}
+table.sortable th.made_sortable.sorttable_sorted:not(.sorttable_sorted_reverse):not(.sorttable_nosort)::after {
+ content: "⭣";
+}
+table.sortable th.made_sortable.sorttable_sorted_reverse:not(.sorttable_sorted):not(.sorttable_nosort)::after {
+ content: "⭡";
+}
diff --git a/sorttable/sorttable.min.js b/sorttable/sorttable.min.js
@@ -0,0 +1 @@
+sorttable={done:!1,init:function(){if(!sorttable.done){sorttable.done=!0;var r=document.getElementsByClassName("sortable");Array.prototype.filter.call(r,function(r){"TABLE"==r.nodeName&&sorttable.t(r)})}},t:function(r){if(1==r.tHead.rows.length){headrow=r.tHead.rows[0].cells;for(var t=0;t<headrow.length;t++)headrow[t].classList.contains("sorttable_nosort")||(headrow[t].o=t,headrow[t].s=r.tBodies[0],headrow[t].addEventListener("click",sorttable.l),headrow[t].classList.add("made_sortable"))}},l:function(r){if(this.classList.contains("sorttable_sorted"))sorttable.reverse(this.s),this.classList.replace("sorttable_sorted","sorttable_sorted_reverse");else if(this.classList.contains("sorttable_sorted_reverse"))sorttable.reverse(this.s),this.classList.replace("sorttable_sorted_reverse","sorttable_sorted");else{theadRow=this.parentNode,theadRow.childNodes.forEach(function(r){r.classList.remove("sorttable_sorted_reverse","sorttable_sorted")}),row_array=[],col=this.o,rows=this.s.rows;for(var t=0;t<rows.length;t++)row_array[row_array.length]=[sorttable.i(rows[t].cells[col]),rows[t]];row_array.sort().reverse(),tb=this.s,row_array.forEach(function(r){tb.appendChild(r[1])}),delete row_array,this.classList.add("sorttable_sorted")}},i:function(r){return r.dataset.value?r.dataset.value:r.innerText},reverse:function(r){newrows=[];for(var t=0;t<r.rows.length;t++)newrows[newrows.length]=r.rows[t];for(t=newrows.length-1;0<=t;t--)r.appendChild(newrows[t]);delete newrows}},sorttable.init();+
\ No newline at end of file