From 6f1930fe951c8e464f3636f1968533cc5e70151c Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Sun, 7 May 2023 03:29:47 +0200 Subject: [PATCH] Including the sort number. --- js-src/index.ts | 1 + public/js/bundle.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js-src/index.ts b/js-src/index.ts index d9eec6a..e31dc86 100644 --- a/js-src/index.ts +++ b/js-src/index.ts @@ -1,5 +1,6 @@ "use strict"; import tablesort from 'tablesort'; +require('tablesort/src/sorts/tablesort.number'); window.onload = () => { const menu_expand = document.querySelector('a.menu-expand'); diff --git a/public/js/bundle.js b/public/js/bundle.js index 97ef505..c8711e5 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -16,7 +16,17 @@ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tablesort */ \"./node_modules/tablesort/src/tablesort.js\");\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tablesort__WEBPACK_IMPORTED_MODULE_0__);\n\n\n\nwindow.onload = () => {\n const menu_expand = document.querySelector('a.menu-expand');\n const mobile_foldable = document.querySelector('nav.mobile-foldable');\n const tables = document.querySelectorAll('table')\n\n if (menu_expand !== null && mobile_foldable !== null) {\n menu_expand.addEventListener('click', () => {\n mobile_foldable.classList.toggle('show');\n });\n }\n\n for (const table of tables) {\n const header = table.querySelector('tr');\n if (header !== null) {\n header.setAttribute('data-sort-method', 'none')\n for (const th of header.querySelectorAll('th')) {\n if (th.getAttribute('data-sort-method') == null) {\n th.setAttribute('data-sort-method', 'thead')\n }\n }\n }\n tablesort__WEBPACK_IMPORTED_MODULE_0___default()(table)\n }\n};\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/index.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tablesort */ \"./node_modules/tablesort/src/tablesort.js\");\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tablesort__WEBPACK_IMPORTED_MODULE_0__);\n\n\n__webpack_require__(/*! tablesort/src/sorts/tablesort.number */ \"./node_modules/tablesort/src/sorts/tablesort.number.js\");\n\nwindow.onload = () => {\n const menu_expand = document.querySelector('a.menu-expand');\n const mobile_foldable = document.querySelector('nav.mobile-foldable');\n const tables = document.querySelectorAll('table')\n\n if (menu_expand !== null && mobile_foldable !== null) {\n menu_expand.addEventListener('click', () => {\n mobile_foldable.classList.toggle('show');\n });\n }\n\n for (const table of tables) {\n const header = table.querySelector('tr');\n if (header !== null) {\n header.setAttribute('data-sort-method', 'none')\n for (const th of header.querySelectorAll('th')) {\n if (th.getAttribute('data-sort-method') == null) {\n th.setAttribute('data-sort-method', 'thead')\n }\n }\n }\n tablesort__WEBPACK_IMPORTED_MODULE_0___default()(table)\n }\n};\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/index.ts?"); + +/***/ }), + +/***/ "./node_modules/tablesort/src/sorts/tablesort.number.js": +/*!**************************************************************!*\ + !*** ./node_modules/tablesort/src/sorts/tablesort.number.js ***! + \**************************************************************/ +/***/ (() => { + +eval("(function(){\n var cleanNumber = function(i) {\n return i.replace(/[^\\-?0-9.]/g, '');\n },\n\n compareNumber = function(a, b) {\n a = parseFloat(a);\n b = parseFloat(b);\n\n a = isNaN(a) ? 0 : a;\n b = isNaN(b) ? 0 : b;\n\n return a - b;\n };\n\n Tablesort.extend('number', function(item) {\n return item.match(/^[-+]?[£\\x24Û¢´€]?\\d+\\s*([,\\.]\\d{0,2})/) || // Prefixed currency\n item.match(/^[-+]?\\d+\\s*([,\\.]\\d{0,2})?[£\\x24Û¢´€]/) || // Suffixed currency\n item.match(/^[-+]?(\\d)*-?([,\\.]){0,1}-?(\\d)+([E,e][\\-+][\\d]+)?%?$/); // Number\n }, function(a, b) {\n a = cleanNumber(a);\n b = cleanNumber(b);\n\n return compareNumber(b, a);\n });\n}());\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/tablesort/src/sorts/tablesort.number.js?"); /***/ }),