Giter Site home page Giter Site logo

rybak / userscript-libs Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3 KB

Libraries for use by developers in their userscripts

Home Page: https://greasyfork.org/en/users/951503-andrybak?sort=created

JavaScript 100.00%
lib libraries library userscript userscripts userscript-library

userscript-libs's Introduction

Userscript libraries

These are libraries for use in userscripts by developers.

How to use a library

Using waitForElement.js as an example โ€“ replace the filename in instructions with the library you would like to use.

Add a @require entry to metadata of the userscript:

// @require https://github.com/rybak/userscript-libs/raw/<commit>/waitForElement.js

Replace the <commit> placeholder with the hash of the commit that you want to use.

If you want to publish the userscript on Greasy Fork, you'll have to follow their policy on external scripts. This can be done using the JSDelivr CDN or other content delivery networks approved by Greasy Fork. Greasy Fork (rightly) doesn't allow using a branch or a tag.

// @require https://cdn.jsdelivr.net/gh/rybak/userscript-libs@<commit>/waitForElement.js

Libraries

waitForElement

Provides a way for userscripts to wait for native HTML or SVG elements to be loaded, before performing some operation on them. Function waitForElement takes a selector as a parameter and returns a Promise. The returned Promise gets resolved with an Element corresponding to the given selector, when the element appears in the document. Usage:

waitForElement('#targetId').then(target => {
	// extract information from `target`:
	const text = target.innerText;
	// add your own elements to `target`:
	target.append("Hello, world!");
});

userscript-libs's People

Contributors

rybak avatar

Stargazers

 avatar

Watchers

 avatar  avatar

userscript-libs's Issues

Library for setting favicons

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.