daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest May 16th, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Top