From 573eac78f1171c09483cd43f5a0c898951aa1bc5 Mon Sep 17 00:00:00 2001 From: Kevin C Date: Fri, 7 Jan 2022 18:29:37 +0000 Subject: [PATCH] Removed whitespace from string.replace() call --- frontEndSrc/js/base/sort-tables.js | 12 ++++++------ public/js/tables.min.js | 2 +- public/js/tables.min.js.map | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontEndSrc/js/base/sort-tables.js b/frontEndSrc/js/base/sort-tables.js index ac6eb4c4..c8525b7b 100644 --- a/frontEndSrc/js/base/sort-tables.js +++ b/frontEndSrc/js/base/sort-tables.js @@ -9,15 +9,15 @@ const LightTableSorter = (() => { console.log("Comparing " + textA + " and " + textB) if(th.classList.contains("numeric")){ - arrayA = textA.replace('\n\t\t\t\t\t\tepisodes: ','').replace('-',0).split("/") - arrayB = textB.replace('\n\t\t\t\t\t\tepisodes: ','').replace('-',0).split("/") + arrayA = textA.replace('episodes: ','').replace('-',0).split("/"); + arrayB = textB.replace('episodes: ','').replace('-',0).split("/"); if(arrayA.length > 1) { - textA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10) - textB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10) + textA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10); + textB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10); } else{ - textA = parseInt(arrayA[0],10) - textB = parseInt(arrayB[0],10) + textA = parseInt(arrayA[0],10); + textB = parseInt(arrayB[0],10); } } else if (parseInt(textA, 10)) { diff --git a/public/js/tables.min.js b/public/js/tables.min.js index c26a2e09..564959cf 100644 --- a/public/js/tables.min.js +++ b/public/js/tables.min.js @@ -1 +1 @@ -var LightTableSorter=function(){var th=null;var cellIndex=null;var order='';var text=function(row){return row.cells.item(cellIndex).textContent.toLowerCase()};var sort=function(a,b){var textA=text(a);var textB=text(b);console.log("Comparing "+textA+" and "+textB);if(th.classList.contains("numeric")){arrayA=textA.replace('\n\t\t\t\t\t\tepisodes: ','').replace('-',0).split("/");arrayB=textB.replace('\n\t\t\t\t\t\tepisodes: ','').replace('-',0).split("/");if(arrayA.length>1){textA=parseInt(arrayA[0],10)/parseInt(arrayA[1],10);textB=parseInt(arrayB[0],10)/parseInt(arrayB[1],10)}else{textA=parseInt(arrayA[0],10);textB=parseInt(arrayB[0],10)}}else if(parseInt(textA,10)){textA=parseInt(textA,10);textB=parseInt(textB,10)}if(textA>textB)return 1;if(textA1){textA=parseInt(arrayA[0],10)/parseInt(arrayA[1],10);textB=parseInt(arrayB[0],10)/parseInt(arrayB[1],10)}else{textA=parseInt(arrayA[0],10);textB=parseInt(arrayB[0],10)}}else if(parseInt(textA,10)){textA=parseInt(textA,10);textB=parseInt(textB,10)}if(textA>textB)return 1;if(textA {\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\t\t\n\t\tif(th.classList.contains(\"numeric\")){\n\t\t\tarrayA = textA.replace('\\n\\t\\t\\t\\t\\t\\tepisodes: ','').replace('-',0).split(\"/\")\n\t\t\tarrayB = textB.replace('\\n\\t\\t\\t\\t\\t\\tepisodes: ','').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":"AAAA,GAAK,CAAC,gBAAgB,CAAI,QAC1B,EADgC,CAAC,AAChC,GAAG,CAAC,EAAE,CAAG,IAAI,CACb,GAAG,CAAC,SAAS,CAAG,IAAI,CACpB,GAAG,CAAC,KAAK,CAAG,CAAE,EACd,GAAK,CAAC,IAAI,CAAG,QAAQ,CAAP,GAAG,EAAK,MAAM,CAAN,GAAG,CAAC,KAAK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O,GAEb,MAAM,GACN,KAAK,CAAC,SAAS,CAAG,CAAE,EAEpB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAR,GAAG,CAAI,CAAC,AACpB,KAAK,CAAC,WAAW,CAAC,GAAG,CACtB,CAAC,CACF,CAAC,AACF,CAAC,AACF,CAAC,CACD,MAAM,AAAC,CAAC,AACP,IAAI,CAAE,QACR,EADc,CAAC,AACZ,GAAG,CAAC,GAAG,CAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAI,KAC5C,GAAG,CAAC,OAAO,CAAG,CAAC,CAAC,CAChB,GAAG,CAAE,GAAG,CAAC,CAAC,CAAG,CAAC,CAAE,GAAG,CAAG,GAAG,CAAC,MAAM,CAAE,CAAC,CAAG,GAAG,CAAE,CAAC,GAAI,CAAC,AAChD,GAAG,CAAC,EAAE,CAAG,GAAG,CAAC,CAAC,EACd,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAS,UAC1B,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAS,UAC1B,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAG,YAAY,CACvC,CAAC,AACD,MAAM,CAAC,OAAO,AACf,CAAC,AACF,CAAC,AACF,CAAC,GAED,gBAAgB,CAAC,IAAI"} \ No newline at end of file +{"version":3,"sources":["/var/www/anime/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\t\t\n\t\tif(th.classList.contains(\"numeric\")){\n\t\t\tarrayA = textA.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tarrayB = 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\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