Skip to content

Repository for userscript libraries that contains common utilities designed to help and ease the development of userscripts.

License

Notifications You must be signed in to change notification settings

owowed/userscript-common

Repository files navigation

userscript-common

This repository contains a collection of userscript libraries that provide common tools, utilities, helpers to help and ease the development of userscripts.

Available Libraries

  • 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, and GM_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.

How to Use

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.

Library Dependency

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.jsand 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.)

Contributing

If you have any ideas for new userscripts or improvements to existing ones, feel free to fork this repository and submit a pull request.

License

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.

About

Repository for userscript libraries that contains common utilities designed to help and ease the development of userscripts.

Resources

License

Stars

Watchers

Forks