Commit graph

32 commits

Author SHA1 Message Date
68ba4433b7
fix: rename size column to name 2024-05-29 12:21:26 +02:00
5aaaef1d62
feat: add file size tooltip 2024-03-15 17:05:44 +01:00
0c2ec8e72f
feat: optimize template, add JS license 2024-03-15 16:23:48 +01:00
c85a9fa00b
feat: render txt files correctly 2024-03-15 12:07:30 +01:00
97df2dcc44
feat: readme file 2024-03-14 03:11:59 +01:00
eafbce8352
small fixes 2024-03-13 22:35:27 +01:00
8ec3c8bdfd
feat: clickable path display 2024-03-13 16:17:45 +01:00
f31b92df37
feat: use caddy template 2024-03-13 13:07:39 +01:00
Anthony Ryan
5930c29d6a Remove fancyindex_name_length by offloading work to CSS
This is a backwards compatibility break, in that the `fancyindex_name_length` setting will now
prevent nginx from starting until removed. I do think though that most people will find the new
behavior preferable to that setting however.

There's two arguably unrelated CSS changes included in this pull request, so let me know if you
like one but not the other or vice versa I can split them up.

-----

We've introduced `table-layout: fixed;`. This is a performance optimization for browsers rendering
very large file lists.

The default mode (`table-layout: auto`) first needs to load the entire table, then calculates the
optimal column widths based on the contents of all cells in the table start to finish. This can be
a bit slow when directory listings contain tens of thousands of files or folders.

With `table-layout: fixed;` the width is determined based on the first row allowing the browser to
render to begin rendering the table immediately.

Technically, the widths of columns have changed slightly as a result of this, but we no longer need
to specify widths using style attributes, which makes it easier for custom CSS users to change the
widths.

.link was 55% wide, now 50%
.size was 20% wide, now 25%
.date was 25% wide, now 25%

-----

Rather than truncating string names server-side, we instead send the full name and tell the browser
to truncate file names with CSS. This has the advantage of always showing as much of the file name
as it can fit in a line. This has the benefit of avoiding line wraps on smaller screens (like
phones) and allowing people to resize their window larger to see more of the file name.

This reduces the code complexity server side and provides a optimal truncation on every device.
2021-10-28 22:37:48 +03:00
David Beitey
aa0be2dcaa Fix encoding of & chars in table header 2018-07-13 01:11:20 +03:00
Adrian Perez de Castro
16e6feefa9
Update template.html to reflect recent changes in the code 2018-03-21 17:16:52 +00:00
Adrian Perez de Castro
5b53c2b0b2
Use ↓ entity references instead of character references
Entity references are encoding-independent, and will work despite of the
encoding of the rest of the served document. Note that in general it may be
a bad idea to use "fancyindex_header" to change the encoding of the served
documents because file names will still be treated as UTF-8, which is the
only sane default in Unix.

Fixes #50.
2016-12-07 19:18:11 +02:00
Adrian Perez de Castro
c5deb79e8f
Remove usage of cellpadding/cellspacing in default template
This closes issue #52
2016-08-31 02:26:58 +03:00
Adrian Perez de Castro
bdaceb6583
Do not use col/colgroup tags in default template
Avoid using <colgroup> and <col> tags, which are deprecated in favour
of using CSS for styling.

See issue #52 for more information.
2016-08-31 02:23:54 +03:00
Adrian Perez de Castro
a3a7626de9
Use the HTML5 document type declaration
The XHTML document makes the document not to validate because of the undefined
entity references, and it seems better to use the HTML5 document type instead
of the HTML 4.01 one because the template uses already some modern constructs
like defining the device viewport options.

Fixes issue #52.
2016-08-31 02:07:10 +03:00
YeahO_O Yuan
bbd0300488 Fix Windows builds
Suppress warnings for:
* non-ascii character;
* non-constant aggregate initializer;
* assignment within conditional expression;
* return value type mismatch.
2016-01-25 19:45:06 +08:00
Anthony Ryan
da3f7ea17d Shift table stlying details onto the client
There is almost universal support for the CSS3
:nth-child() pseudo-selector. We're shifting the
responsibility for labeling even and odd rows to
the browser.
2014-06-02 09:02:24 -04:00
Daniel Schömer
a989003c62 template.h: viewport width for mobile browsers
Set html5 meta viewport width to device-width. A mobile browser now scales up the directory listing and dir-/filenames are easier to read and click/touch.
2013-12-28 17:58:35 +01:00
David BÉRARD
1b90ae6977 add new line between parent dir and file/dir list, each table row end now with a new line 2013-11-14 14:54:05 +01:00
Adrian Perez de Castro
ea30f7fb21 Preserve URL sorting arguments on directory links
If a sorting criteria different than the default is used, carry the URL
arguments to the links pointing to other directories, so the sorting is
"remembered" when navigating across different directories.
2013-10-25 13:00:10 +03:00
Adrian Perez de Castro
9b3cdb5583 Clickable table headers change sort direction
Make table headers clickable, for changing sorting direction of the entries.
Clicking on the name of the headers selects ascending direction, clicking on
the arrow next to it, chooses descending direction. The arrow symbol, for
simplicity, is an Unicode down-arrow symbol, which all reasonably modern
browsers should display fine. Also, most text-only browsers will show the
arrow correctly when running on Unicode-compatible terminals.
2013-10-25 12:21:33 +03:00
Adrian Perez
4b19f3a73f Add fancyindex_css_href configuration option
This allows for inserting a <link> tag in the generated listings pointing to
an additional CSS stylesheet, which will be applied by the browser after the
built-in rules. This allows for super-easy customization of the output look.
2010-06-10 16:56:31 +02:00
Adrian Perez
224db63c53 Save some bytes removing things in the template
* Removed the 'media="screen"', because it is unlikely that an user would
  like to print a file listing.

* Removed unused "#readme" rule in the CSS part. Support for inlining a file
  was discontinued long ago.
2010-06-10 14:52:23 +02:00
Adrian Perez
30337efcb3 Removed half-implemented readme_* directives (#1) 2008-09-11 19:55:52 +02:00
Adrian Perez
2f429b796b - Updated documentation.
- Fixed XHTML 1.0 validation by enclosing JS code into a CDATA section.
2007-09-13 23:40:40 +02:00
Adrian Perez
7e156ff58d - Implemented seperate functions to create header/footer buffers.
- Simplified template.html and make code work with new template. Some vars
  were uneeded.
- Added buffer chain debug macro in module header.
2007-09-11 13:52:53 +02:00
Adrian Perez
0101fd77a1 - Removed unused macro nfi_conf_path_set.
- Fixed flags for the readme mode, now they are disjoint. This fixed some
  other related things.
- Renamed fancyindex_readme_options to fancyindex_readme_mode (shorter
  and clearer, IMHO)
- Renamed fancyindex_mode to fancyindex_include_mode (clearer).
- Checks for bottom/top readme are now properly done.
- Fix: Initialization of readme_flags now is zero instead of NGX_CONF_UNSET.
- Improved iteration of builtin template.
2007-08-30 18:13:05 +02:00
Adrian Perez
855adc70eb - It is ALIVE. 2007-08-30 14:29:41 +02:00
Adrian Perez
059d4a8811 - Fixed substitution in Awk script: we were (erroneusly) stripping 'g'
characters.
- Updated template and C header which results after running the script.
2007-08-24 18:10:11 +02:00
Adrian Perez
1933610719 Moved template size calculation out to Awk script 2007-08-24 15:05:37 +02:00
Adrian Perez
cf3c44193b Cierra el ticket #199 2007-08-24 14:07:53 +02:00
Adrian Perez
8d7357aa50 Closes #199 2007-08-24 13:47:59 +02:00