[Greasemonkey] Long literal strings of html

Steve Krulewitz shooz at mm.st
Wed Apr 20 18:27:00 EDT 2005

> So it's just a matter of deciding:
> - if we want this kind of support for literal string in GM,


> - what specific format to use (do we want to offer an escape sequence
> for /* and */ in the literal strings?).

So far we've seen two versions of this.  Edward's:

/*= <varname>

This implementation had one literal string per comment surrounded block.

The one I've been tinkering with:



This allows for multiple literal strings per comment since the actual
delimiter here is the "==String:<varname==" stuff and not the comment
itself (although the delimiter should only be valid from within the
comment block).  I also tried to create something that followed the
existing "==UserScript==" token.

Any other ideas?

Whatever we chose, care will have to be taken to allow for the embedding
of the literal string delimiters as well as JavaScript comment tokens in
the text block.

Another possibility that we haven't talked about yet is using this to
embed images or other binary data.  We could allow for MIME encoding,
and perhaps make a gm_GetLiteralStringAsDataUrl(name) method?  It might
look like:

Content-Type: image/gif; name="box_gradient2.gif"
Content-Transfer-Encoding: base64


But this might be going a step too far...


More information about the Greasemonkey mailing list