GitXplorerGitXplorer
c

bookmarklet-loader

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
0b7c3680cdf4a91bd3ffeac84de09fbb37741bcc

removed debugger stuff

ccoolreader18 committed 7 years ago
Unverified
b6195e8533503a140a40ae22b11f31886caf6d79

fixed typo 'verison'

ccoolreader18 committed 7 years ago
Unverified
959fe55d756402117126f254bd67a1aff0445ebd

fixed a thing where it wasn't loading

ccoolreader18 committed 7 years ago
Unverified
ae47b36d98ced0c5e86c54c341e2960eae54b88e

version

ccoolreader18 committed 7 years ago
Unverified
5976bd0e5def016aa1519ce381be49e832c9f442

expand

ccoolreader18 committed 7 years ago
Unverified
c6995aace753c601fac115c63c2a121aafe32a65

formatting

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.