Guest User

Untitled

a guest
May 16th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. trait ScriptFilter extends JsCmd {
  2.  
  3. def content:NodeSeq
  4.  
  5. override def fixHtml(uid: String, content: NodeSeq): String = {
  6. def xform(in: NodeSeq): NodeSeq = in flatMap {
  7. case e: Elem if e.label == "script" => NodeSeq.Empty
  8. case e: Elem => Elem(e.prefix, e.label, e.attributes, e.scope, xform(e.child) :_*)
  9. case g: Group => xform(g.child)
  10. case x => x
  11. }
  12.  
  13. AltXML.toXML(Group(xform(S.session.map(s => s.fixHtml(s.processSurroundAndInclude("JS SetHTML id: " + uid, content))).openOr(content))),false, true, S.ieMode).encJs
  14. }
  15.  
  16. abstract override val toJsCmd:String = super.toJsCmd + (for(script <- content \\ "script") yield script.text).toList.mkString
  17. }
Add Comment
Please, Sign In to add comment