Open KeeeeeK opened 1 year ago
Hey, I'm not using it myself so won't be adding it, but I welcome contributions from others (if the code is well written)
Could you please give me some advice about how to extend search_engines.js?
As I understand, method called 'searchBoxSelector' should return a string that somehow filters html code to find search box. If I'm not mistaken, I should just f12 on yandex search page and find class fields that are specific for this box. If it is input class and has class field x='y', then in searchBoxSelector I should return 'input[x="y"]'. Am I right?
getSearchResults function... I looked through how it is written in different cases and the only common pattern is that we should find includedElements and excludedElements, then put them into getSortedSearchResults. I'm a little scared when I see '#search .kp-blk:not(.c2xzTb) .r > a:first-of-type' and absolutely dont understand what it does...
Sorry, missed this. Answers below.
Could you please give me some advice about how to extend search_engines.js?
As I understand, method called 'searchBoxSelector' should return a string that somehow filters html code to find search box. If I'm not mistaken, I should just f12 on yandex search page and find class fields that are specific for this box. If it is input class and has class field x='y', then in searchBoxSelector I should return 'input[x="y"]'. Am I right?
Yes.
getSearchResults function... I looked through how it is written in different cases and the only common pattern is that we should find includedElements and excludedElements, then put them into getSortedSearchResults. I'm a little scared when I see '#search .kp-blk:not(.c2xzTb) .r > a:first-of-type' and absolutely dont understand what it does...
Yes. The expression you quoted is a CSS selector. In some cases (like this one) it's a complex expression because they reflect the structure the webpage of the specific search engine, which are sometimes not easy to parse with CSS selectors. In addition, it is not stable, the website can change their HTML structure any time and break the extension, but there's nothing we can do about that.
Describe the problem you're trying to solve
I like yandex and using my laptop only with keyboard. I'd be happy if there will be support for yandex_search_engine
Describe the solution you'd like
Add yandex support pleeeeas
Describe alternatives you've considered
I tried to make a fork and extend classes as you advised in the description, but I dont know js... I dont know how to write getSearchResults function...(((