[Lift] Re: Simple Javascript question(from a lift snippet of course...)

2009-07-31 Thread marius d.

Yes. And as much as possible redundancies eliminated. Say script tags
with the same src etc.

Br's,
Marius

On Jul 31, 7:20 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Related question - if there are multiple head sections buried in different 
 places in the xml are they all removed and combined?

 -

 marius d.marius.dan...@gmail.com wrote:

 Well assume you snippet returns a NodeSeq:

 import net.liftweb.http._
 import js._
 import JE._
 import JsCmds._

 def myFunc(xml: NodeSeq): NodeSeq = {
   ...
   resultingNode ++ head{Script(OnLoad(Call(myStartupFunction)))}/
 head

 }

 In the above example we are returning a head node as well which will
 be merged by Lift automatically in the real page head. Then I'm
 using Lift's JavaScript abstractions to call on load function
 myStartupFunction. Instead of

 head{Script(OnLoad(Call(myStartupFunction)))}/head you can also
 use

 head
 script type=text/javascript charset=utf-8{
         Unparsed(
          jQuery(document).ready(function() {
             myStartupFunction();
           })
          )
        }

 /head

 Br's,
 Marius

 On Jul 30, 8:13 am, DFectuoso santiago1...@gmail.com wrote:

  This is probably trivial but can't seem to find the lifty way...
  without hand rolling javascript
  What is the best way to generate(in the snippet) a javascript command
  to be run on the window.onload event?

  Thank you very much you divine and infinite source or lift knowledge
  AKA lift google group =)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Simple Javascript question(from a lift snippet of course...)

2009-07-30 Thread marius d.

Well assume you snippet returns a NodeSeq:

import net.liftweb.http._
import js._
import JE._
import JsCmds._

def myFunc(xml: NodeSeq): NodeSeq = {
  ...
  resultingNode ++ head{Script(OnLoad(Call(myStartupFunction)))}/
head
}


In the above example we are returning a head node as well which will
be merged by Lift automatically in the real page head. Then I'm
using Lift's JavaScript abstractions to call on load function
myStartupFunction. Instead of

head{Script(OnLoad(Call(myStartupFunction)))}/head you can also
use

head
script type=text/javascript charset=utf-8{
Unparsed(
 jQuery(document).ready(function() {
myStartupFunction();
  })
 )
   }

/head


Br's,
Marius

On Jul 30, 8:13 am, DFectuoso santiago1...@gmail.com wrote:
 This is probably trivial but can't seem to find the lifty way...
 without hand rolling javascript
 What is the best way to generate(in the snippet) a javascript command
 to be run on the window.onload event?

 Thank you very much you divine and infinite source or lift knowledge
 AKA lift google group =)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Simple Javascript question(from a lift snippet of course...)

2009-07-30 Thread DFectuoso

Thank you very much! Good to find the lifty way; time to refactor some
code =)

On Jul 29, 11:43 pm, marius d. marius.dan...@gmail.com wrote:
 Well assume you snippet returns a NodeSeq:

 import net.liftweb.http._
 import js._
 import JE._
 import JsCmds._

 def myFunc(xml: NodeSeq): NodeSeq = {
   ...
   resultingNode ++ head{Script(OnLoad(Call(myStartupFunction)))}/
 head

 }

 In the above example we are returning a head node as well which will
 be merged by Lift automatically in the real page head. Then I'm
 using Lift's JavaScript abstractions to call on load function
 myStartupFunction. Instead of

 head{Script(OnLoad(Call(myStartupFunction)))}/head you can also
 use

 head
 script type=text/javascript charset=utf-8{
         Unparsed(
          jQuery(document).ready(function() {
             myStartupFunction();
           })
          )
        }

 /head

 Br's,
 Marius

 On Jul 30, 8:13 am, DFectuoso santiago1...@gmail.com wrote:

  This is probably trivial but can't seem to find the lifty way...
  without hand rolling javascript
  What is the best way to generate(in the snippet) a javascript command
  to be run on the window.onload event?

  Thank you very much you divine and infinite source or lift knowledge
  AKA lift google group =)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Simple Javascript question(from a lift snippet of course...)

2009-07-30 Thread Naftoli Gugenheim

Related question - if there are multiple head sections buried in different 
places in the xml are they all removed and combined?

-
marius d.marius.dan...@gmail.com wrote:


Well assume you snippet returns a NodeSeq:

import net.liftweb.http._
import js._
import JE._
import JsCmds._

def myFunc(xml: NodeSeq): NodeSeq = {
  ...
  resultingNode ++ head{Script(OnLoad(Call(myStartupFunction)))}/
head
}


In the above example we are returning a head node as well which will
be merged by Lift automatically in the real page head. Then I'm
using Lift's JavaScript abstractions to call on load function
myStartupFunction. Instead of

head{Script(OnLoad(Call(myStartupFunction)))}/head you can also
use

head
script type=text/javascript charset=utf-8{
Unparsed(
 jQuery(document).ready(function() {
myStartupFunction();
  })
 )
   }

/head


Br's,
Marius

On Jul 30, 8:13 am, DFectuoso santiago1...@gmail.com wrote:
 This is probably trivial but can't seem to find the lifty way...
 without hand rolling javascript
 What is the best way to generate(in the snippet) a javascript command
 to be run on the window.onload event?

 Thank you very much you divine and infinite source or lift knowledge
 AKA lift google group =)


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