@akkie yes tomorrow i could show you also the exception. At this moment I am not in the office. But here
*/
class MyHtmlCompressorFilter @Inject()(val configuration: Configuration,
val environment: Environment,
val mat: Materializer) extends HTMLCompressorFilter {
override val compressor: HtmlCompressor = {
val c = new HtmlCompressor()
if (environment.mode == Mode.Dev) {
c.setPreserveLineBreaks(true)
}
c.setCompressCss(true)
c.setEnabled(true)
c.setRemoveQuotes(true)
c.setRemoveMultiSpaces(true)
c.setRemoveScriptAttributes(true)
c.setRemoveComments(true)
c.setRemoveIntertagSpaces(true)
c.setRemoveHttpProtocol(true)
c.setRemoveHttpsProtocol(true)
//c.setCompressJavaScript(true)
c.setRemoveJavaScriptProtocol(true)
c.setRemoveFormAttributes(true)
c
}
}
@akkie The promiesed error:
! @70i16o194 - Internal server error, for (GET) [/] ->
play.api.http.HttpErrorHandlerExceptions
KaTeX parse error: Unexpected character: '$' at position 4: anon̲$1: Execution : anon$1: Execution exception[[StringIndexOutOfBoundsException: String index out of range: 436]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:280)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:206)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:98)
at play.core.server.netty.PlayRequestHandler
anonfun$2KaTeX parse error: Unexpected character: '$' at position 7: anonfun̲$apply$1.apply: anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
at play.core.server.netty.PlayRequestHandler
anonfun$2KaTeX parse error: Unexpected character: '$' at position 7: anonfun̲$apply$1.apply: anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at scala.concurrent.Future
anonfun$recoverWith$1.apply(Future.scala:346)KaTeX parse error: Unexpected character: '$' at position 7: anonfun̲$recoverWith$1: anonfun$recoverWith$1.apply(Future.scala:345)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 436
at java.lang.String.substring(String.java:1963)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceString(JavaScriptCompressor.java:269)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:333)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.(JavaScriptCompressor.java:536)
at com.googlecode.htmlcompressor.compressor.YuiJavaScriptCompressor.compress(YuiJavaScriptCompressor.java:53)
at com.googlecode.htmlcompressor.compressor.HtmlCompressor.compressJavaScript(HtmlCompressor.java:946)
at com.googlecode.htmlcompressor.compressor.HtmlCompressor.processScriptBlocks(HtmlCompressor.java:881)
at com.googlecode.htmlcompressor.compressor.HtmlCompressor.processPreservedBlocks(HtmlCompressor.java:771)
at com.googlecode.htmlcompressor.compressor.HtmlCompressor.compress(HtmlCompressor.java:220)
at com.mohiva.play.compressor.CompressorFilter.com$mohiva$play$compressor$CompressorFilter
compress$1(CompressorFilter.scala:87)
the javascript inside the main.scala.html
<script type="text/javascript">
$(function() {
$('a[href^="mailto:"]').each(function() {
this.href = this.href.replace('(at)', '@@').replace(/(dot)/g, '.');
// Remove this line if you don't want to set the email address as link text:
this.innerHTML = this.href.replace('mailto:', '');
});
$.ajax({
//url: "@routes.Articles.xCrossSelling(1,6).absoluteURL()",
url: "@routes.Articles.articleHighlightOnPage( if(req.path.trim.isEmpty || req.path.trim == "/") "index" else req.path.trim ).url",
//dataType:"text/html",
method: "GET"//,
//mimeType: "application/json"
}).success(function(data,a,b){
$('#article_highlight').append(data);
$('#article_highlight_loading').hide();
});
});
</script>