GitHub-Dark-Script icon indicating copy to clipboard operation
GitHub-Dark-Script copied to clipboard

Support for GM_*-style script injectors

Open Bluscream opened this issue 6 years ago • 6 comments

Can you add a function that checks wether the GM.* functions are available and if not tries to use GM_* ?

I want to use this in https://github.com/AdguardTeam/AdguardForWindows but as of now it does only support the GM_* syntax.

image

Bluscream avatar Aug 22 '19 23:08 Bluscream

Most of the GM_ functions are supported (ref).

The error is actually GM. which is what we added to support GM4. I'm not sure why the polyfill isn't working for you, but I guess we could detect the GM. functions and fallback to GM_ functions.

Mottie avatar Aug 22 '19 23:08 Mottie

I hope they just implement the GM. variants, it's not that hard. In the meantime i try to manifest @ameshkov's answer into the docs (https://github.com/AdguardTeam/AdguardKnowledgeBase/pull/370).

And yes a check like if (GM === "undefined) would be neat, maybe there are other injectors that also just support the GM_ variants

Bluscream avatar Aug 22 '19 23:08 Bluscream

GM4 has been out for a while and I see no movement from other engines towards GM., so I think it's pretty save to save those engines will probably stay on GM_.

silverwind avatar Aug 23 '19 03:08 silverwind

GM4 has been out for a while and I see no movement from other engines towards GM., so I think it's pretty save to save those engines will probably stay on GM_.

others, yes. ag no if i annoy andrey enough =D

Bluscream avatar Aug 23 '19 03:08 Bluscream

Regarding this issue, I'm not sure what the exact problem is. We exclusively use GM. and the polyfill defines any GM_ ones if absent and then maps GM. to them, so in a engine only supporting GM_, those should be already be used. Could it be that the polyfill is not working for some reason?

silverwind avatar Aug 23 '19 04:08 silverwind

Hmm, idk why in that case :thinking:

Bluscream avatar Aug 23 '19 07:08 Bluscream