bmlet
Encoding and decoding for bookmarklets.
Home |
MIT License |
v1.0.0
Bookmarklets don't need to be a mess. The key is insulating yourself from what the browser stores with an encode/decode step. That's what bmlet provides. bmlet encode
transforms a normal JS file into a bookmarklet, bmlet decode
recovers the original file. Your code doesn't need to deal with bookmarklet quirks like URI-encoding or the implicit document.write
, and also gets its own namespace, strict mode, and automatic uncaught error display.
Setup
npm install --global bmlet
CLI
bmlet encode
Encodes stdin, outputs to stdout.
bmlet decode
Decodes stdin, outputs to stdout. Only works on bookmarklets created using this library.
API
bmlet.encode(code: string): string
Encodes code
, returns the result.
bmlet.decode(bookmarklet: string): string
Decodes bookmarklet
, returns the result. Only works on bookmarklets created using this library.