Greasy Fork is available in English.

Opera Browser Rocker+Mouse Gestures + Search HighLight

This script works on any browser and simulates the Opera Browser Mouse+Rocker Gestures, along with the Search HighLight and Units+Currency Converters, but with this script you can modify or disable them as you want.

< Відгуки до Opera Browser Rocker+Mouse Gestures + Search HighLight

Відгук: Добре - скрипт працює добре

§
Опубліковано: 07.04.2022

Good and useful script. Can you make this support Firemonkey. Units and currency converters aren't working in FM. This will be very helpful if you collaborate with him (very supportive dev and FM is good userscript manger) to fix the issue there. One more thing, this will be more useful if you let us change search engine and add more engine like sss. Thank you.

hacker09Автор
§
Опубліковано: 07.04.2022
Edited: 07.04.2022

Thanks!

I probably will not waste time changing the script from fetch to XMLHttpRequest just for the script to work on that extension. Sometimes No Cors error do occur, but usually reloading the page, trying again or trying another value in the same page without reloading works.

Let him know that the units converter simply uses a regex to match the text on the page, then it uses a simply javascript switch condition to work, there is no fetch or network request involved on it, I'm pretty sure that this is 100% his extension problem and bug, not my script bug since it works on tampermonkey.

The currency converter does all I mentioned above and it also depends on google.com, it uses fetch and that is a network request, sometimes even with Tampermonkey I get no Cors error, I guess for it to work it depends on how google.com is feeling when try to use the currency converter or depends on the website I try to use it on haha. (One day I may also use bing.com or something like it in case the script detects that fetching google.com failed.)

I already mentioned how to change the search engine from google to whatever other search engine on the script first page.
If you want to change the default script search engine from google to another search engine. (Start on Line 642 in the script codes.)


Here's how to do it.
You just need to change

var LinkfyOrSearch = 'https://www.google.com/search?q='; //Creates a variable to open google

To

var LinkfyOrSearch = 'LINK OF THE SEARCH ENGINE'; //Creates a variable to open THE SEARCH ENGINE YOU WANT

Example:
var LinkfyOrSearch = 'https://duckduckgo.com/?q='; //Creates a variable to open DuckDuckGo


§
Опубліковано: 07.04.2022

My apologies, looks like there was no problem with unit converter only currency converter affected. It will be better if we can use two or more search engine together. Thank you for quick response.

hacker09Автор
§
Опубліковано: 08.04.2022

No problem.

Most people do not use frequently more than 1 search engine, so I would not add that to the script since it would also not be very useful to me, and go beyond the script main purpose, that is to only copy the Opera Browser default mini highlight menu with the possibility of minor adds/removals and tweaks.

§
Опубліковано: 08.04.2022

That is true. Still hoping you will find spare time to implement GM_xmlhttpRequest|GM.xmlHttpRequest which will lead better compatibility. Thank you.

§
Опубліковано: 09.04.2022

FireMonkey compatible fix is posted here. (lines 322-325, 1.5 lines of extra code)

hacker09Автор
§
Опубліковано: 09.04.2022
Edited: 09.04.2022

@erosman
> FireMonkey compatible fix is posted here. (lines 322-325, 1.5 lines of extra code)

You added 4 lines of code somewhere, that is probably not the lines you mentioned.
The lines you mentioned are
break; //Stop trying to get the correct Currency Letters
case '฿': //Get the actual selected currency symbol
CurrencySymbol = 'THB'; //"Convert" the symbol to the Currency Letters
break; //Stop trying to get the correct Currency Letters

Both on my script and on your modified script as well, please let me know what lines you modified according to https://pastebin.com/KUCJdwFi

§
Опубліковано: 09.04.2022
Edited: 09.04.2022

Sorry typo, I meant Line 332-335 (you can also try to compare the 2 versions)

Original Code line 332

const responsehtml = await (await fetch(`https://api.allorigins.win/get?url=${encodeURIComponent('https://www.google.com/search?q=' + SelectedText.match(Currencies)[1] + ' ' + CurrencySymbol + ' in ' + GM_getValue("YourLocalCurrency"))}`)).json(); //Fetch

Updated Code line 332

const url = `https://api.allorigins.win/get?url=${encodeURIComponent('https://www.google.com/search?q=' + SelectedText.match(Currencies)[1] + ' ' + CurrencySymbol + ' in ' + GM_getValue("YourLocalCurrency"))}`;

const responsehtml = GM_info.scriptHandler === 'FireMonkey' ? (await GM.fetch(url, {responseType: 'json'})).json :
    await (await fetch(url)).json(); //Fetch
§
Опубліковано: 03.05.2022

FireMonkey v2.53 should work with standard userscript without the need for above changes.

hacker09Автор
§
Опубліковано: 03.05.2022

@erosman

Thanks!

@Ghost-BD Please let us know if it works for you know or not.

§
Опубліковано: 05.05.2022

Currency converter still is not working without specific changes as before. Thanks.

hacker09Автор
§
Опубліковано: 05.05.2022
Edited: 05.05.2022
§
Опубліковано: 05.05.2022

re: https://greasyfork.org/en/scripts/419825-opera-browser-rocker-mouse-gestures-search-highlight
Right now, I tested standard version 50 of the userscript with above and it was working.
Please note that in FM v2.53 fetch/XHR are mapped to the webpage fetch/XHR and might be affected by webpage CSP.

§
Опубліковано: 05.05.2022

Tested again, works properly without additional fix now. Sorry for misinfo. Thank you both for support.

hacker09Автор
§
Опубліковано: 07.05.2022
Edited: 07.05.2022

@Ghost-BD
@erosman

Thank you.

§
Опубліковано: 09.05.2022

Can you check again Currency Converter please? Now does not work with TM & VM either.

hacker09Автор
§
Опубліковано: 09.05.2022
Edited: 09.05.2022

@Ghost-BD

As @erosman has already mentioned, my scripts depends on the website politics to work, so it does not work on all websites currently, because Google gets blocked in a few websites sometimes.

I think that in the future I will add an error checking feature, that in case it doesn't work with Google, try using bing or an API to do the conversion.

There is no way to bypass the website CSP policy that I know of.

§
Опубліковано: 09.05.2022

OK. Thanks you.

Опублікувати відповідь

Sign in to post a reply.