Project

General

Profile

[Solved] dirlisting javascript sort

Added by roytam1 over 2 years ago

It is nice to see dirlisting javascript sort in 1.4.45, but I found an issue:
"../" comes behind directories that starts with "#" (which is not in older lighttpd)
And I hope "../" will be the first entry in default sorting.


Replies (5)

RE: dirlisting javascript sort - Added by gstrauss over 2 years ago

FYI: This was first available in lighttpd 1.4.42 in cfa3d27f

I don't see the behavior that you are seeing. Perhaps you should check your locale since your browser locale is used by the javascript sorting.

You can also replace the sorting javascript with your own by defining dir-listing.external-js to a file of your choice.

[edit] If it is locale-related, you might try this, which is untested:

--- a/src/mod_dirlisting.c
+++ b/src/mod_dirlisting.c
@@ -595,6 +595,10 @@ static const char js_simple_table_resort[] = \
 " var at = get_inner_text(a.cells[sort_column]);\n" \
 " var bt = get_inner_text(b.cells[sort_column]);\n" \
 " var cmp;\n" \
+" if (sort_column == name_column) {\n" \
+"  if (at == '..') return -1;\n" \
+"  if (bt == '..') return  1;\n" \
+" }\n" \
 " if (a.cells[sort_column].className == 'int') {\n" \
 "  cmp = parseInt(at)-parseInt(bt);\n" \
 " } else if (sort_column == date_column) {\n" \

RE: dirlisting javascript sort - Added by roytam1 over 2 years ago

FYI: This was first available in lighttpd 1.4.42 in cfa3d27f

I've just updated lighttpd from 1.4.40 to 1.4.45 today.

[edit] If it is locale-related, you might try this, which is untested:

OK this works.

RE: dirlisting javascript sort - Added by gstrauss over 2 years ago

and what is your browser locale?

RE: dirlisting javascript sort - Added by roytam1 over 2 years ago

and what is your browser locale?

en-US only.

and I found that is shows "../" on wwwroot in 1.4.45

    (1-5/5)