GitXplorerGitXplorer
c

bookmarklet-loader

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
82f4cf18ced88747e6db378945e5098d613ab346

comments

ccoolreader18 committed 7 years ago
Unverified
61251895826394371328dcae5f7bd2c14f6afdff

async, module.exports

ccoolreader18 committed 7 years ago
Unverified
6a0b0af5a8a8a3b3c3d2d929c0169a712847884e

bump version

ccoolreader18 committed 7 years ago
Unverified
bf873939f1336ec77386bd83a9884a38c5a902bd

fixed inblock.multi, comments, etc

ccoolreader18 committed 7 years ago
Unverified
86fc798655f69031154ab908ea43d9cbfe2c59fe

fixed some weird formatting?

ccoolreader18 committed 7 years ago
Unverified
5fecf505667a635bceb4ec24ae3b566ee3a39a4b

removed parseGithub as its own function, basically useless

ccoolreader18 committed 7 years ago

README

The README file for this repository.

Bookmarklet Loader

A bookmarklet loader using mrcoles/bookmarklet syntax. It allows for easy bookmarklet loading and processing from a remote url, using mrcoles' bookmarklet metadata, and it getting a file from the latest GitHub repository release.

Usage

Look at mrcoles/bookmarklet, use that metadata if you'd like to. It lets you effectively 'require' scripts or import css, which makes things very easy. Example of how you'd use this:

{
  let c = () => {
    BMLoader.loadGithub("<name>/<repo>/<path or whatever>/<file>.min.js")
  }
  if (window.BMLoader) {
    c()
  } else {
    let s = document.createElement("script");
    s.src = "https://cdn.rawgit.com/coolreader18/bookmarklet-loader/v2.0.0/bookmarklet.min.js";
    document.body.append(s);
    s.onload = c
  }
}

Keep in mind that this draws from GitHub releases, not git tags. Other options are loadBookmarklet("<url>"), which loads directly from a given url, processScript("<script>"), which directly takes a script input, runs it through the parser, and executes it. You could also just copy the entirety of the bookmarkelt.min.js, and put your loader function after. Then minify it, bookmarklify it, whatever. Just make sure to keep the metadata, as it is in comments that would likely be removed.

OR

Just use coolreader18.github.io/bookmarklet-loader.

Credit

mrcoles/bookmarklet, I took some code from there to parse the bookmarklet files, and it uses his syntax in the first place. It also inspired me to make this in the first place, so kudos to him.