@@ -130,10 +150,9 @@ function dynamicSort(className) {
var textA = a.getElementsByClassName(className)[0].textContent.trim();
var textB = b.getElementsByClassName(className)[0].textContent.trim();
- // Remove "-1" suffix if present
- textA = textA.replace(/-1$/, '').trim();
- textB = textB.replace(/-1$/, '').trim();
-
+ // Remove digits after hyphen if present
+ textA = textA.replace(/-\d+$/, '').trim();
+ textB = textB.replace(/-\d+$/, '').trim();
// If text1 is an integer, parse it as a number
if (!isNaN(textA) && !isNaN(textB)) {
var result = parseInt(textA) - parseInt(textB);