• Stars
    star
    212
  • Rank 186,122 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A server-side bookmarklet compiler with greasemonkey userscript-like metadata options and the power of babel and uglify

Bookmarklet: sane development, familiar format

Build Status code style: prettier

Bookmarklet is a nodejs module for compiling bookmarklets in server-side code and directly from the shell. You can run it on any JavaScript file—it will minify it using uglify-js, wrap it in a self executing function, and return an escaped bookmarklet.

More so, it supports a metadata block—modeled after the greasemonkey userscript metadata block—to specify metadata, external stylesheets and script includes, which can look like this:

// ==Bookmarklet==
// @name LoveGames
// @author Old Gregg
// @style !loadOnce https://mrcoles.com/media/css/silly.css
// @script https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/Bookmarklet==

Most notably, you can specify any external scripts that you’d like your bookmarklet to include via the @script rule, which can be repeated as many times as you’d like.

NOTE: currently with script includes you have to handle noConflict scenarios yourself, e.g., you might want to start off a script with var $ = jQuery.noConflict(true).

In addition, any css files included with @style will be injected.

By default, every time the bookmark is hit, it will add the script and style tags again. You customize each one per line by adding a !loadOnce declaration between the @style or @script param and the path for the asset. See the example above.

As of v1.0.0, this now uses Babel with the present "env" to make the code backwards compatible before minifying it.

This project is open to suggestions & pull requests.

Also, if you’re just looking for a quick way to throw together a bookmarklet, try my browser-based bookmarklet creator.

Installation

The dependency can be found on NPM as “bookmarklet”. You can install it with:

npm install bookmarklet

Usage

You can easily see usage by running bookmarklet -h:

> bookmarklet -h
Bookmarklet v0.0.1 usage: bookmarklet [-d | --demo] source [destination]

-d | --demo - output a demo HTML page for sharing the bookmarklet
source      - path to file to read from or `-` for stdin
destination - path to file to write to

The default output is the raw bookmarlet code. NEW add the --demo flag to output a test HTML page that includes the bookmarklet on it.

Testing

A very basic test script can be run via bash test/run.sh

More Repositories

1

markdown-css

CSS for making regular HTML look like plain-text markdown.
CSS
1,430
star
2

full-page-screen-capture-chrome-extension

One-click full page screen captures in Google Chrome
JavaScript
1,310
star
3

node-react-docker-compose

A reference for running a node server and create-react-app app via docker-compose.
JavaScript
313
star
4

javascript-piano

An HTML5 JavaScript synth piano that generates all of its sounds using data URIs.
JavaScript
134
star
5

cssunminifier

A tool to unminify CSS—written in node.js
JavaScript
123
star
6

readmd

Pretty-print markdown
Python
32
star
7

todo-stack

Instead of a todo list, this is a todo stack—to improving multi-tasking of small daily tasks. Built on backbone.js
JavaScript
17
star
8

async-include

A super simple way to asynchronously include content on your page
JavaScript
15
star
9

static-less-coffeescript-grunt-project

A sample grunt project that compiles less and coffeescript files
JavaScript
14
star
10

picdinner_meteor

A meteor application to combine pics and audio.
JavaScript
11
star
11

original-facebook-graph-api-explorer

A tool to explore the data and options available in the graph API.
JavaScript
11
star
12

favicon-creator

Create favicons purely in Javascript
JavaScript
9
star
13

buttonmakerjs

A simple tool for generating CSS buttons.
JavaScript
8
star
14

a-muscle

Please don’t pull this repo!
7
star
15

e7n

🌎 A tool for Chrome extensions i18n/l10n to auto-populate _locales/<default_locale>/messages.json with messages from JS and HTML files
TypeScript
6
star
16

jquery-slideshow

A simple image slide show jQuery plugin
JavaScript
5
star
17

dateknight

A universal date time string formatting reference
JavaScript
4
star
18

callback-promise-async-await

Samples of callbacks, promises, and async/await usage
JavaScript
4
star
19

war-js

A JavaScript simulator of the card game war.
JavaScript
3
star
20

recursivedrawing-imageexport

User script to add an image exporting feature to recursivedrawing.com
JavaScript
3
star
21

test-chrome-extension-activetab-webrequest

This test extension uses only the `activeTab` permission and tries to access the `chrome.webRequest` API (which fails).
HTML
3
star
22

mkdjangovirtualenv

An enhancement to mkvirtualenv, specifically for django projects.
Shell
3
star
23

pinterest-api

Unoffocial API for getting a user’s pinterest pins
JavaScript
3
star
24

space-creatures

Something kind of like Space Invaders… but cuter?
JavaScript
2
star
25

emojis-json

A JSON file containing group, subgroup, character code, CLDR name, and version for all emojis (via unicode.org v12 datasets)
JavaScript
2
star
26

pseudo-cheerio

:pseudo-class support for the Cheerio NodeJS module
JavaScript
2
star
27

test-chrome-extension-capturetab

Simple example of capturing the visible tab.
JavaScript
2
star
28

expand-linkedin-bookmarklet

Bookmarklet for auto-expanding LinkedIn content
JavaScript
2
star
29

extract-garageband-midi

Extra the MIDI file from a GarageBand loop
Python
2
star
30

raphael-reference-css

Chrome user script to make the Raphael.js reference page TOC more useful.
JavaScript
2
star
31

test-chrome-extension-downloadrecents

Chrome extension test of “Save As” with download and defaulting to the recent save as directory
HTML
2
star
32

emoji-image-generator

An experiment in bulk-creating images of emojis in the browser.
JavaScript
2
star
33

test-chrome-extension-sandbox

Test to trigger settimeout not working in messages for an extension content script on content security policy sandbox pages
JavaScript
1
star
34

test-chrome-extension-executeiframes

Test `executeScript` with `allFrames: true`.
JavaScript
1
star
35

pxl-treats

a simple rust “game” to feed treats to a hungry pixel
Rust
1
star
36

dynamodb-full-scan

Helpers for doing full paginated scan operations as a Promise or AsyncGenerator with the "asw-sdk" DynamoDB DocumentClient.
TypeScript
1
star
37

videoloop

An experiment with delay and looping of video
JavaScript
1
star
38

jacobs-css3-ladder

JavaScript
1
star
39

todo-stack_meteor

A micro-task manager for keeping track of things as they stack up throughout the day—written in Meteor.
JavaScript
1
star
40

langtons-ant

A JavaScript implementation of Langton’s ant
JavaScript
1
star
41

e7n-aws-translate

🌍 A script for loading Chrome extension messages.json files and generating translations.
TypeScript
1
star