Skip to content

Conversation

@ViRb3
Copy link

@ViRb3 ViRb3 commented Jul 1, 2025

TODO, just putting this up for early testing and feedback.

output.mov

Screenshot 2025-07-01 at 04 04 45

@ViRb3 ViRb3 marked this pull request as draft July 1, 2025 02:40
#ops {
padding: .3em .6em;
white-space: nowrap;
display: flex;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to make the filter input vertically centered

text-shadow: 1px 1px 1px var(--op-a-sh);
font-size: 1.5em;
padding: .25em .4em;
padding: 0em .4em;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to preserve the old look after adding flex to #ops


#opa_filter {
margin: 0em .4em;
min-width: 50px;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default min-width makes this go out of screen on mobile

"ct_idxh": 'vis index.html istedenfor fil-liste">htm',
"ct_sbars": 'vis rullgardiner / skrollefelt">⟊',

"qs_off": 'deaktiver hurtigsøk, hurtigtaster vil fungere">av',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI translated, please verify

"ct_idxh": '显示 index.html 代替文件夹列表">htm',
"ct_sbars": '显示滚动条">⟊',

"qs_off": '禁用快速搜索,热键将正常工作">关闭',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI translated, please verify

);

// Bind quicksearch setting to UI
(function() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not get bcfg_bind to work, feel free to simplify if possible

if (aet && aet != 'a' && aet != 'tr' && aet != 'td' && aet != 'div' && aet != 'pre')
return;

if (handle_qsearch_key(e)) return;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The placement of this is very tricky, but I think this should be right? Please verify

@9001
Copy link
Owner

9001 commented Jul 1, 2025

really cool tech demo!

but I think it would be even more practical if it behaved like firefox's built-in quicksearch;

  • global hotkey / to move the focus into the filter textbox
  • pressing Enter inside the inputbox would first move the focus entirely from the textbox and over to the selected search result, and then click it
  • pressing Escape would leave the textbox, and...
    • ...leave the focus at the currently hilighted search result, if any
    • ...or possibly restore the previously focused element otherwise

that way,

  • opening a link in mode 2 (basically a clone of firefox's built-in) would just be tapping /, then typing a substring, then...
    • cursorkeys up/down iterates through the matches (only one result is hilighted at a time)
    • hitting enter opens the selected link
  • and mode 1 would be (possibly, not sure!) something like: tapping /, typing the substring, then...
    • enter leaves the textbox and focuses on the first result
    • escape clears the results, restores the original listing, and restores original focus

this would make it possible to keep hotkeys enabled in all of the quicksearch modes, and we could just read the value of the textbox instead of keeping track of the input manually, allowing for full editing / seeing typos.

and then we could redefine mode 0 to entirely hide the Filter-box, since some people may prefer saving the screen space (old iphones are way cramped). And firefox users will probably prefer this too, since they already have quicksearch :>

some general feedback:

  • right now it only does files, and not folders -- should probably do those too? EDIT: my bad, thought it was a substring search, but it's instead searching for files starting with the given value.
  • right now mode2 doesn't won't work in lazyloaded folders (folders with more than 250 files), and the file you're looking for has not been loaded yet
    • one workaround for this could be to force the whole folder to get rendered into view before initiating the search -- treectl.lsc.files.length + treectl.lsc.dirs.length is the current number of items in total, and if that is less than treectl.nvis then treectl.showmore(treectl.lsc.files.length + treectl.lsc.dirs.length) will trigger the rest to get rendered in
      • it would be best to initiate this logic as soon as the filter textbox gets focus, since loading more entries into the table is not a synchronous action (but it will not delay for more than one rendering cycle, so the delay between gaining focus and the first keystroke is definitely enough)
    • this is one case where our quicksearch might "outperform" the one in firefox, since it doesn't quite fit with what copyparty does -- it will successfully scroll to the bottom of page, since the file is currently not rendered in, which triggers the listing to be grown so it now contains the file, but firefox doesn't then scroll down to actually focus on it
  • the way it selects files in mode2 is not optimal, since it would interfere with some usecases -- say you've selected a few files already, and now you're looking for another particular file to add, so you try jumping to it... and now it's not obvious what's an actual selection and what's a markup from this new feature :p
    • I think the best approach would be to reuse the markup that's used when you're traversing the files list in cursormode...
      • making the css for #files tr:focus also apply to #files tr.qhit should do the trick
      • should probably do #files tr:focus td+td and the #files tr:focus:not(.play):... one too
  • it almost works in firefox 52.9 and chrome 49, which is the oldest browsers I try to guarantee are still able to run (most of) the javascript, being the final versions released for winXP -- but I think the only parts that don't work will automatically disappear with the suggested changes (imitating firefox quicksearch). The only one aside from those is scrollintoview not taking block as an option argument
    • I can be in charge of doing the necessary code massage for this, since I'm only aware of a very small handful of active copyparty users who need this (unfortunately with very good reasons)...

as for machine-translated chinese, adding a //m suffix to the string is fine -- if someone wants to fix them at some point then there's already a good handful :p

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

Successfully merging this pull request may close these issues.

2 participants