Greasy Fork is available in English.
Mini A.I. floating menu that can define words, answer questions, translate, and much more in a single click and with your custom prompts. Includes useful click to search on Google and copy selected text buttons, along with Rocker+Mouse Gestures and Units+Currency+Time zone Converters, all features can be easily modified or disabled.
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
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.
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.
That is true. Still hoping you will find spare time to implement GM_xmlhttpRequest|GM.xmlHttpRequest
which will lead better compatibility. Thank you.
FireMonkey compatible fix is posted here. (lines 322-325, 1.5 lines of extra code)
@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
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
FireMonkey v2.53 should work with standard userscript without the need for above changes.
Currency converter still is not working without specific changes as before. Thanks.
@Ghost-BD
Have you tested them on this page?
https://greasyfork.org/en/scripts/419825-opera-browser-rocker-mouse-gestures-search-highlight
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.
Tested again, works properly without additional fix now. Sorry for misinfo. Thank you both for support.
Can you check again Currency Converter please? Now does not work with TM & VM either.
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.
OK. Thanks you.
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.