Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing root tab #1

Closed
twiddern opened this issue May 22, 2014 · 6 comments
Closed

Missing root tab #1

twiddern opened this issue May 22, 2014 · 6 comments

Comments

@twiddern
Copy link

Hi,

I'm missing the root tab in the theme, for example I'm using autoindex straight from the rootfolder. After I change to a subdirectory, I see the dirname on the top but there's no tab or button to get to the rootdir.

@TheInsomniac
Copy link
Owner

Unfortunately, all of the testing that I performed was done under subdirectories as the 'root' on all of my sites contain index.html files.
BUT.. I believe I know the cause though I'm uncertain how to go about fixing it in a "non-hacky" way.

On line 36 in history.js and line 10 in footer.html there is "if (segments[i] !== '')" which filters out the root node because we're splitting on '/' in document.location.pathname

Perhaps:

if (segments[i] != '') {
  currentPath += segments[i] + '/';
  breadcrumbs += '<a href="' +  currentPath + '">' + window.unescape(segments[i]) + '<\/a>';
} else {
  currentPath += '/';
  breadcrumbs += '<a href="' + currentPath + '">Root<\/a>';
}

If you'd like to try that or some change therein I'd appreciate it!

@TheInsomniac
Copy link
Owner

I just tested this and it APPEARS to work. Please try on your root folder and let me know.
Thanks!

@TheInsomniac
Copy link
Owner

Alright, I was wrong but this really DOES appear to work with the side effect (which I'll work on later) that it always shows 'Root' even if the webroot is a subpath:

 if (segments[i] != '') {
  currentPath += segments[i] + '/';
  breadcrumbs += '<a href="' +  currentPath + '">' + window.unescape(segments[i]) + '<\/a>';
} else if (segments.length -1 !== i) {
  currentPath += '';
  breadcrumbs += '<a href="' + currentPath + '">Root<\/a>';
}

The above is my 'hacky' way of checking if the item matches '' AND it's not the last element in the array..
Please try and let me know. If it works for you then I'll add a check to remove 'Root' on subpaths.

@TheInsomniac
Copy link
Owner

And finally, just because I enjoy talking to myself :)
If you'd just prefer a 'Parent Directory' folder in the file listings comment the below out in the CSS file.

tbody tr:first-child {
  display: none;
}

screencapture at thu may 22 13 58 28 mdt 2014

@twiddern
Copy link
Author

I've just hacked your second snippet in to the code and it's working great 👍
You should also mention the parrent directory thing, if some is missing this.

Thanks a lot for the fast work

@PeterDaveHello
Copy link

Seems the 'Parent Directory' link will not work on first-level directory.

vonsy added a commit to vonsy/Nginx-Fancyindex-Theme that referenced this issue Mar 5, 2023
Show Parent Directory (or first directory)
TheInsomniac#1 (comment)
comment the below out in the CSS file
tbody tr:first-child {
  display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants