Ah, sorry to be so cryptic.  The idea is to create a link containing a
'javascript:' url that the user can then drag to the browser's bookmark
bar.  I had something  like this:

<a
href="javascript:(function(){var%20e=document.createElement('script');e.type='text/javascript';e.setAttribute('src','
http://foo.com/js/markCurrent.js?marklet=1234');document.getElementsByTagName('head')[0].appendChild(e)})(<http://foo.com/js/markCurrent.js?marklet=1234%27%29;document.getElementsByTagName%28%27head%27%29%5B0%5D.appendChild%28e%29%7D%29%28>
)">
Bookmarklet
</a>

But the script is a little tricky to read and edit in that form, so I wanted
to programmatically convert it from a more readable version.

I figured out how to run mvn yui-compressor to remove comments from the
script.  Then I read the compressed version of the script file in the
snippet code.   If I were to polish it further, I'd next find a java version
of encodeUriComponent... but it's probably enough for now.

Lee

On Sun, Mar 1, 2009 at 2:48 PM, David Pollak
<[email protected]>wrote:

> Lee,
> If you want to include a JavaScript script on the page, the easiest
> mechanism is:
>
> import net.liftweb.http._
> import js._
> import JsCmds._
> import JE._
>
> Script(JsRaw(a String containing the raw script))
>
> This will create a <script> tag on the page and put a // <![CDATA[ in it
> followed by your script followed by //]]> and the closing </script> tag.
>
> If this is not what you were looking to do, please let us know.
>
> Thanks,
>
> David
>
> On Thu, Feb 26, 2009 at 11:28 AM, Lee Mighdoll <[email protected]>wrote:
>
>> I'd like to make a bookmarklet snippet.  So I want to take a short
>> javascript file, encode it as url, and then include it in a snippet.
>>
>> Any suggestions?  Not sure whether to solve this with mvn or lift -- I'm
>> new to both.
>>
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to