ssborbis / ContextSearch-web-ext

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

[Request] Search Engine Switch and set the category&engine display rule by REGEX #503

Open 7peanuts opened 2 years ago

7peanuts commented 2 years ago
  1. Can I switch between search engines? For example, after I use Google to search for Witcher3, then press a shortcut key on the Google results page to jump to Yandex search Witcher3.
  2. Use REGEX rule to set the category and search engine to display on specific pages.
ssborbis commented 2 years ago

Can I ask, are you currently using REGEX and/or context settings to display only some engines for a particular search term / element type?

contexts

I'm just trying to wrap my head around how best to implement the contextual nature of programmatically choosing the next engine in the list.

I assume it would be useful to display some sort of icon carousel to show the previous / current / next engine?

7peanuts commented 2 years ago

I'm using the element type selector, but not yet the match terms REGEX.

I've added hundreds of engines and most of their element types are selection .

Even though I've sorted these engines into a dozen folders, they still seem huge when searching using the right-click context.

So, for this type of engine I currently prefer to use the quick menu because it's easier to find with icons. Sometimes it can also be used as a bookmark favorite.

As for match terms REGEX, they may be less applicable, but I'll give it a try.

7peanuts commented 2 years ago

But to be honest, there are about 20 or 30 engines that I use regularly, and about a dozen that I set shortcuts for.

Sometimes too many engines become a burden.

On my suggestion 1, I see that someone here has mentioned #497 .

I assume it would be useful to display some sort of icon carousel to show the previous / current / next engine?

That's a good idea, maybe we can customize which engines appear in the previous / next list.

ssborbis commented 2 years ago

Things get tricky if you're wanting only a small number of engines to sort through. I can see a scenario where a search engine is initially called, and then all other engines in the same folder as that engine are used as the list for that results page. So, if I had google images, ddg images, flickr, etc in one folder, and initially searched with google images, only those engines in the same folder would show up in the prev/next list.

That makes the most sense to me, or perhaps only those engines with the same context, but as you said, if most are set as 'selection', that makes for a lot of engines. I'm not exactly sure how else to pare them down.

7peanuts commented 2 years ago

So, if I had google images, ddg images, flickr, etc in one folder, and initially searched with google images, only those engines in the same folder would show up in the prev/next list.

That's good, after all it's much easier to create folders than to use REGEX 😂

if most are set as 'selection', that makes for a lot of engines. I'm not exactly sure how else to pare them down.

This is like what I said in suggestion 2, about whether we can use REGEX to set which pages the search engines displays.

ssborbis commented 2 years ago

This is like what I said in suggestion 2, about whether we can use REGEX to set which pages the search engines displays.

Can you walk me through how that would work? Would you want an additional field in the edit engine modal that accepts regex that allows you to only show that engine in menus on a particular page if the url matches? Or would this regex field only affect the next/prev choices? I'm still trying to figure out how this should be implemented.

7peanuts commented 2 years ago

Would you want an additional field in the edit engine modal that accepts regex that allows you to only show that engine in menus on a particular page if the url matches?

Just like this will do, we can also use exclusion rules.

Maybe also add matching rules to the folders, so that we can hide some of the folders that don't need to be displayed.

ssborbis commented 2 years ago

I have a very rough version coded that works by cycling through the folder the current search engine resides. For example, if I have a folder containing the following engines:

Google DuckDuckGo Bing Yahoo

... and I perform a search with Bing. clicking the right-arrow will reload the tab using Yahoo, and clicking the left-arrow will reload the tab using DDG. And the function continues on newly loaded tabs, allowing you to continue cycling through the folder.

More to come, but the core seems to be in place

7peanuts commented 2 years ago

I have a very rough version coded that works by cycling through the folder the current search engine resides. For example, if I have a folder containing the following engines:

Google DuckDuckGo Bing Yahoo

... and I perform a search with Bing. clicking the right-arrow will reload the tab using Yahoo, and clicking the left-arrow will reload the tab using DDG. And the function continues on newly loaded tabs, allowing you to continue cycling through the folder.

Maybe we can go a step further, when we open a page with CS, only the engines in the folder where the current engine resides will be displayed.

Also, is there an option to open in the current page or in a new tab?

ssborbis commented 2 years ago

Maybe we can go a step further, when we open a page with CS, only the engines in the folder where the current engine resides will be displayed.

Displayed where?

Also, is there an option to open in the current page or in a new tab?

Not currently, but it can be an option. Eventually, I'll make the shortcut key customizable. Maybe allow for a few keys and a few tab options. Arrow = current tab, Shift+Arrow = new tab, etc

7peanuts commented 2 years ago

Maybe we can go a step further, when we open a page with CS, only the engines in the folder where the current engine resides will be displayed.

Displayed where?

I mean, in this open page, when using CS Quick Menu again, only the engines in the folder it is in will show, all other engines and folders are hidden. We can display other engines by pressing the Quick Menu shortcut again, or in other ways.

Not currently, but it can be an option. Eventually, I'll make the shortcut key customizable. Maybe allow for a few keys and a few tab options. Arrow = current tab, Shift+Arrow = new tab, etc

That would be nice too, although I also just open it in a new tab, but I guess it's always good to have an option.

ssborbis commented 1 year ago

Latest push to development branch has a simple next / previous engine option set via shortcut key.

Default ( once enabled ) is right arrow = next engine in the folder, left arrow = previous engine

image

ssborbis commented 1 year ago

Once you've had a chance to use this feature a bit, maybe we can expand on it. Right now, it pulls the list of previous / next engines from the original engine's parent folder. It wouldn't take much code to use the 'regex'' field to compile a list engines that also match the original search terms ( same list as you'd see in the regex folder ). Any thoughts?

7peanuts commented 1 year ago

Switching between previous and next is done on the current page, would like to add an option to open in a new tab.

It wouldn't take much code to use the 'regex'' field to compile a list engines that also match the original search terms ( same list as you'd see in the regex folder ). Any thoughts?

Currently only the previous and next engine of the currently opened engine can be selected, I would like to be able to select all engines in the current folder, like this: I mean, in this open page, when using CS Quick Menu again, only the engines in the folder it is in will show, all other engines and folders are hidden.

ssborbis commented 1 year ago

I would like to be able to select all engines in the current folder, like this:

When you say select , how exactly? I have toyed around with variations on pageTiles, a carousel, a radial menu, etc. They all have their benefits and drawbacks. Also, what was the priority for selecting - mouse or keyboard?

7peanuts commented 1 year ago

When you say select , how exactly? Also, what was the priority for selecting - mouse or keyboard?

My original intention is to facilitate the search on the search results page, specific examples:

When I open a search results page to browse, if I don't find the answer I want, then I will search other sites.

The current step is, open CS menu to find the engine you need and click to search, but if you have many folders and many engines, it will not be easy to find, and sometimes you need to re-select the keyword.

So, I want to be able to press a key or click the mouse to go straight to other search pages. For me, the sidebar menu is used very rarely, I think it can be achieved through the sidebar menu, open the sidebar menu in the opened search results page (by default or press the key to open), but the menu only shows the engines within this open engine folder.

ssborbis commented 1 year ago

Not sure if you are aware, but there is an advanced setting rememberLastOpenedFolder that will open the menus to the last opened folder. That may not suit your needs, but useful just the same.

For me, the sidebar menu is used very rarely, I think it can be achieved through the sidebar menu, open the sidebar menu in the opened search results page

sideBar.openOnResults

There is a setting to open the sidebar on results pages. Maybe this + rememberLastOpenedFolder will work?

ssborbis commented 1 year ago

The sidebar also has it's own layout, independent of the qm and the toolbar menu, so you can remove any components you don't need

7peanuts commented 1 year ago

The sidebar also has it's own layout, independent of the qm and the toolbar menu, so you can remove any components you don't need

Great, I will try it later.

There is a setting to open the sidebar on results pages. Maybe this + rememberLastOpenedFolder will work?

Great, these two options do what I said above. The only thing that doesn't quite fit is that it's not always necessary to remember the last opened folder, and it would be nice to remember the folder only on the results page.

ssborbis commented 1 year ago

The only thing that doesn't quite fit is that it's not always necessary to remember the last opened folder, and it would be nice to remember the folder only on the results page.

Should be easy enough to add an option.

Incidentally, I noticed a few layout bugs with the sidebar while testing that should be worked out for the next release.