HummingBirdAnimeClient/public/js/tables.min.js.map

1 line
4.1 KiB
Plaintext
Raw Permalink Normal View History

{"version":3,"sources":["/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/base/sort-tables.js"],"sourcesContent":["const LightTableSorter = (() => {\n\tlet th = null;\n\tlet cellIndex = null;\n\tlet order = '';\n\tconst text = (row) => row.cells.item(cellIndex).textContent.toLowerCase();\n\tconst sort = (a, b) => {\n\t\tlet textA = text(a);\n\t\tlet textB = text(b);\n\t\tconsole.log(\"Comparing \" + textA + \" and \" + textB)\n\n\t\tif(th.classList.contains(\"numeric\")){\n\t\t\tlet arrayA = textA.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tlet arrayB = textB.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tif(arrayA.length > 1) {\n\t\t\t\ttextA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10);\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttextA = parseInt(arrayA[0],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10);\n\t\t\t}\n\t\t}\n\t\telse if (parseInt(textA, 10)) {\n\t\t\ttextA = parseInt(textA, 10);\n\t\t\ttextB = parseInt(textB, 10);\n\t\t}\n\t\tif (textA > textB) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (textA < textB) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t};\n\tconst toggle = () => {\n\t\tconst c = order !== 'sorting-asc' ? 'sorting-asc' : 'sorting-desc';\n\t\tth.className = (th.className.replace(order, '') + ' ' + c).trim();\n\t\treturn order = c;\n\t};\n\tconst reset = () => {\n\t\tth.classList.remove('sorting-asc', 'sorting-desc');\n\t\tth.classList.add('sorting');\n\t\treturn order = '';\n\t};\n\tconst onClickEvent = (e) => {\n\t\tif (th && (cellIndex !== e.target.cellIndex)) {\n\t\t\treset();\n\t\t}\n\t\tth = e.target;\n\t\tif (th.nodeName.toLowerCase() === 'th') {\n\t\t\tcellIndex = th.cellIndex;\n\t\t\tconst tbody = th.offsetParent.getElementsByTagName('tbody')[0];\n\t\t\tlet rows = Array.from(tbody.rows);\n\t\t\tif (rows) {\n\t\t\t\trows.sort(sort);\n\t\t\t\tif (order === 'sorting-asc') {\n\t\t\t\t\trows.reverse();\n\t\t\t\t}\n\t\t\t\ttoggle();\n\t\t\t\ttbody.innerHtml = '';\n\n\t\t\t\trows.forEach(row => {\n\t\t\t\t\ttbody.appendChild(row);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tinit: () => {\n\t\t\tlet ths = document.getElementsByTagName('th');\n\t\t\tlet results = [];\n\t\t\tfor (let i = 0, len = ths.length; i < len; i++) {\n\t\t\t\tlet th = ths[i];\n\t\t\t\tth.classList.add('sorting');\n\t\t\t\tth.classList.add('testing');\n\t\t\t\tresults.push(th.onclick = onClickEvent);\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n\t};\n})();\n\nLightTableSorter.init();"],"names":[],"mappings":"AAAyB,CAAC,KACzB,IAAI,EAAK,KACL,EAAY,KACZ,EAAQ,GACN,EAAO,AAAC,GAAQ,EAAI,KAAK,CAAC,IAAI,CAAC,GAAW,WAAW,CAAC,WAAW,GACjE,EAAO,CAAC,EAAG,KAChB,IAAI,EAAQ,EAAK,GACb,EAAQ,EAAK,GAGjB,GAFA,QAAQ,GAAG,CAAC,aAAe,EAAQ,QAAU,GAE1C,EAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CACnC,IAAI,EAAS,EAAM,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,KAC9D,EAAS,EAAM,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAC/D,CAAA,EAAO,MAAM,CAAG,GAClB,EAAQ,SAAS,CAAM,CAAC,EAAE,CAAC,IAAM,SAAS,CAAM,CAAC,EAAE,CAAC,IACpD,E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