GitXplorerGitXplorer
c

bookmarklet-loader

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
1c599c037c64e506adf0c97914a05384ff893be3

version

ccoolreader18 committed 7 years ago
Unverified
51288d483759b1d0e75f6a62b337ef1260c84f10

changed up some functions, fixed a non bookmarklet */ getting matched

ccoolreader18 committed 7 years ago
Unverified
5f591934e0fcf25fabd7eb78ee8a2d457b3e0eb0

single line comments

ccoolreader18 committed 7 years ago
Unverified
49fbe13dfb058393e6b7621b8f28f915edafc4d0

author is now an array

ccoolreader18 committed 7 years ago
Unverified
3e41a4d83acbcd7fe05c06f0e2081e13ff6fa716

multi line comments

ccoolreader18 committed 7 years ago
Unverified
e6567a6057ead6996bb744f2667e7b75e6312c0c

gitignore

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.