Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Haxelib library for writing userscripts.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 example
Octocat-spinner-32 userscript
Octocat-spinner-32 .gitattributes
Octocat-spinner-32 .gitignore
Octocat-spinner-32 COPYING
Octocat-spinner-32 README.md
Octocat-spinner-32 build.sh
Octocat-spinner-32 haxelib.xml
README.md

A set of macros for writing GreaseMonkey userscripts.

In order to use this library, you just need to define a class implementing userscript.UserScript which should contain the GreaseMonkey metadata as Haxe metadata definitions. Please note that in order to use @run-at, you have to use @run_at, as Haxe doesn't allow dashes in metadata keywords.

All metadata must be either just String or an array of Strings. Other values are not supported at the moment.

There is one additional metadata keyword, which isn't included in GreaseMonkey and affects the loader code produced by this library:

@watch_for(variable:String, ?value:String)

These definitions are executed in the order they are specified within the loader code. It is a chain of variable to value equality checks (or existance checks if the value is omitted) which ensure that the main Javascript code is only executed after these conditions are met.

To compile your project using this library, you need to add an additional compilation step, which has to contain the following macro call:

--macro userscript.UserScript.generate(filename:String)

Where the filename is the output file in the first compilation step. After that postprocessing is done, you will find a file called like the specified filename but with a suffix of .user.js.

For further infos about how to use the library, please have a look into the example folder.

Something went wrong with that request. Please try again.