logo

demo

Unnamed repository; edit this file 'description' to name the repository.
commit: f6ec4bafca35cab7f1ad5228b1a4b49e717b0fc0
parent: 2584507fdbbd2a5de65dcf5beac66d2882c9d25c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 13 Apr 2019 18:44:54 +0200

sorttable/sorttable.min.js: Remove non-automatised *.min.js

Diffstat:

Msorttable/index.html5++---
Dsorttable/sorttable.min.js2--
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/sorttable/index.html b/sorttable/index.html @@ -21,12 +21,11 @@ I am trash main() <h2>Sources</h2> <ul> <li><a href="sorttable.js">sorttable.js</a> (3397B, 1412B gzip’ed)</li> - <li><a href="sorttable.min.js">sorttable.min.js</a> (1491B, 613B gzip’ed)</li> <li><a href="sorttable.css">sorttable.css</a> (468B)</li> </ul> <h2>Usage</h2> <ol> - <li>Add <code>&lt;script src="sorttable.js"&gt;&lt;/script&gt;</code> (or <code>sorttable.min.js</code>) at the end of your <abbr title="HyperText Markup Language">HTML</abbr> pages</li> + <li>Add <code>&lt;script src="sorttable.js"&gt;&lt;/script&gt;</code> at the end of your <abbr title="HyperText Markup Language">HTML</abbr> pages</li> <li>Add <code>&lt;link rel="stylesheet" href="sorttable.css"/&gt;</code> to the <code>head</code> of your <abbr title="HyperText Markup Language">HTML</abbr> pages</li> <li>Tag the <code>table</code>s that you want to be sorted with a <code>class="sortable"</code></li> </ol> @@ -55,7 +54,7 @@ I am trash main() <tr><td><a href="sorttable.css">sorttable.css</a></td><td data-value="0468">468</td><td data-value="0170">170</td></tr> </tbody> </table> - <script src="sorttable.min.js"></script> + <script src="sorttable.js"></script> </main> <footer>Copyright 2018 Haelwenn (lanodan) Monnier. Distributed under the <a href="http://creativecommons.org/licenses/by/4.0/">CC-BY 4.0 License</a>. Obviously, this demoset agrees that <a href="http://simpleweb.iscute.ovh/">simple web is cute</a>.</footer> </body> diff --git a/sorttable/sorttable.min.js b/sorttable/sorttable.min.js @@ -1 +0,0 @@ -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