Greasy Fork is available in English.

Discussões » Feedback do Greasy Fork

[external-scripts] data: urls in @require

§
Publicado: 31/12/2023
Editado: 31/12/2023

Are //@require data:application/javascript, ...code allowed on GreasyFork?

In my case, I'm going to use JSZip in my userscript, but found a problem while using it in Tampermonkey's sandboxed environment. The solution, mentioned in the github issue, uses

// @require      data:application/javascript,window.setImmediate%20%3D%20window.setImmediate%20%7C%7C%20((f%2C%20...args)%20%3D%3E%20window.setTimeout(()%20%3D%3E%20f(args)%2C%200))%3B

, which is not specified in GreasyFork's rules for external scripts, and I think this might be allowed in GreasyFork because this is not even an external script, and script users are able to inspect its code.

But after I checked /help/cdns I got a URL is not allowed, but I think that checker might be just for cdns (http*://) and doesn't works for data: urls.

Is that allowed on GreasyFork? If allowed, will I get blocked by greasyfork's filter while publishing scripts with data: urls on greasyfork?

you can also consider to use https://gildas-lormeau.github.io/zip.js/ instead of JSZip

§
Publicado: 31/12/2023

you can also consider to use https://gildas-lormeau.github.io/zip.js/ instead of JSZip

That's a good idea for general use, but in my case JSZip is a dependency of jEpub, which is the final library I actually want to use.

And maybe I can simply replace

// @require      data:application/javascript,window.setImmediate%20%3D%20window.setImmediate%20%7C%7C%20((f%2C%20...args)%20%3D%3E%20window.setTimeout(()%20%3D%3E%20f(args)%2C%200))%3B

by simply inserting

window.setImmediate = window.setImmediate || ((f, ...args) => window.setTimeout(() => f(args), 0));

into my code If data: urls in @require are prohibited on GreasyFork. This is just a small technical problem.

But I think the rule of GreasyFork is much more important than a technical problem.

§
Publicado: 31/12/2023
Editado: 31/12/2023

You can try to use the polyfill for setImmediate.

// @require     https://cdnjs.cloudflare.com/ajax/libs/setImmediate/1.0.5/setImmediate.min.js

See https://github.com/YuzuJS/setImmediate

§
Publicado: 31/12/2023

Wow, that seems to be a wonderful solution for my script, thank you very much.

Still, I want to figure out whether data: urls are allowed in @require on GreasyFork.

§
Publicado: 06/01/2024

Still, I want to figure out whether data: urls are allowed in @require on GreasyFork.

Yes, it is allowed.

§
Publicado: 11/01/2024

Yes, it is allowed.

That's wonderful. Thanks for your reply.

Publicar resposta

Faça o login para publicar uma resposta.