This repository contains a collection of userscript libraries that provide common tools, utilities, helpers to help and ease the development of userscripts.
- Wait for Element (Source): Provides utility functions to get and wait for elements asyncronously that are not yet loaded or available on the page.
- OxiStorage (Source): Provides an API around
GM_getValue
,GM_setValue
, andGM_deleteValue
to manage userscript storage. - Mutation Observer (Source): A simple wrapper around MutationObserver API to watch DOM changes.
- Common (Source): Provides common utilities for userscript-common libraries. It is recommended to automatically include this in your userscript alongside other libraries, as most libraries usually depend on it.
To use any of the libraries in this repository, simply add the following lines to your userscript header:
// ==UserScript==
// ...
// @require https://github.com/owowed/userscript-common/raw/main/<filename-here>.js
// ...
// ==/UserScript==
Replace <filename-here>
with the filename of the library you want to use. For example, to include the mutation-observer.js
library, add the following line to your userscript header:
// @require https://github.com/owowed/userscript-common/raw/main/mutation-observer.js
You can also copy the raw Source
link under Available Libraries.
Some library may depend on other library. You can usually see this on the library's @require
directive, placed on the userscript header (on top of the file). For those kinds of libraries, you must also require the same dependencies as required by the library itself.
For example, the wait-for-element.js
library requires the common.js
and mutation-observer.js
library. In order to include wait-for-element.js
in your userscript, you must also include common.js
and mutation-observer.js
.
// ==UserScript==
// ...
// @require https://github.com/owowed/userscript-common/raw/main/common.js
// @require https://github.com/owowed/userscript-common/raw/main/mutation-observer.js
// @require https://github.com/owowed/userscript-common/raw/main/wait-for-element.js
// ...
// ==/UserScript==
(note: the order of @require
directive does not matter, as userscript-common libraries usually only provide functions that are not executed immediately unless called/used by the developer.)
If you have any ideas for new userscripts or improvements to existing ones, feel free to fork this repository and submit a pull request.
This repository and all of its libraries are licensed under GNU LGPL-3.0, a free and open-source license. For more information, please see the license file.