Skip to content

Commit

Permalink
render-blocking css and javascripts should be at the bottom of pages
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRoch committed Aug 29, 2013
1 parent 3bbfe98 commit 9c91817
Showing 1 changed file with 9 additions and 8 deletions.
Expand Up @@ -189,25 +189,26 @@ class AutoComplete {
Nil ::: jsonOptions
val json = jqOptions.map(t => t._1 + ":" + t._2).mkString("{", ",", "}")
val autocompleteOptions = JsRaw(json)

val onLoad = JsRaw("""

//S.appendJs(JsCmd(<script type="text/javascript" src={"/" + LiftRules.resourceServerPath +"/autocomplete/jquery.autocomplete.js"} />))

S.appendJs(JsRaw("""
jQuery(document).ready(function(){
var data = """+what.encJs+""";
jQuery("#"""+id+"""").autocomplete(data, """+autocompleteOptions.toJsCmd+""").result(function(event, dt, formatted) {
jQuery("#"""+hidden+"""").val(formatted);
});
});""")
});"""))

<span>
<head>
<link rel="stylesheet" href={"/" + LiftRules.resourceServerPath +"/autocomplete/jquery.autocomplete.css"} type="text/css" />
<script type="text/javascript" src={"/" + LiftRules.resourceServerPath +"/autocomplete/jquery.autocomplete.js"} />
{Script(onLoad)}
</head>
{
attrs.foldLeft(<input type="text" id={id} value={start} />)(_ % _)
}
<input type="hidden" name={hidden} id={hidden} value={start} />
<lift:tail>
<link rel="stylesheet" href={"/" + LiftRules.resourceServerPath +"/autocomplete/jquery.autocomplete.css"} type="text/css" />
<script type="text/javascript" src={"/" + LiftRules.resourceServerPath +"/autocomplete/jquery.autocomplete.js"} />
</lift:tail>
</span>
}
}
Expand Down

0 comments on commit 9c91817

Please sign in to comment.