Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to automatically convert a Greasemonkey script into a bookmarklet?

For those who don't know what a bookmarklet is: http://en.wikipedia.org/wiki/Bookmarklet

like image 613
Epaga Avatar asked Oct 02 '09 07:10

Epaga


1 Answers

To my knowledge, there's no "automatic" way to achieve this but doing it manually shouldn't be too hard.

If the script doesn't depend on the GreaseMonkey API then it should be as simple as copy n' paste, perhaps with some minification to get it all on one line.

You'll probably want to wrap it all in the following code too:

javascript: (function(){ /* Your code here */ })();

Also, be aware of the limits (you can't have an infinitely long bookmarklet): https://www.squarefree.com/bookmarklets/limits.html

like image 97
James Avatar answered Nov 02 '22 01:11

James