inverter = -1;
_sort_key = sort_key.substring(1);
}
- return inverter * ((a[_sort_key] > b[_sort_key]) ? 1 : -1);
+ const cmp = "tags_count" == _sort_key
+ ? (a.tags_showable.length > b.tags_showable.length)
+ : (a[_sort_key] > b[_sort_key]);
+ return inverter * (cmp ? 1 : -1);
});
const table = document.getElementById("files_table");
Array.from(document.getElementsByClassName("file_row")).forEach((row) => row.remove());
<th><button class="sorter" onclick="sort_by(this, 'size'); ">size</button></th>
<th><button class="sorter" onclick="sort_by(this, 'duration'); ">duration</button></th>
<th>actions</th>
-<th>tags</th>
+<th>tags <button class="sorter" onclick="sort_by(this, 'tags_count'); ">count</button></th>
<th><button class="sorter" onclick="sort_by(this, 'rel_path'); ">path</button></th>
</tr>
</table>