Registration and fuzzy search in progress

This commit is contained in:
Claude Brisson
2023-12-15 13:45:23 +01:00
parent 519eca8af3
commit ea44f6068e
26 changed files with 708 additions and 102 deletions

View File

@@ -0,0 +1,6 @@
/*!
* tablesort v5.4.0 (2023-05-04)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2023 ; Licensed MIT
*/
!function(){function r(e){return e=(e=e.replace(/\-/g,"/")).replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2,4})/,"$3-$2-$1"),new Date(e).getTime()||-1}Tablesort.extend("date",function(e){return(-1!==e.search(/(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\.?\,?\s*/i)||-1!==e.search(/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/)||-1!==e.search(/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i))&&!isNaN(r(e))},function(e,n){return e=e.toLowerCase(),n=n.toLowerCase(),r(n)-r(e)})}();

View File

@@ -0,0 +1,6 @@
/*!
* tablesort v5.4.0 (2023-05-04)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2023 ; Licensed MIT
*/
Tablesort.extend("dotsep",function(t){return/^(\d+\.)+\d+$/.test(t)},function(t,r){t=t.split("."),r=r.split(".");for(var e,n,i=0,s=t.length;i<s;i++)if((e=parseInt(t[i],10))!==(n=parseInt(r[i],10))){if(n<e)return-1;if(e<n)return 1}return 0});

View File

@@ -0,0 +1,6 @@
/*!
* tablesort v5.4.0 (2023-05-04)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2023 ; Licensed MIT
*/
!function(){function r(t){return t=t.match(/^(\d+(\.\d+)?) ?((K|M|G|T|P|E|Z|Y|B$)i?B?)$/i),parseFloat(t[1].replace(/[^\-?0-9.]/g,""))*function(t){var e="i"===(t=t.toLowerCase())[1]?1024:1e3;switch(t[0]){case"k":return Math.pow(e,2);case"m":return Math.pow(e,3);case"g":return Math.pow(e,4);case"t":return Math.pow(e,5);case"p":return Math.pow(e,6);case"e":return Math.pow(e,7);case"z":return Math.pow(e,8);case"y":return Math.pow(e,9);default:return e}}(t[3])}Tablesort.extend("filesize",function(t){return/^\d+(\.\d+)? ?(K|M|G|T|P|E|Z|Y|B$)i?B?$/i.test(t)},function(t,e){return t=r(t),e=r(e),e=e,t=t,e=parseFloat(e),t=parseFloat(t),(e=isNaN(e)?0:e)-(t=isNaN(t)?0:t)})}();

View File

@@ -0,0 +1,6 @@
/*!
* tablesort v5.4.0 (2023-05-04)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2023 ; Licensed MIT
*/
Tablesort.extend("monthname",function(e){return-1!==e.search(/(January|February|March|April|May|June|July|August|September|October|November|December)/i)},function(e,r){var u=["January","February","March","April","May","June","July","August","September","October","November","December"];return u.indexOf(r)-u.indexOf(e)});

View File

@@ -0,0 +1,6 @@
/*!
* tablesort v5.4.0 (2023-05-04)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2023 ; Licensed MIT
*/
!function(){function e(t){return t.replace(/[^\-?0-9.]/g,"")}Tablesort.extend("number",function(t){return t.match(/^[-+]?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/)||t.match(/^[-+]?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/)||t.match(/^[-+]?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/)},function(t,n){return t=e(t),n=e(n),n=n,t=t,n=parseFloat(n),t=parseFloat(t),(n=isNaN(n)?0:n)-(t=isNaN(t)?0:t)})}();

View File

@@ -0,0 +1,33 @@
th[role=columnheader]:not(.no-sort) {
cursor: pointer;
}
th[role=columnheader]:not(.no-sort):after {
content: '';
float: right;
margin-top: 7px;
border-width: 0 4px 4px;
border-style: solid;
border-color: #404040 transparent;
visibility: hidden;
opacity: 0;
-ms-user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
th[aria-sort=ascending]:not(.no-sort):after {
border-bottom: none;
border-width: 4px 4px 0;
}
th[aria-sort]:not(.no-sort):after {
visibility: visible;
opacity: 0.4;
}
th[role=columnheader]:not(.no-sort):hover:after {
visibility: visible;
opacity: 1;
}

View File

@@ -1,6 +1,6 @@
/*!
* tablesort v5.4.0 (2022-04-27)
* tablesort v5.4.0 (2023-05-04)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2022 ; Licensed MIT
* Copyright (c) 2023 ; Licensed MIT
*/
!function(){function r(t,e){if(!(this instanceof r))return new r(t,e);if(!t||"TABLE"!==t.tagName)throw new Error("Element must be a table");this.init(t,e||{})}function m(t){var e;return window.CustomEvent&&"function"==typeof window.CustomEvent?e=new CustomEvent(t):(e=document.createEvent("CustomEvent")).initCustomEvent(t,!1,!1,void 0),e}function p(t,e){return t.getAttribute(e.sortAttribute||"data-sort")||t.textContent||t.innerText||""}function v(t,e){return(t=t.trim().toLowerCase())===(e=e.trim().toLowerCase())?0:t<e?1:-1}function A(t,e){return[].slice.call(t).find(function(t){return t.getAttribute("data-sort-column-key")===e})}function E(n,o){return function(t,e){var r=n(t.td,e.td);return 0===r?o?e.index-t.index:t.index-e.index:r}}var x=[];r.extend=function(t,e,r){if("function"!=typeof e||"function"!=typeof r)throw new Error("Pattern and sort must be a function");x.push({name:t,pattern:e,sort:r})},r.prototype={init:function(t,e){var r,n,o,i=this;if(i.table=t,i.thead=!1,i.options=e,t.rows&&0<t.rows.length)if(t.tHead&&0<t.tHead.rows.length){for(a=0;a<t.tHead.rows.length;a++)if("thead"===t.tHead.rows[a].getAttribute("data-sort-method")){r=t.tHead.rows[a];break}r=r||t.tHead.rows[t.tHead.rows.length-1],i.thead=!0}else r=t.rows[0];if(r){function s(){i.current&&i.current!==this&&i.current.removeAttribute("aria-sort"),i.current=this,i.sortTable(this)}for(var a=0;a<r.cells.length;a++)(o=r.cells[a]).setAttribute("role","columnheader"),"none"!==o.getAttribute("data-sort-method")&&(o.tabindex=0,o.addEventListener("click",s,!1),null!==o.getAttribute("data-sort-default")&&(n=o));n&&(i.current=n,i.sortTable(n))}},sortTable:function(t,e){var r=this,n=t.getAttribute("data-sort-column-key"),o=t.cellIndex,i=v,s="",a=[],d=r.thead?0:1,u=t.getAttribute("data-sort-method"),l=t.getAttribute("aria-sort");if(r.table.dispatchEvent(m("beforeSort")),e||(l="ascending"===l||"descending"!==l&&r.options.descending?"descending":"ascending",t.setAttribute("aria-sort",l)),!(r.table.rows.length<2)){if(!u){for(;a.length<3&&d<r.table.tBodies[0].rows.length;)0<(s=(s=(f=n?A(r.table.tBodies[0].rows[d].cells,n):r.table.tBodies[0].rows[d].cells[o])?p(f,r.options):"").trim()).length&&a.push(s),d++;if(!a)return}for(d=0;d<x.length;d++)if(s=x[d],u){if(s.name===u){i=s.sort;break}}else if(a.every(s.pattern)){i=s.sort;break}for(r.col=o,d=0;d<r.table.tBodies.length;d++){var c,f,h=[],b={},w=0,g=0;if(!(r.table.tBodies[d].rows.length<2)){for(c=0;c<r.table.tBodies[d].rows.length;c++)"none"===(s=r.table.tBodies[d].rows[c]).getAttribute("data-sort-method")?b[w]=s:(f=n?A(s.cells,n):s.cells[r.col],h.push({tr:s,td:f?p(f,r.options):"",index:w})),w++;for("descending"===l?h.sort(E(i,!0)):(h.sort(E(i,!1)),h.reverse()),c=0;c<w;c++)b[c]?(s=b[c],g++):s=h[c-g].tr,r.table.tBodies[d].appendChild(s)}}r.table.dispatchEvent(m("afterSort"))}},refresh:function(){void 0!==this.current&&this.sortTable(this.current,!0)}},"undefined"!=typeof module&&module.exports?module.exports=r:window.Tablesort=r}();