Adding custom foldtext method for javascript.