$(document).ready(function() {
$('.fulltext').each(function() {
var $this = $(this);
if($this.html().length > 500){
console.log(($this.html().length));
var wrappedArticle = wrapArticle($this.html()) + "...";
$this.css('cursor', 'pointer');
}else{
var wrappedArticle = wrapArticle($this.html())
};
$this.html(wrappedArticle);
})
$('.fulltext').click(function(){
$(this).parent().find('.hidden').fadeToggle(300);
})
})
function wrapArticle(text, index = 500)
{
var result = text.substr(0, index);
return result + "<span class=\"hidden\">" + text.substr(index) + "</span>";
}
if __name__ == "__main__":
app.run(host='0.0.0.0')