Saving Bytes Every Page - Or, How I Learned To Stop Worrying And Enhance Search

Asgard

  • So Many Searches, Why Have So Many Searches, One Search Is Enough
  • Posts: 56

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Asgard

  • So Many Searches, Why Have So Many Searches, One Search Is Enough
  • Posts: 56

Nao

  • Dadman with a boy
  • Posts: 16,079
Okay, so... These last few days have been hectic IRL. Not in bad sense. It's been gotten hard to work on Wedge, I'm expecting 'full recovery' next weekend. I've worked exclusively on this popup, trying to make it less annoying, and been plagued with different bugs.
So, right now, what I have is a popup that only shows on focus, and gets hidden on blur, so that's all good, but I can't seem to animate it (not sure why... Have yet to look into it seriously), and most importantly, it closes as soon as I click somewhere in the popup, ah ah... I didn't think of that one, but clicking there will trigger a blur on the input box, that's very, coldly logical... I tried to turn to .focusout instead, but I can't seem to get a way to determine the current target, I'm only getting the input text I'm blurring from, so it looks like it's going to be hard. And I don't want to introduce some weird hack using some kind of static variable to keep track of where the focus is.
One of the good things of my current code, though, though, is that it no longer adds extra HTML to all pages, just a hundred bytes of JavaScript to script.js, or something like that. (It was the whole point for me, originally...)

Am I to understand that no one is interested in an implementation that's conceptually similar to what can be experienced in xenForo..? It's ultimately what I'm trying to replicate. (Without some of its bells and whistles, though.)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,079
That's the idea, yes... ;)
Posted: March 4th, 2013, 05:10 PM

Okay, so I gave up on focusout stuff, and instead did it like I did with select boxes or something... A document-wide click event that tests whether we're clicking outside of the form. If yes, then close, otherwise not. It works perfectly (phew), and allows me to focus on other issues, but I'm a bit bothered by the fact that if you navigate with the keyboard, you can't actually close that popup... It's quite important because the search input is one of the first (if not the first) items that get navigated to by the keyboard, so once the popup is opened, it gets in the way... Bah!

In the SMf, if you submit a search in the box you get this ( i think) simple search or with in the Board or cat your in:
index.php?action=search2

But if you have button or text link in your menu with only this link it will take you to the advanced search:
index.php?action=search

Now this should save you some code bytes, and the drop down!

Just my thoughts on the thing! ( not certain, but think that's what was original Idea???

Note if you set the seacrh that way as pointed out by Arantor earlier!

regards,
maxx

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,079
It will have all of this, except for the board selection of course. (I'm saying of course, but it's probably doable, I guess...)

I'm just working on the styling bits, but it will require more work on the JS side to deal with modifying the default params and passing a new one (search scope). I also need to add language strings for scopes, ah ah...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,079
Well, that's what scrollbars are for... :^^;:
Also, loading the board list could be done via Ajax... On top of the original Ajax call. Nested Ajax calls, eh... ;)
Posted: March 4th, 2013, 07:19 PM

Styling nearly done (only got a problem with font sizes...), animation is looking good, everything looks like one of those mini-menus we all love, except it shows on focus, not hover. :)

I think I should have some committable material tomorrow!

Artur

  • Long time no see wedge.
  • Posts: 43

Nao

  • Dadman with a boy
  • Posts: 16,079
So... Those with SVN access...? What do you think about the 'final popup'...?

I'll do a site update this weekend, with all the new changes. It's already late by nearly 20 revs.... :-/
Posted: March 6th, 2013, 08:31 AM

Some ideas for the future of quick search...
- Get rid of the Search button in HTML. Pro: there's already a search button in the popup. Con: if JS is disabled, it won't work.
- Add 'containing all these words..' etc select box to the popup
- Use a magnifier icon on the Search button in the popup..???
- Move search box by default to the sidebar, since it will be narrow enough to accommodate any sidebar width.

Opinions..?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Been busy, sorry, I'll look at it shortly.
Quote
- Get rid of the Search button in HTML. Pro: there's already a search button in the popup. Con: if JS is disabled, it won't work.
Users actually press the button? I thought they just pressed enter for simple searching?
Quote
- Add 'containing all these words..' etc select box to the popup
Sounds like a plan.
Quote
- Use a magnifier icon on the Search button in the popup..???
Might be nice to have that.
Quote
- Move search box by default to the sidebar, since it will be narrow enough to accommodate any sidebar width.
Dislike this idea for the same reason as I said about the notifications - if the sidebar is collapsed, it's not accessible easily.

Also, as a heads-up, there is going to be a selector growing on there for what should be searched (whole forum, current board, current topic, thoughts, calendar, other items yet to be determined), haven't decided exactly how to handle that yet.