ssborbis / ContextSearch-web-ext

Search engine manager for modern browsers
349 stars 37 forks source link

Find-in-Page #135

Open Jackie-Blue opened 5 years ago

Jackie-Blue commented 5 years ago

This is in response to CS developer's (edit) 12-15 suggestion at https://addons.mozilla.org/en-US/firefox/addon/contextsearch-web-ext/reviews for me to give feedback at the github site.

I - When a search results page is opened the search words are not highlighted. Developer - Do you mean in the search bar itself on the results page?

Answer - No, I didn't mean words highlighted in the search bar itself. What I meant was that the search term should be hi-lighted in all search results pages, not just the first page only. More generally, instances of the term in the search box (or find box) should be highlighted within the webpage is what I meant.

Thanks, Jackie

ssborbis commented 5 years ago

What I'm trying now is keeping a record of what tab a search was performed in and applying the highlighting to every subsequent pageload in that tab or children of that tab ( many people like to open links in search results to a new tab ). The other possibility is only tracking the domain. So getting a google result and clicking Next >> would continue the highlighting as long as you stay on google.com. It gets a bit more complicated with dynamically added content vs opening another results page.

ssborbis commented 5 years ago

New options for highlighting. You can choose to only follow links on the domain to highlight or external links

untitled

Jackie-Blue commented 5 years ago

Wow, findbar is coming along nicely. Thank you very much. Your coding skill is impressive.

Currently the Findbar Position options are Top, Bottom. Below are two position suggestions to make findbar more useful with some other suggestions and feedback.

Option - position the findbar on all pages at all times because we use in-page searches a lot. One nuisance of the ffox findbar api is that we always have to invoke it on every page with ctrl-f or some way before we can use it. An ever-present findbar that doesnt require an extra step to display it would be more efficient.

Option - position the findbar inside the ffox toolbar adjacent to the ffox address bar; about where the ffox search bar is located if it's enabled. If the cswe findbar is positioned inside the ffox toolbar it doesn't occlude the webpage.

Option - When multiple words are searched and hi-lited, the active word isn't obvious. An option to Flash the hilite of the active word would make the active word being searched more obvious. Or, flashing by alternating between 2 colors might make the active word stand out more than flashing only one color.

Option / bug? - When finding a multi-word term on a page, the findbar finds instances of just one of the words in the term before getting to the complete term, unless the term is inside quotes. Default behavior should be to find the complete term first, even if quotes are not used, like with the FFox find api. And, the first instance of the complete term should be found and hilited without the need to click the up/down arrow, like with the ffox find api.

Bug - Apparently there is a bug where the search term in the findbar can become inactive: On duolingo.com I used cswe findbar to find the course link I was scheduled to do which was titled "School 4" As I did lessons I kept the findbar up. The url changed with each lesson, but the cs findbar remained. After I did 3 lessons and came back to the original duolingo.com page I clicked on the cs findbar which still had "School 4" in it. But this time there was no response from the find bar. It didn't find "school 4" in the page this time. The ffox api findbar still found it. I tried closing the cswe findbar, re-opening it, retyping "school 4" in it, and clicking its down arrow. Then it found "school 4" again. At a different website the cs findbar remained active, continued to work without restarting it, as I went from page to page.

Option - Would like option to keep search text in findbar until we change it. If we exit findbar, and invoke it again later, the search text should still be there.

Wish we could write this where it sounds more like compliments than complaints. Thanks again for adding the findbar and for CSWE.

ssborbis commented 5 years ago

@Jackie-Blue

position the findbar on all pages at all times

option added

position the findbar inside the ffox toolbar adjacent to the ffox address bar

Unfortunately, that's not possible with the new webextensions API. This is one reason so many add-ons, FindBar Tweak among them, didn't migrate to FF Quantum. All UI must exist as content scripts inside the web page.

An option to Flash the hilite of the active word would make the active word being searched more obvious

Option added. Still trying different colors / styles

When finding a multi-word term on a page, the findbar finds instances of just one of the words in the term before getting to the complete term, unless the term is inside quotes.

Getting the basics on this one worked out. New behavior goes like this:

search for -> lorem ipsum dolor sit amet

lorem ipsum dolor sit amet - color 1 lorem ipsum dolor sit - color 2 lorem ipsum dolor - color 3 lorem ipsum - color 4 lorem - color 1 ipsum - color 2 dolor - color 3 sit - color 4 amet - color 1

Might get weird when mixing quoted strings. Dunno yet.

Bug - Apparently there is a bug where the search term in the findbar can become inactive:

I'll keep an eye out

option to keep search text in findbar until we change it

Doable, but I'll probably need to track tabs and maintain more than one 'last search'.

Wish we could write this where it sounds more like compliments than complaints. Thanks again for adding the findbar and for CSWE.

No prob

Jackie-Blue commented 5 years ago

Hmm, it's probably beyond my understanding, but I'll ask anyway - regarding the option to position the findbar inside the ffox toolbar adjacent to the ffox address bar - you replied not possible.

With your CSWE icon that has the looking glass inside the square, you managed to position it inside the ffox toolbar. So, it seems like you could put a findbox in the ffox toolbar the same way you put the cswe looking glass in there ??

ssborbis commented 5 years ago

@Jackie-Blue

Currently, webextensions only allows for a single toolbar icon per add-on. Nothing else. If it were possible I'd have used an input bar instead of an icon to replace the functionality of the FF search bar. The icon does allow for running a webpage in a popup menu when clicked like I've done with the search bar, but it wouldn't be effective as a findbar. The window closes automatically when it loses focus so it cannot be set to stay open. It also cannot be opened programmatically as it requires a user to click the icon ( I think there's a hotkey option but still ... )

Jackie-Blue commented 5 years ago

Could one of the approaches below get the findbar inside the ffox toobar ?

ssborbis commented 5 years ago

Add findbar functionality to FFox api Search box

I don't think that's possible, at least not in any practical way. I'm limited to adding engines to the FF search bar with user approval, and even that takes some cajoling with a web-based API.

Make findbar a separate addon, but when cswe makes a search have finbar option where findbar updates its search term to new cswe search terms as new searches are made.

I'd pick up an extra toolbar icon but I don't think it would be especially useful. Using a browser_action window like the current toolbar button does could be used as a find bar, but would close automatically when a user interacts with the web page. No way to open it programmatically either, so no 'always open' or 'open automatically' feature. There's but so much a dev can do with the webextensions API.

I'm currently working out iframe-related problems. I notice some failures on google translate pages and other embedded iframe pages. Not easy to work around cross-origin policy but I've got a few ideas.

ssborbis commented 5 years ago

@Jackie-Blue

I just released 1.9.5 which has a ton of changes for the findbar. I don't know exactly how you're using it so let me know if it's doing what you're after.

Jackie-Blue commented 5 years ago

Have been test driving CSWE 1.9.5.

Flashing the active search term on webpages is a nice addition. It makes instances of the search term much more obvious. This is huge.

Search terms that were quoted in the original search aren't found in results pages except for instances where the term is also quoted in the webpage, ie "web analytics" is found but not web analytics - even with accuracy set to partial instead of exact. It's rare that a search term is quoted in results pages, so the findbar also needs to find search terms that aren't quoted.

Findbar still doesn't immediately find the first instance of a search term when the term is typed into the findbar. We have to click on an arrow button before it tries to find the term.

Appreciate the option to have findbar on all pages at all times. Wish there was a way to put the findbar in the ffox toolbar where it doesn't clutter the webpage.

It seems odd that Firefox, Chrome, and other browsers don't include a robust findbar because finding what we are looking for is such a basic need that every user has.

Flashing the active search term is a bigtime feature. Thanks for adding the findbar and the improvements you are making to it. The findbar still has room for improvement but it's getting better. CSWE is a great addon.

ssborbis commented 5 years ago

Search terms that were quoted in the original search aren't found in results pages except for instances where the term is also quoted in the webpage, ie "web analytics" is found but not web analytics - even with accuracy set to partial instead of exact. It's rare that a search term is quoted in results pages, so the findbar also needs to find search terms that aren't quoted.

I'll check it out.

Findbar still doesn't immediately find the first instance of a search term when the term is typed into the findbar. We have to click on an arrow button before it tries to find the term.

I'll add an option to perform the highlighting after a typing timeout. You can press enter to jump to the first match FYI

Appreciate the option to have findbar on all pages at all times. Wish there was a way to put the findbar in the ffox toolbar where it doesn't clutter the webpage.

Same. Until they add some type of cross-browser Toolbar API I'm stuck putting all UI into the web pages. I'm toying around with padding the top of webpages when the findbar is active and position = top to avoid covering content, but it's dependent on the CSS styling of the current page. It will work for some,. maybe most, but not all.

ssborbis commented 5 years ago

@Jackie-Blue

Search terms that were quoted in the original search aren't found in results pages except for instances where the term is also quoted in the webpage, ie "web analytics" is found but not web analytics - even with accuracy set to partial instead of exact. It's rare that a search term is quoted in results pages, so the findbar also needs to find search terms that aren't quoted.

Can you give me a specific search to test on, say, google that doesn't work as intended?

I've tried searching for the following term using the Google engine from the quick menu ... "web analytics" with quotes

... and I show terms web analytics without quotes highlighted on both the first google results page, subsequent google results pages, and external results pages. That sounds like what you're wanting.

I'm using the following settings

untitled

The description for the Separate Word Search option is a bit misleading. If you uncheck it, the addon looks for an exact match to the whole text, quotes and all I believe. It's easy to confuse with the partially, exactly option and probably has some unintentional functional overlap.

Jackie-Blue commented 5 years ago

Looks like what I meant by - "web analytics" is found but not web analytics - isn't exactly what you understood. I should have been more specific.

Only the active search term is not being found, not being flashed, with instances where it was not quoted. That is the problem. The inactive search words are hi-lited whether quoted or unquoted which is the desired behavior for inactive words.

The problem is not with inactive search words. The problem is with active search words. Active words are not found and not flashed if they are not quoted. The active search term "web analytics" is found and flashed on results pages. But web analytics is not found and flashed being that its not quoted.

When clicking findbar arrows to view active instances of the search term, findbar finds and flashes only quoted instances. Inactive search words are hi-lited, but active search words are not found and flashed unless they are quoted.

This behavior is the same whether google or bing is used for the search engine. Hope this helps.

ssborbis commented 5 years ago

@Jackie-Blue

I'm still not seeing the behavior you're describing so I must not be doing the same steps you are or I'm using different settings. When you have a minute, take me through a step-by-step process to reproduce the error. I'll get it fixed if I can see it happening.