Sha256: caaee7dce7efe99adc03166fcd0a3df0e7a049ec13b70b73727642aef2c414aa
Contents?: true
Size: 820 Bytes
Versions: 3
Compression:
Stored size: 820 Bytes
Contents
@toggleText = -> showChar = 255 ellipsesText = '...' moreText = 'Show more >' lessText = 'Show less' $('.more').each -> content = $(this).html() if content.length > showChar c = content.substr(0, showChar) h = content.substr(showChar, content.length - showChar) html = c + '<span class="more_ellipses">' + ellipsesText + ' </span><span style="display:none;">' + h + '</span> <a href="" class="more_link" style="display:block;">' + moreText + '</a>' $(this).html html $('.more_link').click -> if $(this).hasClass('less') $(this).removeClass 'less' $(this).html moreText else $(this).addClass 'less' $(this).html lessText $(this).siblings('.more_ellipses').toggle() $(this).prev().toggle() false
Version data entries
3 entries across 3 versions & 1 rubygems